diff --git a/.vscode/launch.json b/.vscode/launch.json deleted file mode 100755 index 822e5d1e..00000000 --- a/.vscode/launch.json +++ /dev/null @@ -1,17 +0,0 @@ -{ - // Use IntelliSense to learn about possible attributes. - // Hover to view descriptions of existing attributes. - // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387 - "version": "0.2.0", - "configurations": [ - { - "type": "node", - "request": "launch", - "name": "Launch Program", - "skipFiles": [ - "/**" - ], - "program": "${file}" - } - ] -} \ No newline at end of file diff --git a/config/app.settings.js b/config/app.settings.js index c2bb9500..590ba2d2 100755 --- a/config/app.settings.js +++ b/config/app.settings.js @@ -1,19 +1,20 @@ -function SettingStoragedValue(e) { +function SettingStoragedValue(e){ try { - const fromStorage = JSON.parse(localStorage.getItem('app_settings')) - const Ite = fromStorage.map(item => { - return item.SettingID === e ? item.value : null - }) - const fr = Ite.filter(Boolean) - return fr.toString() - } catch (error) { - return null - } + const fromStorage = JSON.parse(localStorage.getItem('app_settings')) + const Ite = fromStorage.map(item => { + return item.SettingID === e? item.value : null + }) + const fr = Ite.filter(Boolean) + return fr.toString() + } + catch (error) { + return null + } } const fromStorage = JSON.parse(localStorage.getItem('app_settings')) export var AppSettings = { - // Global Behaviors + // Global Behaviors InfiniteLoading: false, InfiniteLogin: false, InfiniteRegister: false, @@ -21,33 +22,17 @@ export var AppSettings = { DisableRegister: true, DisablePasswordRecover: true, // Activating this, the logs must be trowed - force_showDevLogs: fromStorage - ? SettingStoragedValue('force_showDevLogs') - : false, - StrictLightMode: fromStorage - ? SettingStoragedValue('strict_lightMode') - : false, - SignForNotExpire: fromStorage - ? SettingStoragedValue('sessions_noexpire') - : false, - auto_search_ontype: fromStorage - ? SettingStoragedValue('auto_search_ontype') - : false, - auto_feedrefresh: fromStorage - ? SettingStoragedValue('auto_feedrefresh') - : false, - default_showpostcreator: fromStorage - ? SettingStoragedValue('default_showpostcreator') - : false, - default_collapse_sider: fromStorage - ? SettingStoragedValue('default_collapse_sider') - : true, - force_show_postactions: fromStorage - ? SettingStoragedValue('force_show_postactions') - : false, + force_showDevLogs: fromStorage? SettingStoragedValue('force_showDevLogs') : false, + StrictLightMode: fromStorage? SettingStoragedValue('strict_lightMode') : false, + SignForNotExpire: fromStorage? SettingStoragedValue('sessions_noexpire') : false, + auto_search_ontype: fromStorage? SettingStoragedValue('auto_search_ontype') : false, + auto_feedrefresh: fromStorage? SettingStoragedValue('auto_feedrefresh') : false, + default_showpostcreator: fromStorage? SettingStoragedValue('default_showpostcreator') : false, + default_collapse_sider: fromStorage? SettingStoragedValue('default_collapse_sider') : true, + force_show_postactions: fromStorage? SettingStoragedValue('force_show_postactions') : false, MaxLengthPosts: '512', CurrentBundle: 'light_ng', // In KB MaximunAPIPayload: '101376', - limit_post_catch: '20', -} + limit_post_catch: '20' +} \ No newline at end of file diff --git a/config/keys.js b/config/keys.js index 3082a122..cc4a382a 100755 --- a/config/keys.js +++ b/config/keys.js @@ -1,3 +1,7 @@ module.exports = { + // Global Server Key (Requiered for RS-YIBTP), Not autogenerated, must be included on. (Recommended not modify this constants) + + server_key: + 'f706b0a535b6c2d36545c4137a0a3a26853ea8b5-1223c9ba7923152cae28e5a2e7501b2b-50600768', secretOrKey: 'secret', } diff --git a/config/ycore.config.js b/config/ycore.config.js index 0b9f3e87..3948cfc7 100755 --- a/config/ycore.config.js +++ b/config/ycore.config.js @@ -18,13 +18,6 @@ module.exports = { exclude: [/\/login/, /\/socket\/(.*)/, /\/publics/, /\/authorize/], }, ], - yConfig: { - // Disused Variables, exported from yCoreWorker - // Global Server Key (Requiered for RS-YIBTP), Not autogenerated, must be included on. (Recommended not modify this constants) - server_key: - 'f706b0a535b6c2d36545c4137a0a3a26853ea8b5-1223c9ba7923152cae28e5a2e7501b2b-50600768', - }, - i18n: { languages: [ diff --git a/globals/endpoints.js b/globals/endpoints.js index 7a3e9292..7ddc39e1 100755 --- a/globals/endpoints.js +++ b/globals/endpoints.js @@ -9,6 +9,7 @@ module.exports = { get_posts: "https://api.ragestudio.net/RSA-COMTY/r/posts?access_token=", find_user: "https://api.ragestudio.net/RSA-COMTY/r/find_user?access_token=", search_endpoint: "https://api.ragestudio.net/RSA-COMTY/r/search?access_token=", + all_sessions: "https://api.ragestudio.net/RSA-COMTY/r/sessions?access_token=", get_sessions: "https://api.ragestudio.net/RSA-COMTY/r/session_id?access_token=", auth_endpoint: "https://api.ragestudio.net/RSA-COMTY/r/auth", new_post: "https://comty.julioworld.club/api/new_post?access_token=", diff --git a/package.json b/package.json index 9204122d..117ad824 100755 --- a/package.json +++ b/package.json @@ -3,7 +3,8 @@ "UUID": "C8mVSr-4nmPp2-pr5Vrz-CU4kg4", "title": "Comty™", "DevBuild": true, - "version": "0.2.24", + "version": "0.2.25", + "stage": "A1", "description": "", "main": "app/main.js", "author": "RageStudio", diff --git a/src/@ycore/libs/app_functions/pre.js b/src/@ycore/libs/app_functions/pre.js index 70435359..bbac18d3 100644 --- a/src/@ycore/libs/app_functions/pre.js +++ b/src/@ycore/libs/app_functions/pre.js @@ -1,6 +1,10 @@ +import { transitionToogle } from '../../../pages/login' import { SetControls, CloseControls } from '../../../components/Layout/Control' import { SwapMode } from '../../../components/Layout/Secondary' import * as ycore from 'ycore' +import * as antd from 'antd' +import * as Icons from '@ant-design/icons' +import React from 'react' export function QueryRuntime() { const validBackup = ycore.validate.backup() @@ -10,11 +14,14 @@ export function QueryRuntime() { export function SetupApp() { // TODO: Default sets - ycore.notify.success('Authorised, please reload the app for login!') + ycore.notify.success('Authorised, please wait...') const resourceLoad = localStorage.getItem('resource_bundle') if (!resourceLoad) { localStorage.setItem('resource_bundle', 'light_ng') } + setTimeout(() => { + ycore.crouter.native('main') + }, 500) } export const CheckThisApp = { @@ -45,33 +52,14 @@ export const ControlBar = { }, } -export function RefreshONCE() { - window.location = '/' +export const LoginPage = { + transitionToogle: () => { + transitionToogle() + }, } -export function DetectNoNStableBuild(e1) { - switch (e1) { - case 'TagComponent': - if (package_json.DevBuild == true) { - return React.createElement(antd.Tag, { color: 'orange' }, ' No Stable') - } - if (package_json.DevBuild == false) { - return React.createElement(antd.Tag, { color: 'blue' }, ' Stable') - } else { - return 'No Stable' - } - break - default: - if (package_json.DevBuild == true) { - return 'No Stable' - } - if (package_json.DevBuild == false) { - return 'Stable' - } else { - return 'No Stable' - } - break - } +export function RefreshONCE() { + window.location = '/' } export const app_session = { diff --git a/src/@ycore/libs/comty_ng/comty_get.js b/src/@ycore/libs/comty_ng/comty_get.js index 8a8f9eea..8dbfd1e7 100644 --- a/src/@ycore/libs/comty_ng/comty_get.js +++ b/src/@ycore/libs/comty_ng/comty_get.js @@ -1,11 +1,21 @@ import { API_Call, endpoints } from 'ycore' export const comty_get = { + sessions: (callback) => { + let formdata = new FormData() + formdata.append('type', 'get') + + API_Call( + (err, res) => { + return callback(err, res) + }, + endpoints.all_sessions, + formdata + ) + }, session_data: () => {}, general_data: () => { - if (!payload) { - return false - } + if (!payload) return false const { id } = payload let formdata = new FormData() diff --git a/src/@ycore/libs/comty_ng/get_app_session.js b/src/@ycore/libs/comty_ng/get_app_session.js index 1a7012ed..87588181 100644 --- a/src/@ycore/libs/comty_ng/get_app_session.js +++ b/src/@ycore/libs/comty_ng/get_app_session.js @@ -1,9 +1,9 @@ -import { yConfig, yconsole, endpoints, token_data } from 'ycore' +import { __server, yconsole, endpoints, token_data } from 'ycore' export const get_app_session = { get_id: callback => { let formdata = new FormData() - formdata.append('server_key', yConfig.server_key) + formdata.append('server_key', __server.getKey()) formdata.append('type', 'get') const requestOptions = { method: 'POST', @@ -24,7 +24,7 @@ export const get_app_session = { }, raw: callback => { const formdata = new FormData() - formdata.append('server_key', yConfig.server_key) + formdata.append('server_key', __server.getKey()) formdata.append('type', 'get') const requestOptions = { method: 'POST', diff --git a/src/@ycore/libs/rs_cloud/api_call.js b/src/@ycore/libs/rs_cloud/api_call.js index 4f187142..02e32105 100644 --- a/src/@ycore/libs/rs_cloud/api_call.js +++ b/src/@ycore/libs/rs_cloud/api_call.js @@ -8,7 +8,7 @@ export function API_Call(callback, endpoint, payload, options, __token) { ycore.yconsole.log(prefix, 'Calling api without Payload!!!') } let payloadContainer = payload ? payload : new FormData() - payloadContainer.append('server_key', ycore.yConfig.server_key) + payloadContainer.append('server_key', ycore.__server.getKey()) let fendpoint = `${endpoint}${ycore.token_data.__token()}` let method @@ -64,6 +64,15 @@ export function API_Call(callback, endpoint, payload, options, __token) { jquery .ajax(requestOptions) .done(response => { + try { + const a = JSON.parse(response)['api_status'] + if (a == '404') { + ycore.Alive_API.tokenError(response) + } + } catch (error) { + ycore.yconsole.log('[VIOLATION] The status of the request has not been identified!') + ycore.Alive_API.violation() + } ycore.yconsole.log(response) return callback(false, response) }) diff --git a/src/@ycore/libs/rs_cloud/pre.js b/src/@ycore/libs/rs_cloud/pre.js index 4d7d6f74..6ddef3ec 100644 --- a/src/@ycore/libs/rs_cloud/pre.js +++ b/src/@ycore/libs/rs_cloud/pre.js @@ -1,5 +1,6 @@ import * as ycore from 'ycore' export * from './api_call.js' +import keys from '../../../../config/keys.js' export const Alive_API = { fail: a => { @@ -8,6 +9,23 @@ export const Alive_API = { ycore.notify.error(a) } }, + tokenError: a => { + ycore.notify.expire( + 'It seems that your token has expired or no longer exists' + ) + ycore.crouter.native('login') + }, + violation: a => { + ycore.notify.expire( + 'It seems that there has been a problem with your token, we need you to log in again.' + ) + ycore.crouter.native('login') + }, +} +export const __server = { + getKey: () => { + return keys.server_key + }, } export const __rscloud = { yulio_id: { diff --git a/src/@ycore/ycore_worker.js b/src/@ycore/ycore_worker.js index b93a8470..4cd03d15 100755 --- a/src/@ycore/ycore_worker.js +++ b/src/@ycore/ycore_worker.js @@ -21,13 +21,21 @@ export * from '../../config/app.settings.js' export * from './libs.js' export var { router } = require('utils') -export var yConfig = config.yConfig export var endpoints = Endpoints -var package_json = require('../../package.json') +export const package_json = require('../../package.json') export const UUAID = `${package_json.name}==${package_json.UUID}` +export const AppInfo = { + apid: package_json.name, + stage: package_json.stage, + name: package_json.title, + version: package_json.version, + logo: config.FullLogoPath, + logo_dark: config.DarkFullLogoPath, +} + localforage.config({ name: UUAID, version: 1.0, @@ -35,14 +43,6 @@ localforage.config({ storeName: package_json.name, }) -export const AppInfo = { - apid: package_json.name, - name: package_json.title, - version: package_json.version, - logo: config.FullLogoPath, - logo_dark: config.DarkFullLogoPath, -} - /** * Convert a base64 string in a Blob according to the data and contentType. * @@ -114,21 +114,6 @@ export function uploadFile(file) { request.send(formData) } -/** - * (HELPER) Convert the localStorage values (AppSettings) parsed - * - * @param e {String} String of SettingID for search - * @return {string} Boolean value - */ -export function SettingStoragedValue(e) { - try { - const fromStorage = JSON.parse(localStorage.getItem('app_settings')) - ycore.ReturnValueFromMap({ data: fromStorage, key: e }) - } catch (error) { - return null - } -} - /** * Return the value of an object from array * @@ -150,6 +135,25 @@ export function ReturnValueFromMap(payload) { } } +/** + * (HELPER) Convert the localStorage values (AppSettings) parsed + * + * @param e {String} String of SettingID for search + * @return {string} Boolean value + */ +export function SettingStoragedValue(e) { + try { + const fromStorage = JSON.parse(localStorage.getItem('app_settings')) + const Ite = fromStorage.map(item => { + return item.SettingID === e ? item.value : null + }) + const fr = Ite.filter(Boolean) + return fr.toString() + } catch (error) { + return null + } +} + /** * Return the last object from array * @@ -246,7 +250,37 @@ export const crouter = { * Framework functionality for show with interface an notification * */ +const {FieldTimeOutlined} = require('@ant-design/icons') export const notify = { + expire: (...res) => { + antd.notification.error({ + message: 'Hey ', + icon: , + description: res, + placement: 'bottomLeft', + }) + }, + info: (...res) => { + antd.notification.info({ + message: 'Well', + description: res.toString(), + placement: 'bottomLeft', + }) + }, + exception: (...res) => { + antd.notification.error({ + message: 'WoW!', + description: res.toString(), + placement: 'bottomLeft', + }) + }, + warn: (...res) => { + antd.notification.warn({ + message: 'Hey!', + description: res.toString(), + placement: 'bottomLeft', + }) + }, success: (...res) => { antd.notification.success({ message: 'Well', diff --git a/src/components/App_about/index.js b/src/components/App_about/index.js new file mode 100644 index 00000000..e6c4f280 --- /dev/null +++ b/src/components/App_about/index.js @@ -0,0 +1,29 @@ +import React from 'react' +import styles from './index.less' +import * as ycore from 'ycore' +import * as antd from 'antd' + +export default class App_About extends React.Component { + DetectNoNStableBuild() { + if (ycore.package_json.DevBuild == false) { + return Stable + } else { + return No Stable + } + } + render() { + return ( +
+ + +

{ycore.AppInfo.name}

+ {ycore.UUAID} +
+ v{ycore.AppInfo.version} + {ycore.AppInfo.stage} + {this.DetectNoNStableBuild()} +
+
+ ) + } +} diff --git a/src/pages/settings/components/about.less b/src/components/App_about/index.less old mode 100755 new mode 100644 similarity index 100% rename from src/pages/settings/components/about.less rename to src/components/App_about/index.less diff --git a/src/components/MainFeed/index.js b/src/components/MainFeed/index.js index c250297f..26d39e0c 100755 --- a/src/components/MainFeed/index.js +++ b/src/components/MainFeed/index.js @@ -77,11 +77,13 @@ class MainFeed extends React.Component { this.setState({ invalid: true }) return } - const parsed = JSON.parse(res)['data'] - - const isEnd = - parsed.length < ycore.AppSettings.limit_post_catch ? true : false - this.setState({ isEnd: isEnd, data: parsed, loading: false }) + try { + const parsed = JSON.parse(res)['data'] + const isEnd =parsed.length < ycore.AppSettings.limit_post_catch ? true : false + this.setState({ isEnd: isEnd, data: parsed, loading: false }) + } catch (error) { + ycore.yconsole.log(error) + } }, payload) } catch (err) { ycore.notify.error('err') diff --git a/src/components/YulioID/formstyle.less b/src/components/YulioID/formstyle.less deleted file mode 100755 index b5a2fcd0..00000000 --- a/src/components/YulioID/formstyle.less +++ /dev/null @@ -1,97 +0,0 @@ -@import '~themes/vars.less'; - - -.inputform { - :global { - input { - height: 50px; - font-size: 16px; - border: 2px solid #d1d3d4; - width: 100%; - padding: 12px; - font-family: "Poppins"; - border-radius: 6px; - color: black - } - - input:focus { - outline: none; - border-color: black; - } - } -} - -.check { - animation-delay: 0s; -} - -.checkmark { - opacity: 0; -} - -.Oval { - opacity: 1; - transform-origin: 30px 30px; - stroke-dasharray: 200px; - transform: rotate(-75deg); - animation: 3s spin infinite; - stroke-dashoffset: 200; - /* animation-play-state: paused; */ -} - -.animateCheck { - animation: 0.5s check_animation linear forwards; -} - -.animateOvaloop { - animation: 3s spin infinite; -} - -@keyframes spin { - 0% { - opacity: 1; - stroke-dasharray: 360; - stroke-dashoffset: 360; - transform: rotate(-720deg); - - } - - 50% { - opacity: 1; - stroke-dasharray: 360; - stroke-dashoffset: 260; - transform: rotate(360deg); - } - - 100% { - opacity: 1; - stroke-dasharray: 360; - stroke-dashoffset: 360; - transform: rotate(720deg); - } -} - -@keyframes circle_animation { - 60% { - opacity: 1; - } - - 100% { - opacity: 1; - stroke-dasharray: 400px; - transform: rotate(40deg); - } -} - -@keyframes check_animation { - 0% { - stroke-dasharray: 126; - stroke-dashoffset: 126; - - } - - 100% { - stroke-dasharray: 45; - stroke-dashoffset: 94 - } -} diff --git a/src/components/YulioID/index.js b/src/components/YulioID/index.js index 7ba6c3f3..65b81ed5 100755 --- a/src/components/YulioID/index.js +++ b/src/components/YulioID/index.js @@ -4,6 +4,7 @@ import { Form, Icon as LegacyIcon } from '@ant-design/compatible' import { Button, Input, Drawer } from 'antd' import * as ycore from 'ycore' +import * as Icons from '@ant-design/icons' import styles from './index.less' @@ -19,6 +20,7 @@ class YulioID extends Component { MainLoginVisible: true, ShowLoading: false, Answered: false, + transition: false, } } // Handlers & others @@ -62,11 +64,13 @@ class YulioID extends Component { handleResponse = response => { if (response == '200') { + ycore.LoginPage.transitionToogle() this.setState({ StateIcon: 'login', StateMessage: 'Wait a sec...', StateException: false, }) + } if (response == '400') { this.setState({ @@ -139,10 +143,6 @@ class YulioID extends Component {
{StateMessage}
- {StateException ? (
diff --git a/src/components/index.js b/src/components/index.js index 2bf8c1d7..7583c7a5 100755 --- a/src/components/index.js +++ b/src/components/index.js @@ -5,6 +5,7 @@ import MobileWarning from './MobileWarning' import CustomIcons from './CustomIcons' import Loader from './Loader/Loader.js' import ScrollBar from './ScrollBar' +import App_about from './App_about' // App Layout Components import * as MyLayout from './Layout/index.js' @@ -26,6 +27,7 @@ import PostCreator from './PostCreator' // Mix & Export all export { + App_about, MediaPlayer, UserBadges, MobileWarning, diff --git a/src/pages/__m/index.js b/src/pages/__m/index.js index 0eb62da5..c161e772 100755 --- a/src/pages/__m/index.js +++ b/src/pages/__m/index.js @@ -92,7 +92,7 @@ export default class __m extends React.Component {

Server UID

- {ycore.yConfig.server_key} + {ycore.__server.getKey()}

diff --git a/src/pages/about/index.js b/src/pages/about/index.js index 047b0ef6..928dcb1b 100755 --- a/src/pages/about/index.js +++ b/src/pages/about/index.js @@ -1,20 +1,9 @@ import React from 'react' -import styles from './index.less' -import * as ycore from 'ycore' -import * as antd from 'antd' +import { App_about } from 'components' class AppAbout extends React.Component { render() { - return ( -
- - -

{ycore.AppInfo.name}

- v{ycore.AppInfo.version} - {ycore.DetectNoNStableBuild('TagComponent')} -
-
- ) + return } } export default AppAbout diff --git a/src/pages/login/index.js b/src/pages/login/index.js index 277842d2..dc5c6185 100755 --- a/src/pages/login/index.js +++ b/src/pages/login/index.js @@ -1,14 +1,23 @@ import React, { Component } from 'react' -import * as antd from 'antd' -import * as ycore from 'ycore' +import { AppInfo } from 'ycore' import { YulioID } from 'components' import styles from './index.less' +import classnames from 'classnames' + +export function transitionToogle() { + window.LoginComponent.setState({ + transition: !window.LoginComponent.state.transition + }) + window.LoginComponent.toogleYulioID() +} class Login extends Component { constructor(props) { super(props) + window.LoginComponent = this this.state = { showYulioID: true, + transition: false } } toogleYulioID() { @@ -17,22 +26,58 @@ class Login extends Component { render() { return ( -
- -
-
- {' '} +
+ + + + + + + + + + + + + + + +
+
+ +
+
+

{`v${AppInfo.version} ${AppInfo.stage}`}

+
+
-
-

{`v${ycore.AppInfo.version}`}

- {ycore.DetectNoNStableBuild('TagComponent')} -
- -
) } } diff --git a/src/pages/login/index.less b/src/pages/login/index.less index 56761ee2..1a60a254 100755 --- a/src/pages/login/index.less +++ b/src/pages/login/index.less @@ -1,5 +1,20 @@ @import '~themes/vars.less'; + +.login_wrapper{ + overflow: hidden; + position: absolute; + left: 0; + top: 0; + bottom: 0; + width: 100vw; + height: 100vh; + &.goOut{ + clip:rect(); + animation: go-out 1.5s linear; + } +} + /* Animation */ .parallax>use { @@ -36,7 +51,18 @@ } } +@keyframes go-out { + 0% { + filter: blur(0px) + } + + 100% { + filter: blur(15px) + } +} + .backgroud { + background-color: #2d2d2d; position: absolute; height: 100%; width: 100%; diff --git a/src/pages/settings/components/about.js b/src/pages/settings/components/about.js index 82008ecb..34a9abff 100755 --- a/src/pages/settings/components/about.js +++ b/src/pages/settings/components/about.js @@ -1,20 +1,9 @@ import React from 'react' -import styles from './about.less' -import * as ycore from 'ycore' -import * as antd from 'antd' +import { App_about } from 'components' -class AppAbout extends React.Component { +export default class AppAbout extends React.Component { render() { - return ( -
- - -

{ycore.AppInfo.name}

- v{ycore.AppInfo.version} - {ycore.DetectNoNStableBuild('TagComponent')} -
-
- ) + return } } -export default AppAbout + diff --git a/src/pages/settings/components/earnings.js b/src/pages/settings/components/earnings/index.js old mode 100755 new mode 100644 similarity index 100% rename from src/pages/settings/components/earnings.js rename to src/pages/settings/components/earnings/index.js diff --git a/src/pages/settings/components/notification.js b/src/pages/settings/components/notification/index.js old mode 100755 new mode 100644 similarity index 68% rename from src/pages/settings/components/notification.js rename to src/pages/settings/components/notification/index.js index 576b73a1..3edd9135 --- a/src/pages/settings/components/notification.js +++ b/src/pages/settings/components/notification/index.js @@ -1,9 +1,9 @@ import React from 'react' import * as ycore from 'ycore' import * as Icons from '@ant-design/icons' -import styles from './notification.less' +import styles from './index.less' -class NotificationView extends React.Component { +export default class NotificationView extends React.Component { render() { return (
@@ -15,4 +15,3 @@ class NotificationView extends React.Component { } } -export default NotificationView diff --git a/src/pages/settings/components/notification.less b/src/pages/settings/components/notification/index.less old mode 100755 new mode 100644 similarity index 100% rename from src/pages/settings/components/notification.less rename to src/pages/settings/components/notification/index.less diff --git a/src/pages/settings/components/security.js b/src/pages/settings/components/security.js deleted file mode 100755 index dae6f595..00000000 --- a/src/pages/settings/components/security.js +++ /dev/null @@ -1,18 +0,0 @@ -import React from 'react' -import * as ycore from 'ycore' -import * as Icons from '@ant-design/icons' -import styles from './security.less' - -class SecurityView extends React.Component { - render() { - return ( -
-

- Your Security & Privacy -

-
- ) - } -} - -export default SecurityView diff --git a/src/pages/settings/components/security/index.js b/src/pages/settings/components/security/index.js new file mode 100644 index 00000000..496a31a2 --- /dev/null +++ b/src/pages/settings/components/security/index.js @@ -0,0 +1,65 @@ +import React from 'react' +import * as ycore from 'ycore' +import * as Icons from '@ant-design/icons' +import * as antd from 'antd' +import styles from './index.less' + +import Sessions_Manager from './sessions.js' + +const { Menu } = antd +export default class SecurityView extends React.Component { + state = { + current: 'privacy', + } + + handleClick = e => { + this.setState({ + current: e.key, + }) + } + + renderChildren = () => { + const { current } = this.state + switch (current) { + case 'privacy': + return null + case 'credentials': + return null + case 'sessions': + return + default: + break + } + return null + } + + render() { + return ( +
+

+ Your Security & Privacy + + + + Privacy + + + + Credentials + + + + Sessions + + +
{this.renderChildren()}
+

+
+ ) + } +} + diff --git a/src/pages/settings/components/security.less b/src/pages/settings/components/security/index.less old mode 100755 new mode 100644 similarity index 100% rename from src/pages/settings/components/security.less rename to src/pages/settings/components/security/index.less diff --git a/src/pages/settings/components/security/sessions.js b/src/pages/settings/components/security/sessions.js new file mode 100644 index 00000000..76a5469a --- /dev/null +++ b/src/pages/settings/components/security/sessions.js @@ -0,0 +1,39 @@ +import React from 'react' +import * as ycore from 'ycore' +import * as antd from 'antd' + +export default class Sessions_Manager extends React.Component { + state = { + sessions_data: '', + } + componentDidMount() { + ycore.get_app_session.get_id((err, res) => { + this.setState({ sid: res }) + }) + ycore.comty_get.sessions((err, res) => { + const a = JSON.parse(res)['data'] + this.setState({ sessions_data: a }) + }) + } + render() { + return ( +
+ ( + + +

Session #{item.id}

+ {this.state.sid == item.session_id ? 'This Session' : null} +
+

{item.platform}

+

{item.ip_address}

+

{item.time}

+
+
+ )} + /> +
+ ) + } +} diff --git a/src/pages/settings/index.js b/src/pages/settings/index.js index 6c8dce43..942eba71 100755 --- a/src/pages/settings/index.js +++ b/src/pages/settings/index.js @@ -1,16 +1,14 @@ import React from 'react' -import { GridContent } from '@ant-design/pro-layout' -import { Menu, Typography } from 'antd' -import * as antd from 'antd' -import * as ycore from 'ycore' +import { Menu } from 'antd' import * as Icons from '@ant-design/icons' import styles from './style.less' -import NotificationView from './components/notification.js' -import SecurityView from './components/security.js' +import NotificationView from './components/notification/index.js' +import SecurityView from './components/security/index.js' +import Earnings from './components/earnings/index.js' + import Base from './components/base.js' import AppAbout from './components/about.js' -import Earnings from './components/earnings.js' const { Item } = Menu const menuMap = {