Compare commits
11 Commits
e3a4460b71
...
main
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
09e9ac6f24 | ||
| 268189c972 | |||
| 0bfceb637e | |||
|
|
fa9fd1a33a | ||
|
|
b458856a04 | ||
|
|
edff320e2b | ||
|
|
e6d2820f47 | ||
|
|
23e4b6f4f3 | ||
|
|
b7d656afe4 | ||
|
|
717a084e35 | ||
|
|
f4e2f87fc9 |
33
.gitignore
vendored
33
.gitignore
vendored
@@ -1,16 +1,42 @@
|
||||
# See https://help.github.com/articles/ignoring-files/ for more about ignoring files.
|
||||
# how to include another gitignore?
|
||||
# https://stackoverflow.com/questions/7005142/can-i-include-other-gitignore-file-in-a-gitignore-file-like-include-in-c-li
|
||||
# https://github.com/github/gitignore
|
||||
# https://github.com/SlideWave/gitignore-include?tab=readme-ov-file#examples
|
||||
# https://gitignore.io
|
||||
|
||||
### 目录 #################################################################
|
||||
### .gitignore.global.txt ###
|
||||
|
||||
# Self defined pattern to ignore
|
||||
?*.gitignore
|
||||
?*.gitignore/
|
||||
?*.gitignore.*
|
||||
?*.gitignore.*/
|
||||
*.gitomit
|
||||
*.gitomit.*
|
||||
*.gitomit/
|
||||
*.gitomit.*/
|
||||
*.nogit
|
||||
*.nogit.*
|
||||
*.nogit/
|
||||
*.nogit.*/
|
||||
# 保留
|
||||
!.gitignore
|
||||
!.gitignore.*
|
||||
!.gitkeep
|
||||
|
||||
# 通用
|
||||
.svn/
|
||||
.deploy_git/
|
||||
.idea/
|
||||
.sass-cache/
|
||||
.wrangler
|
||||
/test/unit/coverage/
|
||||
/test/e2e/reports/
|
||||
node_modules/
|
||||
*.aab
|
||||
*.apk
|
||||
*.ipa
|
||||
*.min.js
|
||||
*.min.css
|
||||
*.min.html
|
||||
@@ -70,7 +96,6 @@ _desktop.ini
|
||||
/db.json
|
||||
|
||||
# wo
|
||||
envar-*.gitignore.js
|
||||
# 服务端
|
||||
/_archive/*
|
||||
/_datastore/*
|
||||
@@ -84,5 +109,5 @@ envar-*.gitignore.js
|
||||
package-lock.json
|
||||
pages4loader.json5
|
||||
|
||||
# 保留
|
||||
!.gitkeep
|
||||
### .gitignore.local.txt ###
|
||||
|
||||
|
||||
19
package.json
19
package.json
@@ -4,18 +4,10 @@
|
||||
"description": "Launch web server",
|
||||
"main": "webserver.js",
|
||||
"author": "",
|
||||
"scripts": {
|
||||
"preping": "npx cross-env NODE_ENV=development npx nodemon webserver.js",
|
||||
"preping-pm2": "npx cross-env NODE_ENV=development npx pm2 start webserver.js",
|
||||
"proding": "npx cross-env NODE_ENV=production npx nodemon webserver.js",
|
||||
"proding-pm2": "npx cross-env NODE_ENV=production npx pm2 start webserver.js",
|
||||
"proding-sup": "npx cross-env NODE_ENV=production npx supervisor -i node_modules,_webroot -- webserver.js"
|
||||
},
|
||||
"dependencies": {
|
||||
"body-parser": "^1.18.2",
|
||||
"compression": "^1.7.3",
|
||||
"cookie-parser": "^1.4.3",
|
||||
"deepmerge": "^2.1.1",
|
||||
"errorhandler": "^1.5.0",
|
||||
"express": "^4.16.2",
|
||||
"http-proxy": "^1.17.0",
|
||||
@@ -23,13 +15,20 @@
|
||||
"morgan": "^1.9.0",
|
||||
"serve-favicon": "^2.5.0",
|
||||
"vhost": "^3.0.2",
|
||||
"wo-base-envar": "git+https://git.faronear.org/npm/wo-base-envar",
|
||||
"wo-core-toolkit": "git+https://git.faronear.org/npm/wo-core-toolkit"
|
||||
"wo-base-envar": "git+https://git.tic.cc/open/wo-base-envar",
|
||||
"wo-core-toolkit": "git+https://git.tic.cc/open/wo-core-toolkit"
|
||||
},
|
||||
"devDependencies": {
|
||||
"cross-env": "^7.0.2",
|
||||
"nodemon": "^2.0.2",
|
||||
"pm2": "^5.1.2",
|
||||
"supervisor": "^0.12.0"
|
||||
},
|
||||
"scripts": {
|
||||
"serving-dev-nodemon": "npx cross-env NODE_ENV=development npx nodemon webserver.js",
|
||||
"serving-dev-pm2": "npx cross-env NODE_ENV=development npx pm2 start webserver.js",
|
||||
"serving-prod-nodemon": "npx cross-env NODE_ENV=production npx nodemon webserver.js",
|
||||
"serving-prod-pm2": "npx cross-env NODE_ENV=production npx pm2 start webserver.js",
|
||||
"serving-prod-sup": "npx cross-env NODE_ENV=production npx supervisor -i node_modules,_webroot -- webserver.js"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -6,9 +6,27 @@
|
||||
# 文件在服务器端的后续更改会被同步到客户端,如果客户端也同时修改了这些文件,系统会生成冲突文件。
|
||||
# seafile-ignore.txt 只能忽略还没有被同步的文件。对于已经被同步的文件,如果后来把它添加到 seafile-ignore.txt 中,系统只会忽略后续更改,已经上传的版本不会受影响。
|
||||
|
||||
### seafile-ignore.global.txt ###
|
||||
|
||||
# 自定义的后缀名,凡有 sfignore 后缀的都不进行同步
|
||||
*.sfignore
|
||||
*.sfignore/
|
||||
*.sfignore.*
|
||||
*.sfignore.*/
|
||||
*.sfomit
|
||||
*.sfomit.*
|
||||
*.sfomit/
|
||||
*.sfomit.*/
|
||||
*.nosf
|
||||
*.nosf.*
|
||||
*.nosf/
|
||||
*.nosf.*/
|
||||
|
||||
## everything 'git pull or fetch' will update `.git/FETCH_HEAD`, even if the content doesn't change. To avoid too many useless updates of this file in Seafile history:
|
||||
FETCH_HEAD
|
||||
*/FETCH_HEAD
|
||||
|
||||
.Trash/
|
||||
|
||||
.DS_Store
|
||||
*/.DS_Store
|
||||
@@ -36,23 +54,31 @@ _desktop.ini
|
||||
node_modules/
|
||||
*/node_modules/
|
||||
package-lock.json
|
||||
*/package-lock.json
|
||||
|
||||
pages4loader.json5
|
||||
|
||||
.svn/
|
||||
*/.svn/
|
||||
*/pages4loader.json5
|
||||
|
||||
.deploy_git/
|
||||
*/.deploy_git/
|
||||
|
||||
unpackage/dist/
|
||||
*/unpackage/dist/
|
||||
# next.js 项目
|
||||
.next/
|
||||
*/.next/
|
||||
|
||||
unpackage/release/
|
||||
*/unpackage/release/
|
||||
|
||||
unpackage/cache/
|
||||
*/unpackage/cache/
|
||||
# HBuilder 目录
|
||||
unpackage/
|
||||
*/unpackage/
|
||||
|
||||
Icon
|
||||
OneDrive/Icon
|
||||
|
||||
# wrangler project
|
||||
|
||||
.dev.vars*
|
||||
*/.dev.vars*
|
||||
.wrangler/
|
||||
*/.wrangler/
|
||||
|
||||
### seafile-ignore.local.txt ###
|
||||
|
||||
|
||||
36
webserver.js
36
webserver.js
@@ -18,7 +18,7 @@ const wo = (global.wo = {
|
||||
webProtocol: process.env.NODE_ENV === 'production' ? 'httpall' : 'http',
|
||||
webHostname: process.env.NODE_ENV === 'production' ? 'unknownhost' : 'localhost',
|
||||
webPort: process.env.NODE_ENV === 'production' ? coretool.PORT_WEB_SERVER_DEV : undefined,
|
||||
webRoot: process.env.NODE_ENV === 'production' ? '_webroot' : '_webroot', // local path to serve as webroot. 'unpackage/dist/build/h5'
|
||||
webRoot: process.env.NODE_ENV === 'production' ? '_webroot' : 'unpackage/dist/build/web', // local path to serve as webroot. 'unpackage/dist/build/h5'
|
||||
webIndex: 'index.html',
|
||||
webSsl:
|
||||
process.env.NODE_ENV === 'production'
|
||||
@@ -44,11 +44,9 @@ const wo = (global.wo = {
|
||||
if (typeof wo.envar.webSsl === 'string') {
|
||||
wo.envar.webSsl = eval(`(${wo.envar.webSsl})`)
|
||||
}
|
||||
console.log('\n******** Environment Variables ********')
|
||||
console.log(JSON.parse(coretool.stringify_by_keyorder(wo.envar)))
|
||||
console.log('******** Environment Variables ********\n')
|
||||
console.log({ _at: new Date().toJSON(), about: '******** Environment Variables ********', envar: JSON.parse(coretool.stringify_by_keyorder(wo.envar)) })
|
||||
;(function serve () {
|
||||
console.log('★★★★★★★★ Starting Server ★★★★★★★★')
|
||||
console.log({ _at: new Date().toJSON(), about: '★★★★★★★★ Starting Server ★★★★★★★★' })
|
||||
|
||||
const server = express()
|
||||
|
||||
@@ -107,9 +105,9 @@ console.log('******** Environment Variables ********\n')
|
||||
.createServer(server)
|
||||
.listen(portHttp, function (err) {
|
||||
if (err) {
|
||||
console.error(err)
|
||||
console.error({ _at: new Date().toJSON(), err })
|
||||
} else {
|
||||
console.log({ time: new Date().toJSON() }, `Server listening on ${wo.envar.webProtocol}://${wo.envar.webHostname}:${portHttp}`)
|
||||
console.log({ _at: new Date().toJSON(), about: `Server listening on ${wo.envar.webProtocol}://${wo.envar.webHostname}:${portHttp}` })
|
||||
}
|
||||
})
|
||||
} else if ('https' === wo.envar.webProtocol) {
|
||||
@@ -126,9 +124,9 @@ console.log('******** Environment Variables ********\n')
|
||||
)
|
||||
.listen(portHttps, function (err) {
|
||||
if (err) {
|
||||
console.error(err)
|
||||
console.error({ _at: new Date().toJSON(), err })
|
||||
} else {
|
||||
console.log({ time: new Date().toJSON() }, `Server listening on ${wo.envar.webProtocol}://${wo.envar.webHostname}:${portHttps}`)
|
||||
console.log({ _at: new Date().toJSON(), about: `Server listening on ${wo.envar.webProtocol}://${wo.envar.webHostname}:${portHttps}` })
|
||||
}
|
||||
})
|
||||
} else if ('httpall' === wo.envar.webProtocol) {
|
||||
@@ -136,8 +134,8 @@ console.log('******** Environment Variables ********\n')
|
||||
let portHttps = wo.envar.webPort?.portHttps || 443
|
||||
// if (wo.envar.webSsl.type==='greenlock') {
|
||||
// greenlock.listen(portHttp, portHttps, function (err) {
|
||||
// if (err) console.error(err)
|
||||
// else console.log(`Server listening on [${wo.envar.webProtocol}] http=>https://${wo.envar.webHostname}:${portHttp}=>${portHttps} for ${server.settings.env} environment`)
|
||||
// if (err) console.error({ _at: new Date().toJSON(),err})
|
||||
// else console.log({ _at: new Date().toJSON(), about: `Server listening on [${wo.envar.webProtocol}] http=>https://${wo.envar.webHostname}:${portHttp}=>${portHttps} for ${server.settings.env} environment`})
|
||||
// })
|
||||
// }else {
|
||||
require('http')
|
||||
@@ -147,9 +145,9 @@ console.log('******** Environment Variables ********\n')
|
||||
})
|
||||
.listen(portHttp, function (err) {
|
||||
if (err) {
|
||||
console.error(err)
|
||||
console.error({ _at: new Date().toJSON(), err })
|
||||
} else {
|
||||
console.log({ time: new Date().toJSON() }, `Server redirecting from http://${wo.envar.webHostname}:${portHttp}`)
|
||||
console.log({ _at: new Date().toJSON(), about: `Server redirecting from http://${wo.envar.webHostname}:${portHttp}` })
|
||||
}
|
||||
})
|
||||
webServer = require('https')
|
||||
@@ -163,9 +161,9 @@ console.log('******** Environment Variables ********\n')
|
||||
)
|
||||
.listen(portHttps, function (err) {
|
||||
if (err) {
|
||||
console.error(err)
|
||||
console.error({ _at: new Date().toJSON(), err })
|
||||
} else {
|
||||
console.log({ time: new Date().toJSON() }, `Server listening on https://${wo.envar.webHostname}:${portHttps}`)
|
||||
console.log({ _at: new Date().toJSON(), about: `Server listening on https://${wo.envar.webHostname}:${portHttps}` })
|
||||
}
|
||||
})
|
||||
// }
|
||||
@@ -178,9 +176,9 @@ console.log('******** Environment Variables ********\n')
|
||||
})
|
||||
.listen(portHttp, function (err) {
|
||||
if (err) {
|
||||
console.error(err)
|
||||
console.error({ _at: new Date().toJSON(), err })
|
||||
} else {
|
||||
console.log({ time: new Date().toJSON() }, `Server listening on ${wo.envar.webProtocol}://${wo.envar.webHostname}:${portHttp}`)
|
||||
console.log({ _at: new Date().toJSON(), about: `Server listening on ${wo.envar.webProtocol}://${wo.envar.webHostname}:${portHttp}` })
|
||||
}
|
||||
})
|
||||
} else if ('proxyHttps2Http' === wo.envar.webProtocol) {
|
||||
@@ -202,9 +200,9 @@ console.log('******** Environment Variables ********\n')
|
||||
})
|
||||
proxy.listen(portHttps, function (err) {
|
||||
if (err) {
|
||||
console.error(err)
|
||||
console.error({ _at: new Date().toJSON(), err })
|
||||
} else {
|
||||
console.log({ time: new Date().toJSON() }, `Server listening on ${wo.envar.webProtocol}://${wo.envar.webHostname}:${portHttps}`)
|
||||
console.log({ _at: new Date().toJSON(), about: `Server listening on ${wo.envar.webProtocol}://${wo.envar.webHostname}:${portHttps}` })
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user