mirror of
https://github.com/viarotel-org/escrcpy.git
synced 2024-11-14 10:47:55 +01:00
feat: ✨ Add Affiliated Web Services
This commit is contained in:
parent
c967cb5a1a
commit
009e9d9071
@ -14,6 +14,8 @@ import { icnsLogoPath, icoLogoPath, logoPath } from './configs/index.js'
|
||||
|
||||
import events from './events/index.js'
|
||||
|
||||
import server from './server/index.js'
|
||||
|
||||
log.initialize({ preload: true })
|
||||
|
||||
const debug = !!appStore.get('common.debug')
|
||||
@ -101,6 +103,8 @@ function createWindow() {
|
||||
}
|
||||
|
||||
events(mainWindow)
|
||||
|
||||
server(mainWindow)
|
||||
}
|
||||
|
||||
app.whenReady().then(() => {
|
||||
|
BIN
electron/resources/extra/common/tray/icon.ico
Executable file
BIN
electron/resources/extra/common/tray/icon.ico
Executable file
Binary file not shown.
After Width: | Height: | Size: 22 KiB |
43
electron/server/index.js
Normal file
43
electron/server/index.js
Normal file
@ -0,0 +1,43 @@
|
||||
import { relative } from 'node:path'
|
||||
import { Hono } from 'hono'
|
||||
import { serve } from '@hono/node-server'
|
||||
import { serveStatic } from '@hono/node-server/serve-static'
|
||||
|
||||
export default async (mainWindow) => {
|
||||
const app = new Hono()
|
||||
|
||||
app.notFound((c) => {
|
||||
return c.text('Escrcpy server 404', 404)
|
||||
})
|
||||
|
||||
const VITE_DEV_SERVER_URL = process.env.VITE_DEV_SERVER_URL
|
||||
|
||||
if (VITE_DEV_SERVER_URL) {
|
||||
app.get('/', ctx =>
|
||||
ctx.redirect(`${VITE_DEV_SERVER_URL}server/index.html`),
|
||||
)
|
||||
}
|
||||
else {
|
||||
app.use(
|
||||
'/*',
|
||||
serveStatic({
|
||||
root: relative('./', process.env.DIST),
|
||||
rewriteRequestPath: (path) => {
|
||||
return path.replace(/^\//, '/server')
|
||||
},
|
||||
}),
|
||||
)
|
||||
app.use(
|
||||
'/assets/*',
|
||||
serveStatic({
|
||||
root: relative('./', `${process.env.DIST}/assets/`),
|
||||
rewriteRequestPath: (path) => {
|
||||
console.log('path', path)
|
||||
return path.replace(/^\/assets/, '/')
|
||||
},
|
||||
}),
|
||||
)
|
||||
}
|
||||
|
||||
serve({ fetch: app.fetch, port: 1996 })
|
||||
}
|
@ -25,6 +25,7 @@
|
||||
"@devicefarmer/adbkit": "^3.2.5",
|
||||
"@electron-toolkit/preload": "^2.0.0",
|
||||
"@electron-toolkit/utils": "^2.0.1",
|
||||
"@hono/node-server": "^1.2.3",
|
||||
"@intlify/unplugin-vue-i18n": "^1.4.0",
|
||||
"@viarotel-org/design": "^0.7.0",
|
||||
"@viarotel-org/eslint-config": "^0.7.0",
|
||||
@ -41,6 +42,7 @@
|
||||
"element-plus": "^2.4.2",
|
||||
"fix-path": "^4.0.0",
|
||||
"fs-extra": "^11.1.1",
|
||||
"hono": "^3.10.1",
|
||||
"husky": "^8.0.0",
|
||||
"lodash-es": "^4.17.21",
|
||||
"pinia": "^2.1.7",
|
||||
|
13
server/index.html
Normal file
13
server/index.html
Normal file
@ -0,0 +1,13 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en" class="dark">
|
||||
<head>
|
||||
<meta charset="UTF-8" />
|
||||
<link rel="icon" href="/logo.ico" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||
<title>Escrcpy-Server</title>
|
||||
</head>
|
||||
<body class="">
|
||||
<div id="app"></div>
|
||||
<script type="module" src="main.js"></script>
|
||||
</body>
|
||||
</html>
|
3
server/main.js
Normal file
3
server/main.js
Normal file
@ -0,0 +1,3 @@
|
||||
import { createApp } from 'vue'
|
||||
|
||||
console.log('createApp', createApp)
|
@ -45,4 +45,4 @@ app.mount('#app').$nextTick(() => {
|
||||
postMessage({ payload: 'removeLoading' }, '*')
|
||||
})
|
||||
|
||||
console.log('electron.configs', window.electron.configs)
|
||||
console.log('electron', window.electron)
|
||||
|
@ -31,6 +31,14 @@ const merge = (config, { command = '' } = {}) =>
|
||||
export default params =>
|
||||
merge(
|
||||
defineConfig({
|
||||
build: {
|
||||
rollupOptions: {
|
||||
input: {
|
||||
main: resolve(__dirname, 'index.html'),
|
||||
server: resolve(__dirname, 'server/index.html'),
|
||||
},
|
||||
},
|
||||
},
|
||||
resolve: {
|
||||
alias: {
|
||||
'@': resolve('src'),
|
||||
|
Loading…
Reference in New Issue
Block a user