mirror of
https://github.com/ragestudio/comty.git
synced 2025-06-09 18:44:16 +00:00
update: stage schema
update: extended model & core std exec
This commit is contained in:
parent
0baa9d048f
commit
1ce023b316
@ -98,7 +98,7 @@ export default [
|
|||||||
{
|
{
|
||||||
id: 'login',
|
id: 'login',
|
||||||
title: 'Signin',
|
title: 'Signin',
|
||||||
icon: <Icons.LogIn style={{ color: '#5390d9', marginRight: '10px' }} />,
|
icon: <Icons.LogIn style={{ color: '#3a86ff', marginRight: '10px' }} />,
|
||||||
attributes: {
|
attributes: {
|
||||||
position: "bottom",
|
position: "bottom",
|
||||||
require: "guest"
|
require: "guest"
|
||||||
|
@ -4,7 +4,7 @@
|
|||||||
"title": "Comty™",
|
"title": "Comty™",
|
||||||
"DevBuild": true,
|
"DevBuild": true,
|
||||||
"version": "0.9.26",
|
"version": "0.9.26",
|
||||||
"stage": "dev-pre",
|
"stage": "dev",
|
||||||
"description": "",
|
"description": "",
|
||||||
"author": "RageStudio",
|
"author": "RageStudio",
|
||||||
"license": "ISC",
|
"license": "ISC",
|
||||||
@ -36,7 +36,7 @@
|
|||||||
"@material-ui/core": "^4.9.9",
|
"@material-ui/core": "^4.9.9",
|
||||||
"@material-ui/icons": "^4.9.1",
|
"@material-ui/icons": "^4.9.1",
|
||||||
"@ragestudio/ycorejs-lib": "^0.1.22",
|
"@ragestudio/ycorejs-lib": "^0.1.22",
|
||||||
"antd": "^4.6.4",
|
"antd": "^4.6.6",
|
||||||
"axios": "^0.19.2",
|
"axios": "^0.19.2",
|
||||||
"babel-core": "^6.26.3",
|
"babel-core": "^6.26.3",
|
||||||
"classnames": "^2.2.6",
|
"classnames": "^2.2.6",
|
||||||
|
@ -167,6 +167,7 @@ export default {
|
|||||||
plugin = {...plugin, ...rootInit}
|
plugin = {...plugin, ...rootInit}
|
||||||
|
|
||||||
const rootClass = plugin.payload
|
const rootClass = plugin.payload
|
||||||
|
let extendedRequire = null
|
||||||
|
|
||||||
class extendedPlugin extends rootClass{
|
class extendedPlugin extends rootClass{
|
||||||
constructor(props){
|
constructor(props){
|
||||||
@ -174,7 +175,34 @@ export default {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
window.PluginGlobals[plugin.uuid] = new extendedPlugin(extended)
|
if( typeof(plugin.requireExtends) !== "undefined" ) {
|
||||||
|
console.log("Extending class with => ", plugin.requireExtends)
|
||||||
|
|
||||||
|
plugin.requireExtends.forEach((e) => {
|
||||||
|
const RequireFrom = e.from
|
||||||
|
const RequireImport = e.import
|
||||||
|
|
||||||
|
const existScheme = typeof(RequireImport) !== "undefined" && typeof(RequireFrom) !== "undefined"
|
||||||
|
if(!existScheme){
|
||||||
|
verbosity.error("Invalid require extension!")
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
|
if (Array.isArray(RequireImport)) {
|
||||||
|
console.log("Require array")
|
||||||
|
RequireImport.forEach((e) => {
|
||||||
|
console.log(`Importing " ${e} " from [ ${RequireFrom} ]`)
|
||||||
|
extendedRequire[e] = require(RequireFrom)
|
||||||
|
})
|
||||||
|
}else{
|
||||||
|
console.log("Require default")
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
window.PluginGlobals[plugin.uuid] = new extendedPlugin({ extended, extendedRequire })
|
||||||
|
|
||||||
appInterface.notify.open({
|
appInterface.notify.open({
|
||||||
message: `${plugin.title} v${plugin.version}`,
|
message: `${plugin.title} v${plugin.version}`,
|
||||||
@ -304,20 +332,20 @@ export default {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
jwt.sign(frame, state.server_key, (err, token) => {
|
jwt.sign(frame, state.server_key, (err, token) => {
|
||||||
if (err) {
|
if (err) {
|
||||||
verbosity.error(err)
|
verbosity.error(err)
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
cookie.set(app_config.session_token_storage, token)
|
cookie.set(app_config.session_token_storage, token)
|
||||||
sessionStorage.setItem(app_config.session_data_storage, btoa(payload.user_data))
|
sessionStorage.setItem(app_config.session_data_storage, btoa(payload.user_data))
|
||||||
state.session_authframe = token
|
state.session_authframe = token
|
||||||
})
|
})
|
||||||
|
|
||||||
appInterface.notify.success('Login done!')
|
appInterface.notify.success('Login done!')
|
||||||
router.push('/')
|
router.push('/')
|
||||||
state.session_valid = true
|
state.session_valid = true
|
||||||
location.reload()
|
location.reload()
|
||||||
},
|
},
|
||||||
handleUpdateData(state){
|
handleUpdateData(state){
|
||||||
const frame = {
|
const frame = {
|
||||||
|
@ -6,6 +6,7 @@ import { router, verbosity, appInterface } from 'core/libs'
|
|||||||
import settings from 'core/libs/settings'
|
import settings from 'core/libs/settings'
|
||||||
import { uri_resolver } from 'api/lib'
|
import { uri_resolver } from 'api/lib'
|
||||||
import { DynamicSDCP } from 'core/libs/extension'
|
import { DynamicSDCP } from 'core/libs/extension'
|
||||||
|
import * as core from 'core'
|
||||||
|
|
||||||
import jwt from 'jsonwebtoken'
|
import jwt from 'jsonwebtoken'
|
||||||
import cookie from 'cookie_js'
|
import cookie from 'cookie_js'
|
||||||
@ -14,9 +15,9 @@ import cookie from 'cookie_js'
|
|||||||
export default {
|
export default {
|
||||||
namespace: 'extended',
|
namespace: 'extended',
|
||||||
state: {
|
state: {
|
||||||
|
modules: { core, settings, verbosity, router, DynamicSDCP },
|
||||||
sidebar: null,
|
sidebar: null,
|
||||||
contextMenu: null,
|
contextMenu: null
|
||||||
core: null
|
|
||||||
},
|
},
|
||||||
subscriptions: {
|
subscriptions: {
|
||||||
setup({ dispatch }) {
|
setup({ dispatch }) {
|
||||||
|
@ -19,10 +19,13 @@ export default class CoreDebug extends React.Component {
|
|||||||
render(){
|
render(){
|
||||||
const handleGenerateUUID = () => { console.log(core.generateUUID()) }
|
const handleGenerateUUID = () => { console.log(core.generateUUID()) }
|
||||||
const handleChange = (e) => { this.setState({ rawPluginInitInput: e.target.value }) }
|
const handleChange = (e) => { this.setState({ rawPluginInitInput: e.target.value }) }
|
||||||
|
const module3TestString = "https://api.ragestudio.net/std/moduleTest3.js"
|
||||||
|
|
||||||
return(
|
return(
|
||||||
<div>
|
<div>
|
||||||
<antd.Button onClick={() => handleGenerateUUID()} >generate uuid</antd.Button>
|
<antd.Button onClick={() => handleGenerateUUID()} >generate uuid</antd.Button>
|
||||||
<antd.Card>
|
<antd.Card>
|
||||||
|
<antd.Button onClick={() => this.setState({ rawPluginInitInput: module3TestString })}> Set MODULE3 TEST </antd.Button>
|
||||||
<antd.Input onChange={handleChange} value={this.state.rawPluginInitInput} placeholder="https://api.ragestudio.net/std/example.js" />
|
<antd.Input onChange={handleChange} value={this.state.rawPluginInitInput} placeholder="https://api.ragestudio.net/std/example.js" />
|
||||||
<antd.Button onClick={() => { this.handleInitPlugin(this.state.rawPluginInitInput) }} > init </antd.Button>
|
<antd.Button onClick={() => { this.handleInitPlugin(this.state.rawPluginInitInput) }} > init </antd.Button>
|
||||||
</antd.Card>
|
</antd.Card>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user