mirror of
https://github.com/ragestudio/comty.git
synced 2025-06-09 10:34:17 +00:00
config cleanup
This commit is contained in:
parent
239e7eca68
commit
028448cc32
@ -14,7 +14,13 @@ module.exports = {
|
|||||||
endpoint_v3prefix: 'ycorejs_apiv3',
|
endpoint_v3prefix: 'ycorejs_apiv3',
|
||||||
endpoint_websocket: 'eu_es01.ragestudio.net',
|
endpoint_websocket: 'eu_es01.ragestudio.net',
|
||||||
|
|
||||||
storage_appSettings: 'app_settings',
|
storage: {
|
||||||
|
theme: "app_theme",
|
||||||
|
settings: "app_settings",
|
||||||
|
token: "cid",
|
||||||
|
data: "data"
|
||||||
|
},
|
||||||
|
|
||||||
storage_authFrame: 'cid',
|
storage_authFrame: 'cid',
|
||||||
storage_dataFrame: 'data',
|
storage_dataFrame: 'data',
|
||||||
storage_theme: 'app_theme',
|
storage_theme: 'app_theme',
|
||||||
@ -43,17 +49,14 @@ module.exports = {
|
|||||||
{
|
{
|
||||||
name: 'public',
|
name: 'public',
|
||||||
include: [/.*/]
|
include: [/.*/]
|
||||||
},
|
}
|
||||||
{
|
|
||||||
name: 'splash',
|
|
||||||
include: [/\/splash/]
|
|
||||||
},
|
|
||||||
],
|
],
|
||||||
|
|
||||||
// Default Behaviors
|
// Default Behaviors
|
||||||
defaults: {
|
defaults: {
|
||||||
app_model: "app",
|
app_model: "app",
|
||||||
verbosity: false,
|
verbosity: false,
|
||||||
|
sidebarCollaped: false,
|
||||||
session_noexpire: false,
|
session_noexpire: false,
|
||||||
search_ontype: false,
|
search_ontype: false,
|
||||||
post_autoposition: true,
|
post_autoposition: true,
|
||||||
@ -76,5 +79,4 @@ module.exports = {
|
|||||||
api_maxpayload: '101376',
|
api_maxpayload: '101376',
|
||||||
api_maxovertick: 10,
|
api_maxovertick: 10,
|
||||||
}
|
}
|
||||||
|
}
|
||||||
};
|
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
import React from 'react'
|
import React from 'react'
|
||||||
import { app } from 'config'
|
import config from 'config'
|
||||||
import { router } from 'core/libs'
|
import { router } from 'core/libs'
|
||||||
import { connect } from 'umi'
|
import { connect } from 'umi'
|
||||||
import MenuList from 'schemas/sidebar_menu.json'
|
import MenuList from 'schemas/sidebar_menu.json'
|
||||||
@ -72,7 +72,7 @@ class Sider extends React.Component {
|
|||||||
}
|
}
|
||||||
|
|
||||||
renderByType(type) {
|
renderByType(type) {
|
||||||
const sider_props = { handleClickMenu: this.handleClickMenu, logo: app.LogoPath }
|
const sider_props = { handleClickMenu: this.handleClickMenu, logo: config.app.LogoPath }
|
||||||
const filteredMenus = this.filterMenusByType(type)
|
const filteredMenus = this.filterMenusByType(type)
|
||||||
switch (type) {
|
switch (type) {
|
||||||
case "desktop": {
|
case "desktop": {
|
||||||
|
@ -1,7 +1,8 @@
|
|||||||
import React from 'react';
|
import React from 'react';
|
||||||
import * as antd from 'antd'
|
import * as antd from 'antd'
|
||||||
import { RefreshCw } from 'components/Icons'
|
import { RefreshCw } from 'components/Icons'
|
||||||
import { objectToArrayMap, getCircularReplacer, decycle } from 'core'
|
import { objectToArrayMap } from '@nodecorejs/utils'
|
||||||
|
import { getCircularReplacer, decycle } from 'core'
|
||||||
|
|
||||||
const serializeFlags = {
|
const serializeFlags = {
|
||||||
__cycle_flag: true // with id 0
|
__cycle_flag: true // with id 0
|
||||||
|
@ -4,7 +4,7 @@ import { imageToBase64 } from 'core'
|
|||||||
import * as Icons from 'components/Icons'
|
import * as Icons from 'components/Icons'
|
||||||
import styles from './index.less'
|
import styles from './index.less'
|
||||||
import { connect } from 'umi'
|
import { connect } from 'umi'
|
||||||
import { stricts } from 'config'
|
import config from 'config'
|
||||||
import { settings, newSetting } from 'core/libs/settings'
|
import { settings, newSetting } from 'core/libs/settings'
|
||||||
|
|
||||||
const PrivacyList = [
|
const PrivacyList = [
|
||||||
@ -43,13 +43,13 @@ const PrivacyList = [
|
|||||||
@connect(({ app }) => ({ app }))
|
@connect(({ app }) => ({ app }))
|
||||||
class PostCreator extends React.PureComponent {
|
class PostCreator extends React.PureComponent {
|
||||||
state = {
|
state = {
|
||||||
maxFileSize: stricts.api_maxpayload,
|
maxFileSize: config.stricts.api_maxpayload,
|
||||||
maxTextLenght: stricts.post_maxlenght,
|
maxTextLenght: config.stricts.post_maxlenght,
|
||||||
|
|
||||||
renderValid: false,
|
renderValid: false,
|
||||||
loading: false,
|
loading: false,
|
||||||
|
|
||||||
textLenght: stricts.post_maxlenght,
|
textLenght: config.stricts.post_maxlenght,
|
||||||
rawText: '',
|
rawText: '',
|
||||||
posting: false,
|
posting: false,
|
||||||
postingResult: false,
|
postingResult: false,
|
||||||
|
@ -2,7 +2,7 @@ import moment from 'moment';
|
|||||||
import { format } from 'timeago.js';
|
import { format } from 'timeago.js';
|
||||||
import { cloneDeep } from 'lodash';
|
import { cloneDeep } from 'lodash';
|
||||||
import store from 'store';
|
import store from 'store';
|
||||||
import { i18n, app } from 'config';
|
import config from 'config';
|
||||||
import handle from 'core/libs/errorhandler'
|
import handle from 'core/libs/errorhandler'
|
||||||
import request from 'request'
|
import request from 'request'
|
||||||
import html2canvas from 'html2canvas'
|
import html2canvas from 'html2canvas'
|
||||||
@ -13,29 +13,28 @@ import * as utils from '@nodecorejs/utils'
|
|||||||
|
|
||||||
const { pathToRegexp } = require('path-to-regexp');
|
const { pathToRegexp } = require('path-to-regexp');
|
||||||
|
|
||||||
export const languages = i18n ? i18n.languages.map(item => item.key) : [];
|
export const languages = config.i18n ? config.i18n.languages.map(item => item.key) : [];
|
||||||
export const defaultLanguage = i18n ? i18n.defaultLanguage : '';
|
export const defaultLanguage = config.i18n ? config.i18n.defaultLanguage : '';
|
||||||
|
|
||||||
import * as libs from './libs'
|
import * as libs from './libs'
|
||||||
|
|
||||||
export * from '@nodecorejs/utils'
|
|
||||||
export const package_json = require('../../package.json');
|
export const package_json = require('../../package.json');
|
||||||
export const GUID = app.guid;
|
export const GUID = config.app.guid;
|
||||||
|
|
||||||
export const clientInfo = {
|
export const clientInfo = {
|
||||||
buildStable: getBuild()["stable"],
|
buildStable: getBuild()["stable"],
|
||||||
packageName: package_json.name,
|
packageName: package_json.name,
|
||||||
packageStage: package_json.stage,
|
packageStage: package_json.stage,
|
||||||
siteName: app.siteName,
|
siteName: config.app.siteName,
|
||||||
version: package_json.version,
|
version: package_json.version,
|
||||||
logo: app.FullLogoPath,
|
logo: config.app.FullLogoPath,
|
||||||
logo_dark: app.DarkFullLogoPath,
|
logo_dark: config.app.DarkFullLogoPath,
|
||||||
os: platform.os,
|
os: platform.os,
|
||||||
layout: platform.layout
|
layout: platform.layout
|
||||||
};
|
}
|
||||||
|
|
||||||
export function getCircularReplacer() {
|
export function getCircularReplacer() {
|
||||||
const seen = new WeakSet();
|
const seen = new WeakSet()
|
||||||
return (key, value) => {
|
return (key, value) => {
|
||||||
if (typeof value === "object" && value !== null) {
|
if (typeof value === "object" && value !== null) {
|
||||||
if (seen.has(value)) {
|
if (seen.has(value)) {
|
||||||
@ -250,16 +249,13 @@ export function b64toBlob(b64Data, contentType = '', sliceSize = 512) {
|
|||||||
* @param {object} payload - Generation Data
|
* @param {object} payload - Generation Data
|
||||||
*/
|
*/
|
||||||
export function downloadDecodedURI(payload) {
|
export function downloadDecodedURI(payload) {
|
||||||
|
// TODO: Support encoded
|
||||||
if (!payload) return false
|
if (!payload) return false
|
||||||
let { data, type, charset, filename } = payload
|
let { data, type, charset, filename } = payload
|
||||||
/**
|
|
||||||
*
|
|
||||||
* @param {object} payload - Generation Data
|
|
||||||
*/
|
|
||||||
if (!data || !type) return false
|
if (!data || !type) return false
|
||||||
try {
|
try {
|
||||||
if (!filename) {
|
if (!filename) {
|
||||||
filename = `${app.id}_${time.now()}.${type.split("/")[1]}`
|
filename = `${"download"}_${time.now()}.${type.split("/")[1]}` // TODO: Add package name to title generation
|
||||||
}
|
}
|
||||||
let tmp = document.createElement('a')
|
let tmp = document.createElement('a')
|
||||||
tmp.href = `data:${type};charset=${charset},${encodeURIComponent(data)}`
|
tmp.href = `data:${type};charset=${charset},${encodeURIComponent(data)}`
|
||||||
@ -270,27 +266,6 @@ export function downloadDecodedURI(payload) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export function downloadEncodedURI(payload) {
|
|
||||||
if (!payload) return false
|
|
||||||
let { data, filename } = payload
|
|
||||||
/**
|
|
||||||
*
|
|
||||||
* @param {object} payload - Generation Data
|
|
||||||
*/
|
|
||||||
if (!data) return false
|
|
||||||
try {
|
|
||||||
if (!filename) {
|
|
||||||
filename = `${app.id}_${time.now()}.${data.split("/")[1].split(";")[0]}`
|
|
||||||
}
|
|
||||||
let tmp = document.createElement('a')
|
|
||||||
tmp.href = data
|
|
||||||
tmp.download = filename
|
|
||||||
tmp.click()
|
|
||||||
} catch (error) {
|
|
||||||
handle({ msg: error, code: 120 })
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
export function GetPropertyValue(object, dataToRetrieve) {
|
export function GetPropertyValue(object, dataToRetrieve) {
|
||||||
dataToRetrieve.split('.').forEach(function (token) {
|
dataToRetrieve.split('.').forEach(function (token) {
|
||||||
if (object) object = object[token];
|
if (object) object = object[token];
|
||||||
|
@ -1,23 +0,0 @@
|
|||||||
import { verbosity } from '@nodecorejs/utils'
|
|
||||||
import handle from 'core/libs/errorhandler'
|
|
||||||
import { notify } from 'core/libs/ui'
|
|
||||||
import settings from 'core/libs/settings'
|
|
||||||
import endpoints from 'config/endpoints'
|
|
||||||
import { v3_model } from 'core/libs'
|
|
||||||
|
|
||||||
import { getRuntime } from '@nodecore/dot-runtime'
|
|
||||||
|
|
||||||
export function NewFunction(payload, callback){
|
|
||||||
if (!payload) return false
|
|
||||||
const { data } = payload
|
|
||||||
|
|
||||||
return callback(false, null)
|
|
||||||
}
|
|
||||||
|
|
||||||
export const ObjectFunction = {
|
|
||||||
something: (payload, callback) => {
|
|
||||||
return callback(false, null)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
export default NewFunction
|
|
@ -1,2 +0,0 @@
|
|||||||
import { defaults, app } from 'config'
|
|
||||||
import { get_value } from 'core'
|
|
@ -1,7 +1,7 @@
|
|||||||
import { defaults, app } from 'config'
|
import config from 'config'
|
||||||
|
|
||||||
export function parseLocalStorage(){
|
export function parseLocalStorage() {
|
||||||
const fromStorage = localStorage.getItem(app.storage_appSettings)
|
const fromStorage = localStorage.getItem(config.app.storage.settings)
|
||||||
try {
|
try {
|
||||||
return JSON.parse(fromStorage)
|
return JSON.parse(fromStorage)
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
@ -20,36 +20,36 @@ export const settings = {
|
|||||||
get: (key) => {
|
get: (key) => {
|
||||||
let tmp = [];
|
let tmp = [];
|
||||||
|
|
||||||
const keys = Object.keys(defaults)
|
const keys = Object.keys(config.defaults)
|
||||||
const values = Object.values(defaults)
|
const values = Object.values(config.defaults)
|
||||||
const length = keys.length
|
const length = keys.length
|
||||||
|
|
||||||
for (let i = 0; i < length; i++) {
|
for (let i = 0; i < length; i++) {
|
||||||
if(parseLocalStorage()){
|
if (parseLocalStorage()) {
|
||||||
const storagedValue = parseLocalStorage().find(item => {
|
const storagedValue = parseLocalStorage().find(item => {
|
||||||
return item.id === keys[i]
|
return item.id === keys[i]
|
||||||
})
|
})
|
||||||
if (typeof(storagedValue) == 'undefined') {
|
if (typeof (storagedValue) == 'undefined') {
|
||||||
tmp[keys[i]] = values[i]
|
tmp[keys[i]] = values[i]
|
||||||
}else{
|
} else {
|
||||||
tmp[keys[i]] = storagedValue.value
|
tmp[keys[i]] = storagedValue.value
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else{
|
else {
|
||||||
tmp[keys[i]] = values[i]
|
tmp[keys[i]] = values[i]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (key) {
|
if (key) {
|
||||||
return tmp[key]
|
return tmp[key]
|
||||||
}
|
}
|
||||||
|
|
||||||
return tmp
|
return tmp
|
||||||
},
|
},
|
||||||
set: (key, value) => {
|
set: (key, value) => {
|
||||||
let tmp
|
let tmp
|
||||||
let data = parseLocalStorage()
|
let data = parseLocalStorage()
|
||||||
|
|
||||||
if (data) {
|
if (data) {
|
||||||
const finded = data.find(element => {
|
const finded = data.find(element => {
|
||||||
return element.id === key
|
return element.id === key
|
||||||
@ -59,21 +59,21 @@ export const settings = {
|
|||||||
tmp = parsed
|
tmp = parsed
|
||||||
} else {
|
} else {
|
||||||
const updated = data.map(element => {
|
const updated = data.map(element => {
|
||||||
return element.id === key? Object.assign(element, { value: value }) : element
|
return element.id === key ? Object.assign(element, { value: value }) : element
|
||||||
})
|
})
|
||||||
tmp = updated
|
tmp = updated
|
||||||
}
|
}
|
||||||
}else{
|
} else {
|
||||||
tmp = newSetting(key, value)
|
tmp = newSetting(key, value)
|
||||||
}
|
}
|
||||||
data = tmp
|
data = tmp
|
||||||
try {
|
try {
|
||||||
localStorage.setItem( app.storage_appSettings, JSON.stringify(data) )
|
localStorage.setItem(config.app.storage.settings, JSON.stringify(data))
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.log(error)
|
console.log(error)
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export default (e) => settings.get(e)
|
export default (e) => settings.get(e)
|
@ -1,9 +1,9 @@
|
|||||||
import store from 'store';
|
import store from 'store';
|
||||||
import { app } from 'config';
|
import config from 'config';
|
||||||
import { verbosity } from '@nodecorejs/utils'
|
import { verbosity } from '@nodecorejs/utils'
|
||||||
import ErrorHandler from 'core/libs/errorhandler'
|
import ErrorHandler from 'core/libs/errorhandler'
|
||||||
|
|
||||||
const { appTheme_desiredContrast, storage_theme } = app
|
const { appTheme_desiredContrast, storage_theme } = config.app
|
||||||
|
|
||||||
export const updateRootStyles = (styles) => {
|
export const updateRootStyles = (styles) => {
|
||||||
const rootContainer = document.getElementById(runtime.mountElementId ?? "root")
|
const rootContainer = document.getElementById(runtime.mountElementId ?? "root")
|
||||||
|
@ -1,8 +1,8 @@
|
|||||||
import v3_request from 'api/lib/v3_request'
|
import v3_request from 'api/lib/v3_request'
|
||||||
import endpointList from 'config/endpoints'
|
import endpointList from 'config/endpoints'
|
||||||
import { app } from 'config'
|
import config from 'config'
|
||||||
|
|
||||||
const { endpoint_v3prefix } = app;
|
const { endpoint_v3prefix } = config.app;
|
||||||
|
|
||||||
export async function api_request(payload, callback) {
|
export async function api_request(payload, callback) {
|
||||||
if (!payload) return false;
|
if (!payload) return false;
|
||||||
|
@ -1,4 +1,3 @@
|
|||||||
import * as user from './user'
|
|
||||||
import * as session from './session'
|
import * as session from './session'
|
||||||
|
|
||||||
export { user, session }
|
export { session }
|
@ -1,94 +0,0 @@
|
|||||||
import endpoints from 'config/endpoints';
|
|
||||||
import { v3_model } from 'core/libs';
|
|
||||||
|
|
||||||
const set = {
|
|
||||||
data: () => {
|
|
||||||
// TODO
|
|
||||||
},
|
|
||||||
};
|
|
||||||
|
|
||||||
export const get = {
|
|
||||||
data: (parms, callback) => {
|
|
||||||
if (!parms) return false;
|
|
||||||
const { user_id, access_token, serverKey, fetch } = parms;
|
|
||||||
|
|
||||||
let req = {
|
|
||||||
fetch: fetch? fetch : 'user_data'
|
|
||||||
}
|
|
||||||
|
|
||||||
v3_model.api_request(
|
|
||||||
{
|
|
||||||
body: {user_id: user_id, fetch: req.fetch},
|
|
||||||
serverKey: serverKey,
|
|
||||||
userToken: access_token,
|
|
||||||
endpoint: endpoints.get_data
|
|
||||||
|
|
||||||
},
|
|
||||||
(err, res) => {
|
|
||||||
return callback(err, res)
|
|
||||||
},
|
|
||||||
);
|
|
||||||
},
|
|
||||||
basicData: (parms, callback) => {
|
|
||||||
if (!parms) return false
|
|
||||||
|
|
||||||
const { username } = parms
|
|
||||||
|
|
||||||
if (username) {
|
|
||||||
v3_model.api_request(
|
|
||||||
{
|
|
||||||
body: { username },
|
|
||||||
endpoint: endpoints.basicData
|
|
||||||
},
|
|
||||||
(err, res) => {
|
|
||||||
err? console.error(err) : null
|
|
||||||
return callback(false, res);
|
|
||||||
},
|
|
||||||
);
|
|
||||||
|
|
||||||
} else {
|
|
||||||
const res = { status: 105, message: 'Invalid Username!' };
|
|
||||||
return callback(res, false);
|
|
||||||
}
|
|
||||||
},
|
|
||||||
profileData: (parms, callback) => {
|
|
||||||
if (!parms) return false
|
|
||||||
|
|
||||||
const { username, server_key, access_token } = parms
|
|
||||||
|
|
||||||
if (username) {
|
|
||||||
v3_model.api_request(
|
|
||||||
{
|
|
||||||
body: { username, fetch: "user_data" },
|
|
||||||
endpoint: endpoints.profileData,
|
|
||||||
userToken: access_token,
|
|
||||||
serverKey: server_key
|
|
||||||
},
|
|
||||||
(err, res) => {
|
|
||||||
err? console.error(err) : null
|
|
||||||
return callback(false, res);
|
|
||||||
},
|
|
||||||
);
|
|
||||||
|
|
||||||
} else {
|
|
||||||
const res = { status: 105, message: 'Invalid Username!' };
|
|
||||||
return callback(res, false);
|
|
||||||
}
|
|
||||||
},
|
|
||||||
};
|
|
||||||
|
|
||||||
export const actions = {
|
|
||||||
block: parms => {
|
|
||||||
if (!parms) return false;
|
|
||||||
const { id, toID } = parms;
|
|
||||||
},
|
|
||||||
find: parms => {
|
|
||||||
if (!parms) return false;
|
|
||||||
const { id, username, email } = parms;
|
|
||||||
},
|
|
||||||
follow: parms => {
|
|
||||||
if (!parms) return false;
|
|
||||||
const { id, toID } = parms;
|
|
||||||
},
|
|
||||||
};
|
|
||||||
|
|
@ -1,18 +1,15 @@
|
|||||||
import React from 'react'
|
import React from 'react'
|
||||||
import { withRouter, connect } from 'umi'
|
import { withRouter, connect } from 'umi'
|
||||||
import {
|
import { AppLayout } from 'components'
|
||||||
AppLayout
|
|
||||||
} from 'components'
|
|
||||||
import { enquireScreen, unenquireScreen } from 'enquire-js'
|
import { enquireScreen, unenquireScreen } from 'enquire-js'
|
||||||
import store from 'store'
|
import store from 'store'
|
||||||
import classnames from 'classnames'
|
import classnames from 'classnames'
|
||||||
|
|
||||||
import { app } from 'config'
|
import config from 'config'
|
||||||
import { theme } from 'core/libs/style'
|
import { theme } from 'core/libs/style'
|
||||||
import * as antd from 'antd'
|
import * as antd from 'antd'
|
||||||
import contextMenuList from 'schemas/contextMenu'
|
import contextMenuList from 'schemas/contextMenu'
|
||||||
|
|
||||||
|
|
||||||
const { Content } = antd.Layout
|
const { Content } = antd.Layout
|
||||||
const { Sider, Overlay, RightSider } = AppLayout
|
const { Sider, Overlay, RightSider } = AppLayout
|
||||||
const isActive = (key) => { return key ? key.active : false }
|
const isActive = (key) => { return key ? key.active : false }
|
||||||
@ -23,7 +20,7 @@ export default class PrimaryLayout extends React.Component {
|
|||||||
constructor(props) {
|
constructor(props) {
|
||||||
super(props)
|
super(props)
|
||||||
this.state = {
|
this.state = {
|
||||||
collapsed: app.default_collapse_sider ? true : false,
|
collapsed: config.defaults.sidebarCollaped ? true : false,
|
||||||
isMobile: false
|
isMobile: false
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -80,10 +77,10 @@ export default class PrimaryLayout extends React.Component {
|
|||||||
const { isMobile } = this.state
|
const { isMobile } = this.state
|
||||||
if (isMobile !== mobile) {
|
if (isMobile !== mobile) {
|
||||||
window.isMobile = mobile
|
window.isMobile = mobile
|
||||||
this.setState({isMobile: mobile})
|
this.setState({ isMobile: mobile })
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
componentWillUnmount() {
|
componentWillUnmount() {
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
import store from 'store'
|
import store from 'store'
|
||||||
import config from 'config'
|
import config from 'config'
|
||||||
import keys from 'config/app_keys'
|
import keys from 'config/keys'
|
||||||
import { session } from 'core/models'
|
import { session } from 'core/models'
|
||||||
import { verbosity } from '@nodecorejs/utils'
|
import { verbosity } from '@nodecorejs/utils'
|
||||||
import settings from 'core/libs/settings'
|
import settings from 'core/libs/settings'
|
||||||
@ -38,8 +38,8 @@ export default {
|
|||||||
dispatcher: null,
|
dispatcher: null,
|
||||||
|
|
||||||
electron: null,
|
electron: null,
|
||||||
app_settings: store.get(config.app.storage_appSettings) || [],
|
app_settings: store.get(config.app.storage.settings) || [],
|
||||||
app_theme: store.get(config.app.storage_theme) || [],
|
app_theme: store.get(config.app.storage.theme) || [],
|
||||||
notifications: [],
|
notifications: [],
|
||||||
},
|
},
|
||||||
subscriptions: {
|
subscriptions: {
|
||||||
|
@ -1,6 +1,5 @@
|
|||||||
import { app } from 'config'
|
import config from 'config'
|
||||||
import { verbosity } from '@nodecorejs/utils'
|
import { verbosity, objectToArrayMap } from '@nodecorejs/utils'
|
||||||
import { objectToArrayMap } from 'core'
|
|
||||||
|
|
||||||
import SocketConnection from 'core/libs/socket/index.ts'
|
import SocketConnection from 'core/libs/socket/index.ts'
|
||||||
|
|
||||||
@ -8,7 +7,7 @@ export default {
|
|||||||
namespace: 'socket',
|
namespace: 'socket',
|
||||||
state: {
|
state: {
|
||||||
nodes: {},
|
nodes: {},
|
||||||
socket_address: app.endpoint_websocket, //set by default
|
socket_address: config.app.endpoint_websocket, //set by default
|
||||||
socket_port: "7000",
|
socket_port: "7000",
|
||||||
headerNode: "/"
|
headerNode: "/"
|
||||||
},
|
},
|
||||||
|
@ -1,18 +1,16 @@
|
|||||||
import React from 'react'
|
import React from 'react'
|
||||||
import { pathMatchRegexp, booleanFix, objectToArrayMap } from 'core'
|
|
||||||
import HandleError from 'core/libs/errorhandler'
|
|
||||||
import { Invalid } from 'components'
|
|
||||||
import styles from './index.less'
|
|
||||||
import GlobalBadges from 'schemas/badges_list.json'
|
|
||||||
import * as Icons from 'components/Icons'
|
|
||||||
|
|
||||||
import FollowButton from './components/follow'
|
|
||||||
import Menu from './components/menu'
|
|
||||||
import { PostsFeed } from 'components'
|
|
||||||
|
|
||||||
import * as antd from 'antd'
|
import * as antd from 'antd'
|
||||||
|
import { verbosity, objectToArrayMap } from '@nodecorejs/utils'
|
||||||
|
import * as Icons from 'components/Icons'
|
||||||
import { connect } from 'umi'
|
import { connect } from 'umi'
|
||||||
import { verbosity } from '@nodecorejs/utils'
|
|
||||||
|
import { pathMatchRegexp, booleanFix } from 'core'
|
||||||
|
import HandleError from 'core/libs/errorhandler'
|
||||||
|
import GlobalBadges from 'schemas/badges_list.json'
|
||||||
|
import { Invalid, PostsFeed} from 'components'
|
||||||
|
import FollowButton from './components/follow'
|
||||||
|
|
||||||
|
import styles from './index.less'
|
||||||
|
|
||||||
export class UserLayout extends React.Component {
|
export class UserLayout extends React.Component {
|
||||||
state = {
|
state = {
|
||||||
|
@ -1,95 +1,3 @@
|
|||||||
import React from 'react'
|
export default () => {
|
||||||
import ReduxDebugger from 'debuggers/redux'
|
return <div></div>
|
||||||
import * as antd from 'antd'
|
}
|
||||||
import { connect } from 'umi'
|
|
||||||
import { ClusterOutlined } from 'components/Icons'
|
|
||||||
import { objectToArrayMap } from 'core'
|
|
||||||
|
|
||||||
@connect((store) => (store))
|
|
||||||
export default class Index extends React.Component {
|
|
||||||
handleDispatchNamespace(key) {
|
|
||||||
console.log(`Dispatching socket namespace (${key})`)
|
|
||||||
this.props.dispatch({
|
|
||||||
type: "socket/namespaceConnector",
|
|
||||||
node: this.props.socket.headerNode,
|
|
||||||
namespace: key
|
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|
||||||
render() {
|
|
||||||
const dispatch = this.props.dispatch
|
|
||||||
const headerNode = this.props.socket.nodes[this.props.socket.headerNode] ?? null
|
|
||||||
|
|
||||||
const getListenersList = (data) => {
|
|
||||||
if (typeof (data) == "undefined" && data == null) {
|
|
||||||
return null
|
|
||||||
}
|
|
||||||
return (
|
|
||||||
objectToArrayMap(data).map(e => {
|
|
||||||
return (
|
|
||||||
<div key={e.key}>
|
|
||||||
<antd.Tag>{e.key} > <antd.Tag color={e.value ? "geekblue" : "orange"} >{e.value ? "Enabled" : "Disable"}</antd.Tag></antd.Tag>
|
|
||||||
</div>
|
|
||||||
)
|
|
||||||
})
|
|
||||||
)
|
|
||||||
}
|
|
||||||
|
|
||||||
const getNamespacesMonitor = (data) => {
|
|
||||||
if (typeof (data) == "undefined" && data == null) {
|
|
||||||
return null
|
|
||||||
}
|
|
||||||
return (
|
|
||||||
objectToArrayMap(data).map(e => {
|
|
||||||
return (
|
|
||||||
<div key={e.key} style={{ display: "flex", flexDirection: "column", justifyContent: "center", margin: "0 10px", width: "100%", height: "100%" }}>
|
|
||||||
<h4>{e.value}</h4>
|
|
||||||
<antd.Button onClick={() => { this.handleDispatchNamespace(e.value) }} > connect </antd.Button>
|
|
||||||
</div>
|
|
||||||
)
|
|
||||||
})
|
|
||||||
)
|
|
||||||
}
|
|
||||||
|
|
||||||
return (
|
|
||||||
<div>
|
|
||||||
<ReduxDebugger />
|
|
||||||
|
|
||||||
<antd.Card>
|
|
||||||
<h1><ClusterOutlined style={{ marginRight: "7px" }} /> Socket </h1>
|
|
||||||
<antd.Card>
|
|
||||||
<h3> Header Node </h3>
|
|
||||||
<antd.Card>
|
|
||||||
<antd.Tag>{this.props.socket.socket_address}</antd.Tag>
|
|
||||||
<antd.Tag> {headerNode.ioConn.nsp ?? ""} </antd.Tag>
|
|
||||||
<antd.Tag color={headerNode.connectionState ?? "failed" === "connected" ? "green" : "volcano"} > {headerNode.connectionState ?? "destroyed"} </antd.Tag>
|
|
||||||
<antd.Tag color={(headerNode.latency ?? 0) > 60 ? "red" : "green"} > ~{headerNode.latency ?? "not exist"}ms </antd.Tag>
|
|
||||||
</antd.Card>
|
|
||||||
</antd.Card>
|
|
||||||
<antd.Card>
|
|
||||||
<h3> Listener manager </h3>
|
|
||||||
<antd.Card>
|
|
||||||
{getListenersList(headerNode.listeners ?? null)}
|
|
||||||
</antd.Card>
|
|
||||||
</antd.Card>
|
|
||||||
<antd.Card>
|
|
||||||
<h3> Registered Namespaces </h3>
|
|
||||||
<antd.Card>
|
|
||||||
<div style={{ display: "flex", flexDirection: "row", backgroundColor: "#fefefe", overflow: "scroll", textAlign: "center" }}>
|
|
||||||
{getNamespacesMonitor(headerNode.registeredNamespaces ?? null)}
|
|
||||||
</div>
|
|
||||||
</antd.Card>
|
|
||||||
</antd.Card>
|
|
||||||
<antd.Card>
|
|
||||||
<h3> Misc </h3>
|
|
||||||
<antd.Card>
|
|
||||||
<antd.Button onClick={() => { dispatch({ type: "socket/resetHeader" }) }} > Reset HeaderSocket </antd.Button>
|
|
||||||
<antd.Button onClick={() => { dispatch({ type: "app/refreshToken" }) }} > force refreshToken </antd.Button>
|
|
||||||
</antd.Card>
|
|
||||||
</antd.Card>
|
|
||||||
</antd.Card>
|
|
||||||
</div>
|
|
||||||
)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -12,14 +12,14 @@ import RegistrationForm from './register.js'
|
|||||||
import NormalLoginForm from './login.js'
|
import NormalLoginForm from './login.js'
|
||||||
import GuestSession from './guest.js'
|
import GuestSession from './guest.js'
|
||||||
|
|
||||||
import { app } from 'config'
|
import config from 'config'
|
||||||
import { connect } from 'umi'
|
import { connect } from 'umi'
|
||||||
|
|
||||||
const types = [
|
const types = [
|
||||||
{
|
{
|
||||||
id: "login",
|
id: "login",
|
||||||
key: 0,
|
key: 0,
|
||||||
renderText: `Sign in ${app.siteName}`
|
renderText: `Sign in ${config.app.siteName}`
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
id: "register",
|
id: "register",
|
||||||
|
@ -6,8 +6,6 @@ import HeadShake from 'react-reveal/HeadShake';
|
|||||||
|
|
||||||
import * as antd from 'antd'
|
import * as antd from 'antd'
|
||||||
|
|
||||||
import { session, user } from 'core/models'
|
|
||||||
|
|
||||||
import { Form, Input, Button, Checkbox } from 'antd'
|
import { Form, Input, Button, Checkbox } from 'antd'
|
||||||
import {
|
import {
|
||||||
UserOutlined,
|
UserOutlined,
|
||||||
|
@ -16,7 +16,7 @@ import {
|
|||||||
} from 'antd'
|
} from 'antd'
|
||||||
|
|
||||||
import ReCAPTCHA from 'react-google-recaptcha'
|
import ReCAPTCHA from 'react-google-recaptcha'
|
||||||
import { g_recaptcha_key } from 'config/app_keys'
|
import { g_recaptcha_key } from 'config/keys'
|
||||||
|
|
||||||
export default class RegistrationForm extends React.Component {
|
export default class RegistrationForm extends React.Component {
|
||||||
state = {
|
state = {
|
||||||
|
@ -3,7 +3,8 @@ import * as antd from 'antd'
|
|||||||
import * as Icons from 'components/Icons'
|
import * as Icons from 'components/Icons'
|
||||||
import styles from './index.less'
|
import styles from './index.less'
|
||||||
import { connect } from 'umi';
|
import { connect } from 'umi';
|
||||||
import { package_json, objectToArrayMap } from 'core'
|
import { package_json } from 'core'
|
||||||
|
import { objectToArrayMap } from '@nodecorejs/utils'
|
||||||
|
|
||||||
const AppTech = (info) => {
|
const AppTech = (info) => {
|
||||||
if (!info) return null
|
if (!info) return null
|
||||||
|
Loading…
x
Reference in New Issue
Block a user