mirror of
https://github.com/ragestudio/comty.git
synced 2025-06-09 10:34:17 +00:00
Settings and DevOptions Fix
This commit is contained in:
parent
e5873d8c34
commit
cf73fac82a
@ -65,6 +65,7 @@ export default {
|
|||||||
alias: {
|
alias: {
|
||||||
ycore: resolve(__dirname, './src/@ycore/ycore_worker.js'),
|
ycore: resolve(__dirname, './src/@ycore/ycore_worker.js'),
|
||||||
api: resolve(__dirname, './src/services/'),
|
api: resolve(__dirname, './src/services/'),
|
||||||
|
globals: resolve(__dirname, './globals'),
|
||||||
components: resolve(__dirname, './src/components'),
|
components: resolve(__dirname, './src/components'),
|
||||||
config: resolve(__dirname, './config/ycore.config.js'),
|
config: resolve(__dirname, './config/ycore.config.js'),
|
||||||
models: resolve(__dirname, './src/models'),
|
models: resolve(__dirname, './src/models'),
|
||||||
|
16
config/app.settings.js
Normal file
16
config/app.settings.js
Normal file
@ -0,0 +1,16 @@
|
|||||||
|
import {ReturnDevOption} from 'ycore'
|
||||||
|
export var DevOptions = {
|
||||||
|
// Global Behaviors
|
||||||
|
InfiniteLoading: false,
|
||||||
|
InfiniteLogin: false,
|
||||||
|
InfiniteRegister: false,
|
||||||
|
DisableLogin: false,
|
||||||
|
DisableRegister: true,
|
||||||
|
DisablePasswordRecover: true,
|
||||||
|
// Activating this, the logs must be trowed
|
||||||
|
ShowFunctionsLogs: ReturnDevOption('force_showDevLogs'),
|
||||||
|
StrictLightMode: ReturnDevOption('strict_lightMode'),
|
||||||
|
SignForNotExpire: ReturnDevOption('force_showDevLogs'),
|
||||||
|
MaxJWTexpire: '1556952',
|
||||||
|
MaxLengthPosts: '512'
|
||||||
|
}
|
@ -25,40 +25,8 @@ module.exports = {
|
|||||||
server_key: "f706b0a535b6c2d36545c4137a0a3a26853ea8b5-1223c9ba7923152cae28e5a2e7501b2b-50600768",
|
server_key: "f706b0a535b6c2d36545c4137a0a3a26853ea8b5-1223c9ba7923152cae28e5a2e7501b2b-50600768",
|
||||||
openwheater_apiKey:'2acf34be0b8f033b89ba4de1e674d42a',
|
openwheater_apiKey:'2acf34be0b8f033b89ba4de1e674d42a',
|
||||||
},
|
},
|
||||||
Endpoints: {
|
|
||||||
get_user_posts: "https://api.ragestudio.net/RS-YIBTP/yid/posts?access_token=",
|
|
||||||
find_user: "https://api.ragestudio.net/RS-YIBTP/yid/find_user?access_token=",
|
|
||||||
search_endpoint: "https://api.ragestudio.net/RS-YIBTP/yid/search?access_token=",
|
|
||||||
get_sessions: "https://api.ragestudio.net/RS-YIBTP/yid/session_id?access_token=",
|
|
||||||
auth_endpoint: "https://api.ragestudio.net/RS-YIBTP/yid/auth",
|
|
||||||
new_post: "https://api.ragestudio.net/RS-YIBTP/yid/new_post?access_token=",
|
|
||||||
get_servicesHandler: 'https://api.ragestudio.net/RS-YIBTP/rs/servicesHandler',
|
|
||||||
get_modhandler: "https://api.ragestudio.net/RS-YIBTP/rs/modHandler",
|
|
||||||
get_subscriptionHandler: "https://api.ragestudio.net/RS-YIBTP/rs/subscriptionHandler",
|
|
||||||
get_marketplace_global: "https://api.ragestudio.net/RS-YIBTP/rs/marketplaceHandler?access_token=",
|
|
||||||
get_config_endpoint: "https://api.ragestudio.net/RS-YIBTP/yid/get-site-settings?access_token=",
|
|
||||||
get_userData_endpoint: "https://api.ragestudio.net/RS-YIBTP/yid/get-user-data?access_token=",
|
|
||||||
get_userPostFeed: "https://api.ragestudio.net/RS-YIBTP/yid/posts?access_token=",
|
|
||||||
update_userData_endpoint: "https://api.ragestudio.net/RS-YIBTP/yid/update-user-data?access_token=",
|
|
||||||
removeToken: "https://api.ragestudio.net/RS-YIBTP/yid/delete-access-token?access_token=",
|
|
||||||
register_endpoint: "https://api.ragestudio.net/RS-YIBTP/yid/create-account",
|
|
||||||
resetPassword_endpoint: "https://api.ragestudio.net/RS-YIBTP/yid/send-reset-password-email?access_token=",
|
|
||||||
logotype_uri: 'https://api.ragestudio.net/branding/svg/STUDIO-JETBLACK-Generic_template.png',
|
|
||||||
},
|
|
||||||
DevOptions: {
|
|
||||||
defaultSettings: [{id: 'strict_lightMode', value: false}, {id: 'force_collapse', value: false}, {id: 'force_showDevLogs', value: true}],
|
|
||||||
// Global Behaviors
|
|
||||||
InfiniteLoading: false,
|
|
||||||
InfiniteLogin: false,
|
|
||||||
InfiniteRegister: false,
|
|
||||||
DisableLogin: false,
|
|
||||||
DisableRegister: true,
|
|
||||||
DisablePasswordRecover: true,
|
|
||||||
// Activating this, the logs must be trowed
|
|
||||||
ShowFunctionsLogs: true,
|
|
||||||
StrictLightMode: false,
|
|
||||||
MaxLengthPosts: '512'
|
|
||||||
},
|
|
||||||
/* I18n configuration, `languages` and `defaultLanguage` are required currently. */
|
/* I18n configuration, `languages` and `defaultLanguage` are required currently. */
|
||||||
i18n: {
|
i18n: {
|
||||||
/* Countrys flags: https://www.flaticon.com/packs/countrys-flags */
|
/* Countrys flags: https://www.flaticon.com/packs/countrys-flags */
|
||||||
|
22
globals/endpoints.js
Normal file
22
globals/endpoints.js
Normal file
@ -0,0 +1,22 @@
|
|||||||
|
module.exports = {
|
||||||
|
Endpoints: {
|
||||||
|
get_user_posts: "https://api.ragestudio.net/RS-YIBTP/yid/posts?access_token=",
|
||||||
|
find_user: "https://api.ragestudio.net/RS-YIBTP/yid/find_user?access_token=",
|
||||||
|
search_endpoint: "https://api.ragestudio.net/RS-YIBTP/yid/search?access_token=",
|
||||||
|
get_sessions: "https://api.ragestudio.net/RS-YIBTP/yid/session_id?access_token=",
|
||||||
|
auth_endpoint: "https://api.ragestudio.net/RS-YIBTP/yid/auth",
|
||||||
|
new_post: "https://api.ragestudio.net/RS-YIBTP/yid/new_post?access_token=",
|
||||||
|
get_servicesHandler: 'https://api.ragestudio.net/RS-YIBTP/rs/servicesHandler',
|
||||||
|
get_modhandler: "https://api.ragestudio.net/RS-YIBTP/rs/modHandler",
|
||||||
|
get_subscriptionHandler: "https://api.ragestudio.net/RS-YIBTP/rs/subscriptionHandler",
|
||||||
|
get_marketplace_global: "https://api.ragestudio.net/RS-YIBTP/rs/marketplaceHandler?access_token=",
|
||||||
|
get_config_endpoint: "https://api.ragestudio.net/RS-YIBTP/yid/get-site-settings?access_token=",
|
||||||
|
get_userData_endpoint: "https://api.ragestudio.net/RS-YIBTP/yid/get-user-data?access_token=",
|
||||||
|
get_userPostFeed: "https://api.ragestudio.net/RS-YIBTP/yid/posts?access_token=",
|
||||||
|
update_userData_endpoint: "https://api.ragestudio.net/RS-YIBTP/yid/update-user-data?access_token=",
|
||||||
|
removeToken: "https://api.ragestudio.net/RS-YIBTP/yid/delete-access-token?access_token=",
|
||||||
|
register_endpoint: "https://api.ragestudio.net/RS-YIBTP/yid/create-account",
|
||||||
|
resetPassword_endpoint: "https://api.ragestudio.net/RS-YIBTP/yid/send-reset-password-email?access_token=",
|
||||||
|
logotype_uri: 'https://api.ragestudio.net/branding/svg/STUDIO-JETBLACK-Generic_template.png',
|
||||||
|
}
|
||||||
|
}
|
@ -6,7 +6,7 @@ function StorageValued(e){
|
|||||||
const fr = Ite.filter(Boolean)
|
const fr = Ite.filter(Boolean)
|
||||||
return fr.toString()
|
return fr.toString()
|
||||||
}
|
}
|
||||||
export default [
|
export var AppSettings = [
|
||||||
{
|
{
|
||||||
"SettingID": "strict_lightMode",
|
"SettingID": "strict_lightMode",
|
||||||
"title": "Strict Light Mode",
|
"title": "Strict Light Mode",
|
||||||
@ -23,7 +23,7 @@ export default [
|
|||||||
"SettingID": "force_showDevLogs",
|
"SettingID": "force_showDevLogs",
|
||||||
"title": "Show Functions Logs",
|
"title": "Show Functions Logs",
|
||||||
"description": "Show all console logs... [Developer]",
|
"description": "Show all console logs... [Developer]",
|
||||||
"value": StorageValued('force_showDevLogs') || true
|
"value": StorageValued('force_showDevLogs') || false
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"SettingID": "sessions_noexpire",
|
"SettingID": "sessions_noexpire",
|
||||||
@ -31,4 +31,4 @@ export default [
|
|||||||
"description": "Force the app to not expire any session... [Developer]",
|
"description": "Force the app to not expire any session... [Developer]",
|
||||||
"value": StorageValued('sessions_noexpire') || true
|
"value": StorageValued('sessions_noexpire') || true
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
|
@ -7,16 +7,16 @@ var jquery = require("jquery");
|
|||||||
var jwt = require("jsonwebtoken")
|
var jwt = require("jsonwebtoken")
|
||||||
|
|
||||||
function __API__User (payload){
|
function __API__User (payload){
|
||||||
var ExpireTime = '1556952'
|
var ExpireTime = ycore.DevOptions.MaxJWTexpire
|
||||||
const now = new Date()
|
const now = new Date()
|
||||||
now.setDate(now.getDate() + 1)
|
now.setDate(now.getDate() + 1)
|
||||||
const { UserID, UserToken } = payload
|
const { UserID, UserToken } = payload
|
||||||
const frame = { UserID, UserToken, deadline: now.getTime()}
|
const frame = { UserID, UserToken, deadline: ( ycore.DevOptions.SignForNotExpire? null : now.getTime() )}
|
||||||
console.debug(frame)
|
console.debug(frame)
|
||||||
jwt.sign(
|
jwt.sign(
|
||||||
frame,
|
frame,
|
||||||
keys.secretOrKey,
|
keys.secretOrKey,
|
||||||
{ expiresIn: ExpireTime },
|
ycore.DevOptions.SignForNotExpire? { expiresIn: '0' } : { expiresIn: ExpireTime },
|
||||||
(err, token) => {
|
(err, token) => {
|
||||||
Cookies.set('token', token)
|
Cookies.set('token', token)
|
||||||
ycore.RefreshONCE()
|
ycore.RefreshONCE()
|
||||||
|
@ -1,18 +1,25 @@
|
|||||||
|
import {AppSettings} from '../../globals/settings.js'
|
||||||
|
import {Endpoints} from 'globals/endpoints.js'
|
||||||
import umiRouter from 'umi/router';
|
import umiRouter from 'umi/router';
|
||||||
import * as antd from "antd"
|
import * as antd from "antd"
|
||||||
|
import config from 'config'
|
||||||
import './libs.js'
|
import './libs.js'
|
||||||
export * from "./libs.js"
|
|
||||||
|
|
||||||
import * as AppSettings from '../../globals/settings.js'
|
export * from "./libs.js"
|
||||||
export var DevOptions = AppSettings;
|
export * from "../../config/app.settings.js"
|
||||||
|
export var { router } = require("utils")
|
||||||
|
export var endpoints = Endpoints;
|
||||||
|
export var yConfig = config.yConfig;
|
||||||
|
|
||||||
var package_json = require("../../package.json");
|
var package_json = require("../../package.json");
|
||||||
var config = require("config");
|
|
||||||
|
|
||||||
export var { router } = require("utils")
|
export function ReturnDevOption(e){
|
||||||
export var endpoints = config.Endpoints;
|
const Ite = AppSettings.map(item => {
|
||||||
export var yConfig = config.yConfig;
|
return item.SettingID === e? item.value : null
|
||||||
|
})
|
||||||
|
const fr = Ite.filter(Boolean)
|
||||||
|
return fr.toString()
|
||||||
|
}
|
||||||
|
|
||||||
export function booleanFix(e){
|
export function booleanFix(e){
|
||||||
if(e == 1){
|
if(e == 1){
|
||||||
|
@ -28,6 +28,7 @@ const UserHeader = ({ values }) => {
|
|||||||
</div>
|
</div>
|
||||||
<div className={styles.content}>
|
<div className={styles.content}>
|
||||||
<div className={styles.contentTitle}>
|
<div className={styles.contentTitle}>
|
||||||
|
{ycore.DevOptions.ShowFunctionsLogs? 'si' : 'sad'}
|
||||||
<h1 style={{ marginBottom: '0px' }} >{values.username}<antd.Tooltip title="User Verified">{ycore.booleanFix(values.verified)? <antd.Icon style={{ color: 'blue', verticalAlign:'top' }} component={CustomIcons.VerifiedBadge} /> : null}</antd.Tooltip></h1>
|
<h1 style={{ marginBottom: '0px' }} >{values.username}<antd.Tooltip title="User Verified">{ycore.booleanFix(values.verified)? <antd.Icon style={{ color: 'blue', verticalAlign:'top' }} component={CustomIcons.VerifiedBadge} /> : null}</antd.Tooltip></h1>
|
||||||
<span style={{ fontSize: '14px', fontWeight: '100', lineHeight: '0', marginBottom: '5px' }}>{values.about}</span>
|
<span style={{ fontSize: '14px', fontWeight: '100', lineHeight: '0', marginBottom: '5px' }}>{values.about}</span>
|
||||||
</div>
|
</div>
|
||||||
|
@ -1,15 +1,13 @@
|
|||||||
import React, { Component, Fragment } from 'react';
|
import React, { Component, Fragment } from 'react';
|
||||||
import { List, Icon, Switch, Button, notification } from 'antd';
|
import { List, Icon, Switch, Button, notification } from 'antd';
|
||||||
import Settings from '../../../../globals/settings.js'
|
import { AppSettings } from '../../../../globals/settings.js'
|
||||||
import { DevOptions, ControlBar } from 'ycore'
|
import { DevOptions, ControlBar } from 'ycore'
|
||||||
import update from 'immutability-helper'
|
|
||||||
|
|
||||||
class Base extends Component {
|
class Base extends Component {
|
||||||
constructor(props){
|
constructor(props){
|
||||||
super(props),
|
super(props),
|
||||||
this.state = {
|
this.state = {
|
||||||
SettingRepo: Settings,
|
SettingRepo: AppSettings,
|
||||||
backupSettings: JSON.parse(localStorage.getItem('app_settings')) || Settings,
|
|
||||||
forSave: false
|
forSave: false
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -21,7 +19,6 @@ class Base extends Component {
|
|||||||
}
|
}
|
||||||
SettingRender = data =>{
|
SettingRender = data =>{
|
||||||
try{
|
try{
|
||||||
const {SettingRepo} = this.state
|
|
||||||
return(
|
return(
|
||||||
<List
|
<List
|
||||||
itemLayout="horizontal"
|
itemLayout="horizontal"
|
||||||
@ -43,18 +40,12 @@ class Base extends Component {
|
|||||||
const ListControls = [
|
const ListControls = [
|
||||||
(<div>
|
(<div>
|
||||||
<Button type="done" icon='save' onClick={() => this.saveChanges()} >Save</Button>
|
<Button type="done" icon='save' onClick={() => this.saveChanges()} >Save</Button>
|
||||||
<Button type="dashed" icon="close" shape="circle" onClick={() => this.handleCancel()}></Button>
|
|
||||||
</div>
|
</div>
|
||||||
)
|
)
|
||||||
]
|
]
|
||||||
ControlBar.set(ListControls)
|
ControlBar.set(ListControls)
|
||||||
}
|
}
|
||||||
handleCancel(){
|
|
||||||
const back = this.state.backupSettings;
|
|
||||||
this.setState({ SettingRepo: back, forSave: false})
|
|
||||||
DevOptions.ShowFunctionsLogs? console.log(`Restored ${JSON.stringify(back)}`) : null
|
|
||||||
ControlBar.close()
|
|
||||||
}
|
|
||||||
saveChanges(){
|
saveChanges(){
|
||||||
localStorage.setItem('app_settings', JSON.stringify(this.state.SettingRepo))
|
localStorage.setItem('app_settings', JSON.stringify(this.state.SettingRepo))
|
||||||
this.setState({ forSave: false })
|
this.setState({ forSave: false })
|
||||||
|
Loading…
x
Reference in New Issue
Block a user