mirror of
https://github.com/ragestudio/comty.git
synced 2025-06-09 18:44:16 +00:00
update: model
This commit is contained in:
parent
e4b9e0e0dc
commit
0316c55374
@ -20,13 +20,13 @@ export default defineConfig({
|
|||||||
alias: {
|
alias: {
|
||||||
antd: resolve(__dirname, './node_modules/antd'),
|
antd: resolve(__dirname, './node_modules/antd'),
|
||||||
api: resolve(__dirname, './node_modules/@ragestudio/ycorejs-lib'), // ./api
|
api: resolve(__dirname, './node_modules/@ragestudio/ycorejs-lib'), // ./api
|
||||||
|
plugins: resolve(__dirname, './plugins'),
|
||||||
globals: resolve(__dirname, './globals'),
|
globals: resolve(__dirname, './globals'),
|
||||||
core: resolve(__dirname, './src/core'),
|
core: resolve(__dirname, './src/core'),
|
||||||
theme: resolve(__dirname, './src/theme'),
|
theme: resolve(__dirname, './src/theme'),
|
||||||
config: resolve(__dirname, './config'),
|
config: resolve(__dirname, './config'),
|
||||||
components: resolve(__dirname, './src/components'),
|
components: resolve(__dirname, './src/components'),
|
||||||
models: resolve(__dirname, './src/models'),
|
models: resolve(__dirname, './src/models'),
|
||||||
routes: resolve(__dirname, './src/routes'),
|
|
||||||
node_modules: resolve(__dirname, './node_modules')
|
node_modules: resolve(__dirname, './node_modules')
|
||||||
},
|
},
|
||||||
extraBabelPlugins: [
|
extraBabelPlugins: [
|
||||||
|
@ -1,60 +0,0 @@
|
|||||||
import * as Icons from 'components/Icons'
|
|
||||||
|
|
||||||
export var BadgesType = [
|
|
||||||
{
|
|
||||||
id: 'alpha_test',
|
|
||||||
title: 'Alpha Tester',
|
|
||||||
color: 'green',
|
|
||||||
require: '',
|
|
||||||
icon: (<Icons.BugOutlined />),
|
|
||||||
tip: 'Oh yeah!'
|
|
||||||
},
|
|
||||||
{
|
|
||||||
id: 'nsfw_flag',
|
|
||||||
title: 'NSFW',
|
|
||||||
color: 'volcano',
|
|
||||||
require: 'nsfw_flag',
|
|
||||||
icon: (<Icons.RocketOutlined />),
|
|
||||||
tip: 'NSFW',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
id: 'pro',
|
|
||||||
title: 'CPRO™',
|
|
||||||
color: 'purple',
|
|
||||||
require: 'pro',
|
|
||||||
icon: (<Icons.RocketOutlined />),
|
|
||||||
tip: 'CPRO™',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
id: 'dev',
|
|
||||||
title: 'DEVELOPER',
|
|
||||||
color: 'default',
|
|
||||||
require: 'dev',
|
|
||||||
icon: (<Icons.GitBranch style={{marginRight: 'unset', verticalAlign: "-0.125em"}} />), //
|
|
||||||
tip: 'DEVELOPER',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
id: 'professional_retarder',
|
|
||||||
title: 'Professional Retarder',
|
|
||||||
color: 'gold',
|
|
||||||
require: '',
|
|
||||||
icon: (<Icons.SmileOutlined />),
|
|
||||||
tip: 'hump....',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
id: 'el_walter_pro',
|
|
||||||
title: 'Pro Chikito',
|
|
||||||
color: '#a0d911',
|
|
||||||
require: '',
|
|
||||||
icon: ("🐱🐉🧜♀️"),
|
|
||||||
tip: 'Chikito',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
id: 'patreon',
|
|
||||||
title: 'Patreon Member',
|
|
||||||
color: '',
|
|
||||||
require: '',
|
|
||||||
icon: (<Icons.Patreon />),
|
|
||||||
tip: 'Nigas',
|
|
||||||
}
|
|
||||||
]
|
|
10
globals/badges_list.json
Normal file
10
globals/badges_list.json
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
[
|
||||||
|
{"id": "alpha_test","title": "Alpha Tester","color": "green","icon": "Bug","tip": "Oh yeah!"},
|
||||||
|
{"id": "nsfw_flag","title": "NSFW","color": "volcano","require": "nsfw_flag","tip": "NSFW"},
|
||||||
|
{"id":"pro","title":"CPRO™","color":"purple","require":"pro","icon":"RocketOutlined","tip":"CPRO™"},
|
||||||
|
{"id":"dev","title":"DEVELOPER","color":"default","require":"dev","icon":"GitBranch","tip":"DEVELOPER"},
|
||||||
|
{"id":"professional_retarder","title":"Professional Retarder","color":"gold","require":"","icon":"SmileOutlined","tip":"hump...."},
|
||||||
|
{"id":"el_walter_pro","title":"Pro Chikito","color":"#a0d911","require":"","icon":"🐱🐉🧜♀️","tip":"Chikito"},
|
||||||
|
{"id":"patreon","title":"Patreon Member","color":"","require":"","icon":"Patreon","tip":"GoodBoy!"}
|
||||||
|
]
|
||||||
|
|
6
globals/links.json
Normal file
6
globals/links.json
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
{
|
||||||
|
"gitlab": "https://gitlab.com/rstudio-development/comty-development",
|
||||||
|
"github":"https://github.com/srgooglo/Comty-Development",
|
||||||
|
"trellojoin": "https://trello.com/invite/b/UbwvlG1I/2bc02725b9b210d2e9e9a82c5040b895/comty-development",
|
||||||
|
"patreon": "https://www.patreon.com/rstudio"
|
||||||
|
}
|
@ -1,22 +0,0 @@
|
|||||||
import * as Icons from '@ant-design/icons'
|
|
||||||
|
|
||||||
export var Post_Options = [
|
|
||||||
{
|
|
||||||
key: 'pro_boost',
|
|
||||||
icon: <Icons.RocketOutlined />,
|
|
||||||
type: 'switch',
|
|
||||||
title: 'CPRO™ Boost',
|
|
||||||
description: '',
|
|
||||||
require: 'pro',
|
|
||||||
value: false,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
key: 'allow_comments',
|
|
||||||
icon: <Icons.CommentOutlined />,
|
|
||||||
type: 'switch',
|
|
||||||
title: 'Allow Comments',
|
|
||||||
description: '',
|
|
||||||
require: '',
|
|
||||||
value: true,
|
|
||||||
},
|
|
||||||
]
|
|
4
globals/post_options.json
Normal file
4
globals/post_options.json
Normal file
@ -0,0 +1,4 @@
|
|||||||
|
[
|
||||||
|
{"key":"pro_boost","icon":"RocketOutlined","type":"switch","title":"CPRO™ Boost","description":"","require":"pro","value":false},
|
||||||
|
{"key":"allow_comments","icon":"CommentOutlined","type":"switch","title":"Allow Comments","description":"","require":"","value":true}
|
||||||
|
]
|
6
globals/settings.json
Normal file
6
globals/settings.json
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
[
|
||||||
|
{"id":"session_noexpire","icon":"Watch","type":"switch","title":"No expire session","description":"Force the app to not expire any session... [Developer]"},
|
||||||
|
{"id":"search_ontype","icon":"CornerDownRight","type":"switch","title":"Detect input on search bar","description":"Force the app to automaticly search when a type input is detected... [Developer]"},
|
||||||
|
{"id":"post_hidebar","icon":"Menu","type":"switch","title":"Auto hide postbar","description":"Force the app to hide the post actions (likes, comments ...etc) automaticly... [Developer]"},
|
||||||
|
{"id":"verbosity","icon":"Terminal","type":"switch","title":"Enable core verbosity","description":"Show all console logs... [Developer]"}
|
||||||
|
]
|
100
globals/sidebar_menu.json
Normal file
100
globals/sidebar_menu.json
Normal file
@ -0,0 +1,100 @@
|
|||||||
|
[
|
||||||
|
{
|
||||||
|
"id":"main",
|
||||||
|
"icon":"Home",
|
||||||
|
"title":"Main",
|
||||||
|
"attributes": {
|
||||||
|
"require":"login",
|
||||||
|
"desktop":false
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id":"explore",
|
||||||
|
"title":"Explore",
|
||||||
|
"icon":"Compass"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id":"saves",
|
||||||
|
"title":"Saves",
|
||||||
|
"icon":"Bookmark",
|
||||||
|
"attributes": {
|
||||||
|
"require":"login",
|
||||||
|
"mobile":false
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id":"messages",
|
||||||
|
"title":"Messages",
|
||||||
|
"icon":"MessageSquare",
|
||||||
|
"attributes": {
|
||||||
|
"require":"login"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id":"rooms",
|
||||||
|
"title":"Rooms",
|
||||||
|
"icon":"Box",
|
||||||
|
"attributes": {
|
||||||
|
"require":"login"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id":"workshop",
|
||||||
|
"title":"Workshop",
|
||||||
|
"icon":"Package",
|
||||||
|
"attributes": {
|
||||||
|
"require":"login"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id":"streams",
|
||||||
|
"title":"Streams",
|
||||||
|
"icon":"Tv",
|
||||||
|
"attributes": {
|
||||||
|
"require":"login"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id":"debug",
|
||||||
|
"title":"Debug",
|
||||||
|
"icon":"Tool",
|
||||||
|
"attributes": {
|
||||||
|
"position":"bottom",
|
||||||
|
"require":"dev"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id":"settings",
|
||||||
|
"title":"Settings",
|
||||||
|
"icon":"Settings",
|
||||||
|
"attributes": {
|
||||||
|
"position":"bottom"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id":"logout",
|
||||||
|
"title":"Logout",
|
||||||
|
"icon":"LogOut",
|
||||||
|
"iconStyle": {
|
||||||
|
"color": 'red',
|
||||||
|
"marginRight": '10px'
|
||||||
|
},
|
||||||
|
"attributes": {
|
||||||
|
"position":"bottom",
|
||||||
|
"require":"login"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id":"login",
|
||||||
|
"title":"Signin",
|
||||||
|
"icon":"Login",
|
||||||
|
"iconStyle": {
|
||||||
|
"color": "blue",
|
||||||
|
"marginRight": "10px"
|
||||||
|
},
|
||||||
|
"attributes": {
|
||||||
|
"position":"bottom",
|
||||||
|
"require":"guest"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
@ -38,4 +38,3 @@ export default [
|
|||||||
description: 'Yeaah, no more daying',
|
description: 'Yeaah, no more daying',
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
|
|
8
globals/theme_settings.json
Normal file
8
globals/theme_settings.json
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
[
|
||||||
|
{"id":"backgroundImage","icon":"Image","title":"Background","description":"Change the background of the app"},
|
||||||
|
{"id":"overlay","icon":"Sidebar","title":"Overlay","description":"Description blah blah"},
|
||||||
|
{"id":"color","icon":"Droplet","title":"Colors","description":"Texts, Buttons, Sliders ...etc"},
|
||||||
|
{"id":"text","icon":"FontColorsOutlined","title":"Text","description":"Sizes, Fonts"},
|
||||||
|
{"id":"sounds","icon":"Volume2","title":"Sounds","description":"BlipBlopBLup"},
|
||||||
|
{"id":"darkmode","icon":"Moon","title":"Dark Mode","description":"Yeaah, no more daying"}
|
||||||
|
]
|
@ -3,7 +3,7 @@
|
|||||||
"UUID": "C8mVSr-4nmPp2-pr5Vrz-CU4kg4",
|
"UUID": "C8mVSr-4nmPp2-pr5Vrz-CU4kg4",
|
||||||
"title": "Comty™",
|
"title": "Comty™",
|
||||||
"DevBuild": true,
|
"DevBuild": true,
|
||||||
"version": "0.9.1",
|
"version": "0.9.09",
|
||||||
"stage": "dev-pre",
|
"stage": "dev-pre",
|
||||||
"description": "",
|
"description": "",
|
||||||
"author": "RageStudio",
|
"author": "RageStudio",
|
||||||
@ -76,6 +76,7 @@
|
|||||||
"react-virtualized": "^9.21.2",
|
"react-virtualized": "^9.21.2",
|
||||||
"redux-socket.io": "^1.4.0",
|
"redux-socket.io": "^1.4.0",
|
||||||
"redux-thunk": "^2.3.0",
|
"redux-thunk": "^2.3.0",
|
||||||
|
"request": "^2.88.2",
|
||||||
"simple-icons": "^3.3.0",
|
"simple-icons": "^3.3.0",
|
||||||
"slash": "^3.0.0",
|
"slash": "^3.0.0",
|
||||||
"socket.io-client": "^2.3.0",
|
"socket.io-client": "^2.3.0",
|
||||||
|
@ -19,7 +19,7 @@ const Card_Component = (props: Card_Component_props) => {
|
|||||||
if (!props.type) frag = (props.children)
|
if (!props.type) frag = (props.children)
|
||||||
|
|
||||||
return(
|
return(
|
||||||
<div style={props.style} className={styles.render_component}>
|
<div {...props} style={props.style} className={styles.render_component}>
|
||||||
{frag}
|
{frag}
|
||||||
</div>
|
</div>
|
||||||
)
|
)
|
||||||
|
@ -5,7 +5,7 @@ import classnames from 'classnames'
|
|||||||
import styles from './index.less'
|
import styles from './index.less'
|
||||||
import * as errorhandler from 'core/libs/errorhandler'
|
import * as errorhandler from 'core/libs/errorhandler'
|
||||||
import * as antd from 'antd'
|
import * as antd from 'antd'
|
||||||
|
import { router } from 'core/cores'
|
||||||
import {
|
import {
|
||||||
Primary,
|
Primary,
|
||||||
Secondary,
|
Secondary,
|
||||||
@ -101,8 +101,7 @@ export default class Overlay extends React.PureComponent {
|
|||||||
<div>
|
<div>
|
||||||
<div><__searchBar /></div>
|
<div><__searchBar /></div>
|
||||||
<div className={styles.mainElement}>
|
<div className={styles.mainElement}>
|
||||||
<Card_Component>Banana</Card_Component>
|
{session_valid? <Card_Component onClick={() => router.goProfile(session_data["username"])} style={{ display: 'flex', lineHeight: '30px', wordBreak: 'break-all' }} ><antd.Avatar src={session_data.avatar} shape="square" /> <div style={{ marginLeft: '10px' }}> @{session_data.username}<span style={{ fontSize: "11px" }}>#{session_uuid}</span></div></Card_Component> : null }
|
||||||
{session_valid? <Card_Component style={{ display: 'flex', lineHeight: '30px', wordBreak: 'break-all' }} ><antd.Avatar src={session_data.avatar} shape="square" /> <div style={{ marginLeft: '10px' }}> @{session_data.username}<span style={{ fontSize: "11px" }}>#{session_uuid}</span></div></Card_Component> : null }
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
)
|
)
|
||||||
|
@ -1,11 +1,11 @@
|
|||||||
import React from 'react'
|
import React from 'react'
|
||||||
import { app_config } from 'config'
|
import { app_config } from 'config'
|
||||||
import { router } from 'core/cores'
|
import { router } from 'core/cores'
|
||||||
import MenuList from 'globals/sidebar_menu'
|
|
||||||
|
|
||||||
import Sider_Mobile from './mobile'
|
import Sider_Mobile from './mobile'
|
||||||
import Sider_Default from './default'
|
import Sider_Default from './default'
|
||||||
import { connect } from 'umi'
|
import { connect } from 'umi'
|
||||||
|
import MenuList from 'globals/sidebar_menu.js'
|
||||||
|
|
||||||
@connect(({ app }) => ({ app }))
|
@connect(({ app }) => ({ app }))
|
||||||
class Sider extends React.PureComponent {
|
class Sider extends React.PureComponent {
|
||||||
|
@ -1,27 +0,0 @@
|
|||||||
import React from 'react'
|
|
||||||
import styles from './index.less'
|
|
||||||
import * as antd from 'antd'
|
|
||||||
import { booleanFix } from 'core'
|
|
||||||
|
|
||||||
export default class UserBadges extends React.Component {
|
|
||||||
render() {
|
|
||||||
const { values } = this.props
|
|
||||||
return (
|
|
||||||
<div className={styles.TagWrappers}>
|
|
||||||
{booleanFix(values.nsfw_flag) ? (
|
|
||||||
<antd.Tag color="volcano">NSFW</antd.Tag>
|
|
||||||
) : null}
|
|
||||||
{booleanFix(values.is_pro) ? (
|
|
||||||
<antd.Tag color="purple">
|
|
||||||
CPRO™ <Icons.RocketOutlined />
|
|
||||||
</antd.Tag>
|
|
||||||
) : null}
|
|
||||||
{booleanFix(values.dev) ? (
|
|
||||||
<antd.Tag color="default">
|
|
||||||
DEVELOPER <Icons.CodeOutlined />
|
|
||||||
</antd.Tag>
|
|
||||||
) : null}
|
|
||||||
</div>
|
|
||||||
)
|
|
||||||
}
|
|
||||||
}
|
|
@ -11,7 +11,6 @@ import * as MyLayout from './Layout/index.js'
|
|||||||
import PageTransition from './PageTransition'
|
import PageTransition from './PageTransition'
|
||||||
|
|
||||||
// User Components
|
// User Components
|
||||||
import UserBadges from './UserBadges'
|
|
||||||
|
|
||||||
// Post Components
|
// Post Components
|
||||||
import MediaPlayer from './MediaPlayer'
|
import MediaPlayer from './MediaPlayer'
|
||||||
@ -23,7 +22,6 @@ export {
|
|||||||
Feather,
|
Feather,
|
||||||
About,
|
About,
|
||||||
MediaPlayer,
|
MediaPlayer,
|
||||||
UserBadges,
|
|
||||||
PageTransition,
|
PageTransition,
|
||||||
MyLayout,
|
MyLayout,
|
||||||
Loader,
|
Loader,
|
||||||
|
@ -20,7 +20,7 @@ export const router = {
|
|||||||
router.push(e);
|
router.push(e);
|
||||||
// goTo.element('primaryContent');
|
// goTo.element('primaryContent');
|
||||||
},
|
},
|
||||||
goprofile: () => {
|
goProfile: e => {
|
||||||
router.push(`/@${e}`);
|
router.push(`/@${e}`);
|
||||||
// goTo.element('primaryContent');
|
// goTo.element('primaryContent');
|
||||||
},
|
},
|
||||||
|
@ -5,6 +5,8 @@ import store from 'store';
|
|||||||
import { i18n, app_config } from 'config';
|
import { i18n, app_config } from 'config';
|
||||||
import * as errorHandlers from 'core/libs/errorhandler'
|
import * as errorHandlers from 'core/libs/errorhandler'
|
||||||
import platform from 'platform'
|
import platform from 'platform'
|
||||||
|
import { uri_resolver } from 'api/lib';
|
||||||
|
import request from 'request'
|
||||||
|
|
||||||
const { pathToRegexp } = require('path-to-regexp');
|
const { pathToRegexp } = require('path-to-regexp');
|
||||||
|
|
||||||
@ -28,6 +30,27 @@ export const app_info = {
|
|||||||
layout: platform.layout
|
layout: platform.layout
|
||||||
};
|
};
|
||||||
|
|
||||||
|
export function getGlobals(params, callback) {
|
||||||
|
if (!params || !params.server) return false
|
||||||
|
let tmpResponse = []
|
||||||
|
|
||||||
|
let req = {
|
||||||
|
global: "__globals",
|
||||||
|
url: params.server
|
||||||
|
}
|
||||||
|
|
||||||
|
params.global? req.global = params.global : null
|
||||||
|
|
||||||
|
let urlString = `${req.url}/${req.global}.json`
|
||||||
|
console.log(urlString)
|
||||||
|
|
||||||
|
request(urlString, (error, response, body) => {
|
||||||
|
tmpResponse = body
|
||||||
|
callback(tmpResponse)
|
||||||
|
})
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
export function imageToBase64(img, callback){
|
export function imageToBase64(img, callback){
|
||||||
const reader = new FileReader()
|
const reader = new FileReader()
|
||||||
reader.addEventListener('load', () => callback(reader.result))
|
reader.addEventListener('load', () => callback(reader.result))
|
||||||
@ -234,7 +257,8 @@ export const time = {
|
|||||||
};
|
};
|
||||||
|
|
||||||
export function pathMatchRegexp(regexp, pathname) {
|
export function pathMatchRegexp(regexp, pathname) {
|
||||||
return pathToRegexp(regexp).exec(deLangPrefix(pathname));
|
console.log('Regex => ', pathname)
|
||||||
|
return pathToRegexp(regexp).exec(pathname)
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
import { defaults, app_config } from 'config'
|
import { defaults, app_config } from 'config'
|
||||||
import { get_value } from 'core'
|
import { get_value } from '../../../pages/[page]/node_modules/core'
|
||||||
|
|
||||||
export function parseLocalStorage(){
|
export function parseLocalStorage(){
|
||||||
const a = localStorage.getItem(app_config.app_settings_storage)
|
const a = localStorage.getItem(app_config.app_settings_storage)
|
||||||
|
@ -1,12 +1,13 @@
|
|||||||
/* global window */
|
/* global window */
|
||||||
import store from 'store';
|
import store from 'store';
|
||||||
import { pathMatchRegexp, queryLayout } from 'core';
|
import { pathMatchRegexp, queryLayout } from '../pages/[page]/node_modules/core';
|
||||||
import { app_config } from 'config';
|
import { app_config } from 'config';
|
||||||
import keys from 'config/app_keys';
|
import keys from 'config/app_keys';
|
||||||
import { router, user, session } from 'core/cores';
|
import { router, user, session } from 'core/cores';
|
||||||
import verbosity from 'core/libs/verbosity'
|
import verbosity from 'core/libs/verbosity'
|
||||||
import { notify } from 'core/libs/interface/notify'
|
import { notify } from 'core/libs/interface/notify'
|
||||||
import settings from 'core/libs/settings'
|
import settings from 'core/libs/settings'
|
||||||
|
import { uri_resolver } from 'api/lib';
|
||||||
|
|
||||||
import jwt from 'jsonwebtoken'
|
import jwt from 'jsonwebtoken'
|
||||||
import cookie from 'cookie_js'
|
import cookie from 'cookie_js'
|
||||||
@ -15,6 +16,7 @@ export default {
|
|||||||
namespace: 'app',
|
namespace: 'app',
|
||||||
state: {
|
state: {
|
||||||
server_key: keys.server_key,
|
server_key: keys.server_key,
|
||||||
|
resolvers: null,
|
||||||
|
|
||||||
service_valid: false,
|
service_valid: false,
|
||||||
ng_services: false,
|
ng_services: false,
|
||||||
@ -40,10 +42,13 @@ export default {
|
|||||||
setup({ dispatch }) {
|
setup({ dispatch }) {
|
||||||
try {
|
try {
|
||||||
const electron = window.require("electron")
|
const electron = window.require("electron")
|
||||||
dispatch({ type: 'updateState', payload: { electron: electron } });
|
dispatch({ type: 'updateState', payload: { electron: electron } })
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
// nothing
|
// nothing
|
||||||
}
|
}
|
||||||
|
uri_resolver().then(res => {
|
||||||
|
dispatch({ type: 'handleUpdateResolvers', payload: res })
|
||||||
|
})
|
||||||
dispatch({ type: 'updateFrames' })
|
dispatch({ type: 'updateFrames' })
|
||||||
dispatch({ type: 'handleValidate' })
|
dispatch({ type: 'handleValidate' })
|
||||||
dispatch({ type: 'query' });
|
dispatch({ type: 'query' });
|
||||||
@ -170,10 +175,12 @@ export default {
|
|||||||
sessionStorage.clear()
|
sessionStorage.clear()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
verbosity.error(error)
|
verbosity.error(error)
|
||||||
}
|
}
|
||||||
},
|
|
||||||
|
}
|
||||||
},
|
},
|
||||||
reducers: {
|
reducers: {
|
||||||
updateState(state, { payload }) {
|
updateState(state, { payload }) {
|
||||||
@ -182,6 +189,9 @@ export default {
|
|||||||
...payload,
|
...payload,
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
|
handleUpdateResolvers(state, { payload }) {
|
||||||
|
state.resolvers = payload
|
||||||
|
},
|
||||||
handleUpdateAuthFrames(state, { payload }) {
|
handleUpdateAuthFrames(state, { payload }) {
|
||||||
state.session_authframe = payload
|
state.session_authframe = payload
|
||||||
state.session_token = payload.session_token,
|
state.session_token = payload.session_token,
|
||||||
@ -251,7 +261,7 @@ export default {
|
|||||||
notify.success('Login done!')
|
notify.success('Login done!')
|
||||||
router.push('/')
|
router.push('/')
|
||||||
state.session_valid = true
|
state.session_valid = true
|
||||||
|
location.reload()
|
||||||
},
|
},
|
||||||
handleUpdateData(state){
|
handleUpdateData(state){
|
||||||
const frame = {
|
const frame = {
|
||||||
|
35
src/pages/logout.js
Normal file
35
src/pages/logout.js
Normal file
@ -0,0 +1,35 @@
|
|||||||
|
import React from 'react'
|
||||||
|
import * as antd from 'antd'
|
||||||
|
import { connect } from 'umi'
|
||||||
|
import { router, user, session } from 'core/cores';
|
||||||
|
import * as Icons from 'components/Icons'
|
||||||
|
|
||||||
|
@connect(({ app }) => ({ app }))
|
||||||
|
export default class Logout extends React.Component{
|
||||||
|
|
||||||
|
componentDidMount(){
|
||||||
|
const dispatchLogout = () => this.props.dispatch({ type: "app/logout" })
|
||||||
|
|
||||||
|
antd.Modal.confirm({
|
||||||
|
title: this.props.app.session_data.username,
|
||||||
|
icon: <antd.Avatar src={this.props.app.session_data.avatar} />,
|
||||||
|
content: 'Are you sure you want to log out',
|
||||||
|
onOk() {
|
||||||
|
router.push('/')
|
||||||
|
},
|
||||||
|
onCancel() {
|
||||||
|
dispatchLogout()
|
||||||
|
},
|
||||||
|
okText: <><Icons.Home/>Resume</>,
|
||||||
|
cancelText: <><Icons.Trash/>Logout</>
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
componentWillUnmount(){
|
||||||
|
antd.Modal.destroyAll()
|
||||||
|
}
|
||||||
|
|
||||||
|
render(){
|
||||||
|
return null
|
||||||
|
}
|
||||||
|
}
|
@ -1,10 +1,8 @@
|
|||||||
import React from 'react'
|
import React from 'react'
|
||||||
import { About } from 'components'
|
import { About } from 'components'
|
||||||
import l from 'globals/links'
|
|
||||||
import * as Icons from 'components/Icons'
|
import * as Icons from 'components/Icons'
|
||||||
import * as antd from 'antd'
|
import * as antd from 'antd'
|
||||||
|
import l from 'globals/links'
|
||||||
|
|
||||||
|
|
||||||
export default class AppAbout extends React.Component {
|
export default class AppAbout extends React.Component {
|
||||||
render() {
|
render() {
|
||||||
|
@ -1,17 +1,20 @@
|
|||||||
import React, { Component, Fragment } from 'react'
|
import React, { Component, Fragment } from 'react'
|
||||||
import { List, Switch, Button, notification, InputNumber } from 'antd'
|
import { List, Switch, Button, notification, InputNumber } from 'antd'
|
||||||
import ListSettings from 'globals/settings'
|
|
||||||
import { control } from 'components/layout/ControlBar'
|
import { control } from 'components/layout/ControlBar'
|
||||||
|
|
||||||
import verbosity from 'core/libs/verbosity'
|
import verbosity from 'core/libs/verbosity'
|
||||||
import * as Icons from 'components/Icons'
|
import * as Icons from 'components/Icons'
|
||||||
import { settings, newSetting } from 'core/libs/settings'
|
import { settings, newSetting } from 'core/libs/settings'
|
||||||
|
import SettingList from 'globals/settings.js'
|
||||||
|
|
||||||
|
import {connect} from 'umi'
|
||||||
|
|
||||||
|
@connect(({ app }) => ({ app }))
|
||||||
class Base extends Component {
|
class Base extends Component {
|
||||||
constructor(props) {
|
constructor(props) {
|
||||||
super(props);
|
super(props);
|
||||||
this.state = {
|
this.state = {
|
||||||
list: ListSettings,
|
list: SettingList,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,10 +1,72 @@
|
|||||||
import React from 'react'
|
import React from 'react'
|
||||||
|
import * as antd from 'antd'
|
||||||
|
import * as Icons from 'components/Icons'
|
||||||
|
import styles from './index.less'
|
||||||
|
import { connect } from 'umi';
|
||||||
|
|
||||||
|
@connect(({ app }) => ({ app }))
|
||||||
|
export default class ElectronSettings extends React.PureComponent{
|
||||||
|
state = {
|
||||||
|
loading: true,
|
||||||
|
info: []
|
||||||
|
}
|
||||||
|
|
||||||
|
getInfo(){
|
||||||
|
this.setState({ loading: true })
|
||||||
|
this.setState({
|
||||||
|
loading: false,
|
||||||
|
info: {
|
||||||
|
g_umi: window.g_umi,
|
||||||
|
process: window.process
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
componentDidMount(){
|
||||||
|
this.getInfo()
|
||||||
|
}
|
||||||
|
|
||||||
export default class ElectronSettings extends React.Component{
|
|
||||||
render(){
|
render(){
|
||||||
|
const { info } = this.state
|
||||||
return(
|
return(
|
||||||
|
<div className={styles.main}>
|
||||||
|
<h2>
|
||||||
|
<Icons.Command /> Application Settings
|
||||||
|
</h2>
|
||||||
<div>
|
<div>
|
||||||
Electron
|
{ this.state.loading
|
||||||
|
? <antd.Skeleton active />
|
||||||
|
: <div className={styles.versions}>
|
||||||
|
<div>umi<antd.Tag>{info.g_umi.version} </antd.Tag></div>
|
||||||
|
<div>react</div>
|
||||||
|
<div><Icons.V8/><antd.Tag>{info.process.versions.v8}</antd.Tag></div>
|
||||||
|
<div><Icons.NodeDotJs /><antd.Tag>{info.process.version}</antd.Tag></div>
|
||||||
|
<div><Icons.Electron /><antd.Tag>{info.process.versions.electron}</antd.Tag></div>
|
||||||
|
<div><Icons.Openssl /><antd.Tag>{info.process.versions.openssl}</antd.Tag></div>
|
||||||
|
<div><Icons.Css3 /> CCS3</div>
|
||||||
|
<div><Icons.Yarn /> Yarn </div>
|
||||||
|
<div><Icons.Npm /> npm </div>
|
||||||
|
<div><Icons.Jpeg /> .jpeg </div>
|
||||||
|
<div><Icons.Json /> JSON </div>
|
||||||
|
<div><Icons.Webgl /> WebGL </div>
|
||||||
|
<div><Icons.Auth0 /> Auth0 </div>
|
||||||
|
<div><Icons.Babel /> Babel </div>
|
||||||
|
<div><Icons.Redux /> Redux </div>
|
||||||
|
<div><Icons.Gitlab /> Gitlab </div>
|
||||||
|
<div><Icons.Jquery /> jQuery</div>
|
||||||
|
<div><Icons.Webpack /> Webpack </div>
|
||||||
|
<div><Icons.SocketDotIo /> Socket.io </div>
|
||||||
|
<div><Icons.Javascript /> JS </div>
|
||||||
|
<div><Icons.Typescript /> TS </div>
|
||||||
|
<div><Icons.Webassembly /> WebAssembly </div>
|
||||||
|
<div><Icons.Openai /> OpenAI </div>
|
||||||
|
<div><Icons.Hp /> HP </div>
|
||||||
|
<div><Icons.Simpleicons /> Simple Icons </div>
|
||||||
|
<div><Icons.Googlechrome /> Google Chrome </div>
|
||||||
|
<div><Icons.Visualstudiocode /> VisualStudio Code </div>
|
||||||
|
</div>
|
||||||
|
}
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
14
src/pages/settings/components/electron/index.less
Normal file
14
src/pages/settings/components/electron/index.less
Normal file
@ -0,0 +1,14 @@
|
|||||||
|
.versions{
|
||||||
|
display: grid;
|
||||||
|
grid-template-columns: repeat(4, 1fr);
|
||||||
|
grid-template-rows: repeat(4, 1fr);
|
||||||
|
grid-column-gap: 15px;
|
||||||
|
grid-row-gap: 15px;
|
||||||
|
|
||||||
|
> div {
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: center;
|
||||||
|
}
|
||||||
|
}
|
@ -1,7 +1,6 @@
|
|||||||
import React from 'react'
|
import React from 'react'
|
||||||
import * as Icons from 'components/Icons'
|
import * as Icons from 'components/Icons'
|
||||||
import * as antd from 'antd'
|
import * as antd from 'antd'
|
||||||
import themeSettings from 'globals/theme_settings'
|
|
||||||
import {connect} from 'umi'
|
import {connect} from 'umi'
|
||||||
import styles from './index.less'
|
import styles from './index.less'
|
||||||
|
|
||||||
@ -9,6 +8,7 @@ import { onError } from 'core/libs/errorhandler'
|
|||||||
import { theme, getOptimalOpacityFromIMG, get_style_rule_value } from 'core/libs/style'
|
import { theme, getOptimalOpacityFromIMG, get_style_rule_value } from 'core/libs/style'
|
||||||
import { urlToBase64, imageToBase64, arrayToObject } from 'core'
|
import { urlToBase64, imageToBase64, arrayToObject } from 'core'
|
||||||
import exportDataAsFile from 'core/libs/interface/export_data'
|
import exportDataAsFile from 'core/libs/interface/export_data'
|
||||||
|
import ThemeSettingsList from 'globals/theme_settings.js'
|
||||||
|
|
||||||
class ThemeConfigurator extends React.Component{
|
class ThemeConfigurator extends React.Component{
|
||||||
|
|
||||||
@ -292,7 +292,7 @@ export default class ThemeSettings extends React.Component{
|
|||||||
<h2><Icons.Layers/> Theme</h2>
|
<h2><Icons.Layers/> Theme</h2>
|
||||||
<antd.List
|
<antd.List
|
||||||
itemLayout="horizontal"
|
itemLayout="horizontal"
|
||||||
dataSource={themeSettings}
|
dataSource={ThemeSettingsList}
|
||||||
renderItem={item => (
|
renderItem={item => (
|
||||||
<div style={{ margin: '10px 0 10px 0' }} >
|
<div style={{ margin: '10px 0 10px 0' }} >
|
||||||
<antd.Card size="small" bodyStyle={{ width: '100%' }} style={{ display: "flex", flexDirection: "row", margin: 'auto', borderRadius: '12px' }} hoverable onClick={() => handleClick(item.id)}>
|
<antd.Card size="small" bodyStyle={{ width: '100%' }} style={{ display: "flex", flexDirection: "row", margin: 'auto', borderRadius: '12px' }} hoverable onClick={() => handleClick(item.id)}>
|
||||||
|
@ -11,6 +11,7 @@ import Earnings from './components/earnings/index.js'
|
|||||||
import Base from './components/base.js'
|
import Base from './components/base.js'
|
||||||
import AppAbout from './components/about.js'
|
import AppAbout from './components/about.js'
|
||||||
import Theme from './components/theme'
|
import Theme from './components/theme'
|
||||||
|
import ElectronApp from './components/electron'
|
||||||
|
|
||||||
const Settings = {
|
const Settings = {
|
||||||
base: <Base />,
|
base: <Base />,
|
||||||
@ -18,7 +19,8 @@ const Settings = {
|
|||||||
theme: <Theme />,
|
theme: <Theme />,
|
||||||
earnings: <Earnings />,
|
earnings: <Earnings />,
|
||||||
security: <SecurityView />,
|
security: <SecurityView />,
|
||||||
notification: <NotificationView />
|
notification: <NotificationView />,
|
||||||
|
app: <ElectronApp />
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -63,22 +65,59 @@ const menuList = [
|
|||||||
},
|
},
|
||||||
]
|
]
|
||||||
|
|
||||||
class GeneralSettings extends React.Component {
|
import { connect } from 'umi';
|
||||||
|
|
||||||
|
@connect(({ app }) => ({ app }))
|
||||||
|
class GeneralSettings extends React.PureComponent {
|
||||||
constructor(props) {
|
constructor(props) {
|
||||||
super(props)
|
super(props)
|
||||||
this.state = {
|
this.state = {
|
||||||
|
loading: true,
|
||||||
selectKey: 'base',
|
selectKey: 'base',
|
||||||
|
menus: []
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
getMenu = () => {
|
requireQuery(require){
|
||||||
return menuList.map(item => (
|
return new Promise(resolve => {
|
||||||
|
this.props.dispatch({
|
||||||
|
type: 'app/isUser',
|
||||||
|
payload: require,
|
||||||
|
callback: (e) => {
|
||||||
|
resolve(e)
|
||||||
|
}
|
||||||
|
})
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
async queryMenu() {
|
||||||
|
this.setState({ loading: true })
|
||||||
|
|
||||||
|
const filterArray = (data) =>{
|
||||||
|
let tmp = []
|
||||||
|
return new Promise(resolve => {
|
||||||
|
data.forEach(async (element) => {
|
||||||
|
if (typeof(element.require) !== 'undefined') {
|
||||||
|
const validRequire = await this.requireQuery(element.require)
|
||||||
|
validRequire? tmp.push(element) : null
|
||||||
|
}else{
|
||||||
|
tmp.push(element)
|
||||||
|
}
|
||||||
|
})
|
||||||
|
resolve(tmp)
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
this.setState({ menus: await filterArray(menuList), loading: false })
|
||||||
|
}
|
||||||
|
|
||||||
|
getMenu() {
|
||||||
|
return this.state.menus.map(item => (
|
||||||
<Item key={item.key}>
|
<Item key={item.key}>
|
||||||
<span>{item.icons} {item.title}</span>
|
<span>{item.icons} {item.title}</span>
|
||||||
</Item>
|
</Item>
|
||||||
))
|
))
|
||||||
}
|
}
|
||||||
|
|
||||||
selectKey = key => {
|
selectKey = key => {
|
||||||
this.setState({
|
this.setState({
|
||||||
selectKey: key,
|
selectKey: key,
|
||||||
@ -93,8 +132,15 @@ class GeneralSettings extends React.Component {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
componentDidMount(){
|
||||||
|
this.queryMenu()
|
||||||
|
}
|
||||||
|
|
||||||
render() {
|
render() {
|
||||||
const { selectKey } = this.state
|
const { selectKey, loading } = this.state
|
||||||
|
if(loading){
|
||||||
|
return <></>
|
||||||
|
}
|
||||||
return (
|
return (
|
||||||
<div className={styles.main}>
|
<div className={styles.main}>
|
||||||
<div className={styles.leftMenu}>
|
<div className={styles.leftMenu}>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user