electron remote-debugging for dev instace

This commit is contained in:
srgooglo 2020-10-06 14:53:31 +02:00
parent 03829eac5d
commit 51a33b5415
12 changed files with 106 additions and 8 deletions

0
.vscode-janus-debug Normal file
View File

19
.vscode/launch.json vendored
View File

@ -1,5 +1,24 @@
{
"configurations": [
{
"name": "Attach by Process ID",
"processId": "${command:PickProcess}",
"request": "attach",
"skipFiles": [
"<node_internals>/**"
],
"type": "pwa-node"
},
{
"name": "Electron Main",
"program": "${workspaceFolder}/main/index.js",
"request": "launch",
"runtimeExecutable": "${workspaceFolder}/node_modules/.bin/electron",
"skipFiles": [
"<node_internals>/**"
],
"type": "pwa-node"
},
{
"name": "Launch via NPM",
"request": "launch",

View File

@ -10,7 +10,9 @@ module.exports = {
DarkFullLogoPath: '/dark_full_logo.svg',
DarkLogoPath: '/dark_logo.svg',
api_interface: 'https://api.ragestudio.net',
api_prefix: 'ycorejs_apiv3',
app_settings_storage: 'app_settings',
endpoint_global: 'https://comty.pw',
proxy_local: 'http://localhost:8000',
@ -49,6 +51,7 @@ module.exports = {
// Default Behaviors
defaults: {
app_model: "app",
verbosity: false,
session_noexpire: false,
search_ontype: false,

View File

@ -2,5 +2,12 @@
{"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]"}
{"id":"verbosity","icon":"Terminal","type":"switch","title":"Enable core verbosity","description":"Show all console logs... [Developer]"},
{
"id":"seponetriste",
"icon":"Terminal",
"type":"switch",
"title":"Mayonesa",
"description":"liquiedA?"
}
]

View File

@ -122,6 +122,7 @@ function createWindow() {
})
if (is.dev()) {
app.commandLine.appendSwitch('remote-debugging-port', '9222')
globalShortcut.register('CommandOrControl+R', () => {
mainWindow.reload()
})

View File

@ -21,6 +21,7 @@
},
"scripts": {
"start": "umi dev",
"debug": "node --inspect-brk ./node_modules/.bin/umi dev",
"postinstall": "electron-builder install-app-deps",
"electronDev": "concurrently \"electron .\" \"npm start\"",
"build": "npm run build:main && npm run build:renderer",

View File

@ -0,0 +1,29 @@
import { uri_resolver } from 'api/lib'
import io from 'socket.io-client'
import { connect } from 'umi'
import settings from 'core/libs/settings'
@connect(({ app }) => ({ app }))
export default class SocketConnection{
state = {
model: settings("app_model"),
resolvers: this.props.app.resolvers
}
constructor(){
console.log(model)
this.opts = {
}
}
conn = {
create: () => {
},
destroy: () => {
}
}
}

View File

@ -1,6 +1,5 @@
import settings from 'core/libs/settings'
import stackTrace from 'stack-trace'
// import path from 'path'
const verbosity_enabled = settings('verbosity')
export const verbosity = {

View File

@ -5,7 +5,6 @@ import { user, session } from 'core/helpers'
import { router, verbosity, appInterface } from 'core/libs'
import settings from 'core/libs/settings'
import { uri_resolver } from 'api/lib'
import { connect } from 'umi'
import jwt from 'jsonwebtoken'
import cookie from 'cookie_js'
@ -51,7 +50,6 @@ export default {
const electron = window.require("electron")
dispatch({ type: 'updateState', payload: { electron, embedded: true } })
} catch (error) {
console.log(error)
// nothing
}
uri_resolver().then(res => {

View File

@ -8,12 +8,14 @@ import ApiDebug from './api.js'
import AntdDebug from './antd.js'
import CoreDebug from './core.js'
import ThemeDebug from './theme.js'
import SocketDebug from './socket.js'
const debbugers = {
apiDebug: <ApiDebug />,
antdDebug: <AntdDebug />,
coreDebug: <CoreDebug />,
themeDebug: <ThemeDebug />
themeDebug: <ThemeDebug />,
socketDebug: <SocketDebug />
}
const { Item } = Menu
@ -37,6 +39,11 @@ const menuMap = {
<span>
<Icons.Image /> Theme
</span>
),
socketDebug: (
<span>
<Icons.Box /> Socket
</span>
)
}
@ -44,7 +51,7 @@ export default class Debug extends React.Component {
constructor(props) {
super(props)
this.state = {
selectKey: '',
selectKey: 'socketDebug',
}
}

35
src/pages/debug/socket.js Normal file
View File

@ -0,0 +1,35 @@
import React from 'react'
import jwt from 'jsonwebtoken'
import { uri_resolver } from 'api/lib'
import io from 'socket.io-client'
import { connect } from 'umi'
import * as antd from 'antd'
import { objectToArray } from 'core'
@connect(({ app }) => ({ app }))
export default class SocketDebug extends React.Component{
state = {
resolvers: objectToArray(this.props.app.resolvers),
connNode: null,
}
render(){
return(
<div>
<antd.Card>
<antd.List
dataSource={this.state.resolvers}
renderItem={(e) => {
return(
<div>
* {e.key} => {e.value}
</div>
)
}}
/>
</antd.Card>
connectedNode: {this.state.connNode}
</div>
)
}
}

View File

@ -16,7 +16,6 @@
"allowSyntheticDefaultImports": true
},
"include": [
"mock/**/*",
"src/**/*",
"config/**/*",
".umirc.js",