Compare commits
10 Commits
e3a4460b71
...
268189c972
| Author | SHA1 | Date | |
|---|---|---|---|
| 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.
|
# 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/
|
.svn/
|
||||||
.deploy_git/
|
.deploy_git/
|
||||||
.idea/
|
.idea/
|
||||||
.sass-cache/
|
.sass-cache/
|
||||||
|
.wrangler
|
||||||
/test/unit/coverage/
|
/test/unit/coverage/
|
||||||
/test/e2e/reports/
|
/test/e2e/reports/
|
||||||
node_modules/
|
node_modules/
|
||||||
|
*.aab
|
||||||
*.apk
|
*.apk
|
||||||
|
*.ipa
|
||||||
*.min.js
|
*.min.js
|
||||||
*.min.css
|
*.min.css
|
||||||
*.min.html
|
*.min.html
|
||||||
@@ -70,7 +96,6 @@ _desktop.ini
|
|||||||
/db.json
|
/db.json
|
||||||
|
|
||||||
# wo
|
# wo
|
||||||
envar-*.gitignore.js
|
|
||||||
# 服务端
|
# 服务端
|
||||||
/_archive/*
|
/_archive/*
|
||||||
/_datastore/*
|
/_datastore/*
|
||||||
@@ -84,5 +109,5 @@ envar-*.gitignore.js
|
|||||||
package-lock.json
|
package-lock.json
|
||||||
pages4loader.json5
|
pages4loader.json5
|
||||||
|
|
||||||
# 保留
|
### .gitignore.local.txt ###
|
||||||
!.gitkeep
|
|
||||||
|
|||||||
19
package.json
19
package.json
@@ -4,18 +4,10 @@
|
|||||||
"description": "Launch web server",
|
"description": "Launch web server",
|
||||||
"main": "webserver.js",
|
"main": "webserver.js",
|
||||||
"author": "",
|
"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": {
|
"dependencies": {
|
||||||
"body-parser": "^1.18.2",
|
"body-parser": "^1.18.2",
|
||||||
"compression": "^1.7.3",
|
"compression": "^1.7.3",
|
||||||
"cookie-parser": "^1.4.3",
|
"cookie-parser": "^1.4.3",
|
||||||
"deepmerge": "^2.1.1",
|
|
||||||
"errorhandler": "^1.5.0",
|
"errorhandler": "^1.5.0",
|
||||||
"express": "^4.16.2",
|
"express": "^4.16.2",
|
||||||
"http-proxy": "^1.17.0",
|
"http-proxy": "^1.17.0",
|
||||||
@@ -23,13 +15,20 @@
|
|||||||
"morgan": "^1.9.0",
|
"morgan": "^1.9.0",
|
||||||
"serve-favicon": "^2.5.0",
|
"serve-favicon": "^2.5.0",
|
||||||
"vhost": "^3.0.2",
|
"vhost": "^3.0.2",
|
||||||
"wo-base-envar": "git+https://git.faronear.org/npm/wo-base-envar",
|
"wo-base-envar": "git+https://git.tic.cc/npm/wo-base-envar",
|
||||||
"wo-core-toolkit": "git+https://git.faronear.org/npm/wo-core-toolkit"
|
"wo-core-toolkit": "git+https://git.tic.cc/npm/wo-core-toolkit"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"cross-env": "^7.0.2",
|
"cross-env": "^7.0.2",
|
||||||
"nodemon": "^2.0.2",
|
"nodemon": "^2.0.2",
|
||||||
"pm2": "^5.1.2",
|
"pm2": "^5.1.2",
|
||||||
"supervisor": "^0.12.0"
|
"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"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,58 +1,72 @@
|
|||||||
# https://help.seafile.com/syncing_client/excluding_files/
|
# https://help.seafile.com/syncing_client/excluding_files/
|
||||||
# 注释。通配符:* 匹配0到若干个字符,包括代表目录的/。? 匹配1个字符,包括/。
|
# 注释。通配符:* 匹配0到若干个字符,包括代表目录的/。? 匹配1个字符,包括/。
|
||||||
# seafile-ignore.txt 只能控制在客户端需要忽略哪些文件。你依然可以在 seahub 的 web 界面创建这些被客户端忽略的文件。
|
# seafile-ignore.txt 只能控制在客户端需要忽略哪些文件。你依然可以在 seahub 的 web 界面创建这些被客户端忽略的文件。
|
||||||
# 在这种情况下,
|
# 在这种情况下,
|
||||||
# 这些文件会被同步到客户端,但是用户在客户端对这些文件的后续修改会被忽略,不会被同步回服务器。
|
# 这些文件会被同步到客户端,但是用户在客户端对这些文件的后续修改会被忽略,不会被同步回服务器。
|
||||||
# 文件在服务器端的后续更改会被同步到客户端,如果客户端也同时修改了这些文件,系统会生成冲突文件。
|
# 文件在服务器端的后续更改会被同步到客户端,如果客户端也同时修改了这些文件,系统会生成冲突文件。
|
||||||
# seafile-ignore.txt 只能忽略还没有被同步的文件。对于已经被同步的文件,如果后来把它添加到 seafile-ignore.txt 中,系统只会忽略后续更改,已经上传的版本不会受影响。
|
# seafile-ignore.txt 只能忽略还没有被同步的文件。对于已经被同步的文件,如果后来把它添加到 seafile-ignore.txt 中,系统只会忽略后续更改,已经上传的版本不会受影响。
|
||||||
|
|
||||||
# 自定义的后缀名,凡有 sfignore 后缀的都不进行同步
|
### seafile-ignore.global.txt ###
|
||||||
*.sfignore
|
|
||||||
*.sfignore/
|
# 自定义的后缀名,凡有 sfignore 后缀的都不进行同步
|
||||||
|
*.sfignore
|
||||||
.DS_Store
|
*.sfignore/
|
||||||
*/.DS_Store
|
*.sfignore.*
|
||||||
|
*.sfignore.*/
|
||||||
.thumbnails
|
*.sfomit
|
||||||
*/.thumbnails
|
*.sfomit.*
|
||||||
|
*.sfomit/
|
||||||
Thumbs.db
|
*.sfomit.*/
|
||||||
*/Thumbs.db
|
*.nosf
|
||||||
thumbs.db
|
*.nosf.*
|
||||||
*/thumbs.db
|
*.nosf/
|
||||||
|
*.nosf.*/
|
||||||
_desktop.ini
|
|
||||||
*/_desktop.ini
|
.DS_Store
|
||||||
|
*/.DS_Store
|
||||||
._*
|
|
||||||
*/._*
|
.thumbnails
|
||||||
|
*/.thumbnails
|
||||||
.$*
|
|
||||||
*/.$*
|
Thumbs.db
|
||||||
|
*/Thumbs.db
|
||||||
~$*
|
thumbs.db
|
||||||
*/~$*
|
*/thumbs.db
|
||||||
|
|
||||||
node_modules/
|
_desktop.ini
|
||||||
*/node_modules/
|
*/_desktop.ini
|
||||||
package-lock.json
|
|
||||||
|
._*
|
||||||
pages4loader.json5
|
*/._*
|
||||||
|
|
||||||
.svn/
|
.$*
|
||||||
*/.svn/
|
*/.$*
|
||||||
|
|
||||||
.deploy_git/
|
~$*
|
||||||
*/.deploy_git/
|
*/~$*
|
||||||
|
|
||||||
unpackage/dist/
|
node_modules/
|
||||||
*/unpackage/dist/
|
*/node_modules/
|
||||||
|
package-lock.json
|
||||||
unpackage/release/
|
|
||||||
*/unpackage/release/
|
pages4loader.json5
|
||||||
|
|
||||||
unpackage/cache/
|
.deploy_git/
|
||||||
*/unpackage/cache/
|
*/.deploy_git/
|
||||||
|
|
||||||
Icon
|
# HBuilder 目录
|
||||||
OneDrive/Icon
|
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',
|
webProtocol: process.env.NODE_ENV === 'production' ? 'httpall' : 'http',
|
||||||
webHostname: process.env.NODE_ENV === 'production' ? 'unknownhost' : 'localhost',
|
webHostname: process.env.NODE_ENV === 'production' ? 'unknownhost' : 'localhost',
|
||||||
webPort: process.env.NODE_ENV === 'production' ? coretool.PORT_WEB_SERVER_DEV : undefined,
|
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',
|
webIndex: 'index.html',
|
||||||
webSsl:
|
webSsl:
|
||||||
process.env.NODE_ENV === 'production'
|
process.env.NODE_ENV === 'production'
|
||||||
@@ -44,11 +44,9 @@ const wo = (global.wo = {
|
|||||||
if (typeof wo.envar.webSsl === 'string') {
|
if (typeof wo.envar.webSsl === 'string') {
|
||||||
wo.envar.webSsl = eval(`(${wo.envar.webSsl})`)
|
wo.envar.webSsl = eval(`(${wo.envar.webSsl})`)
|
||||||
}
|
}
|
||||||
console.log('\n******** Environment Variables ********')
|
console.log({ _at: new Date().toJSON(), about: '******** Environment Variables ********', envar: JSON.parse(coretool.stringify_by_keyorder(wo.envar)) })
|
||||||
console.log(JSON.parse(coretool.stringify_by_keyorder(wo.envar)))
|
|
||||||
console.log('******** Environment Variables ********\n')
|
|
||||||
;(function serve () {
|
;(function serve () {
|
||||||
console.log('★★★★★★★★ Starting Server ★★★★★★★★')
|
console.log({ _at: new Date().toJSON(), about: '★★★★★★★★ Starting Server ★★★★★★★★' })
|
||||||
|
|
||||||
const server = express()
|
const server = express()
|
||||||
|
|
||||||
@@ -107,9 +105,9 @@ console.log('******** Environment Variables ********\n')
|
|||||||
.createServer(server)
|
.createServer(server)
|
||||||
.listen(portHttp, function (err) {
|
.listen(portHttp, function (err) {
|
||||||
if (err) {
|
if (err) {
|
||||||
console.error(err)
|
console.error({ _at: new Date().toJSON(), err })
|
||||||
} else {
|
} 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) {
|
} else if ('https' === wo.envar.webProtocol) {
|
||||||
@@ -126,9 +124,9 @@ console.log('******** Environment Variables ********\n')
|
|||||||
)
|
)
|
||||||
.listen(portHttps, function (err) {
|
.listen(portHttps, function (err) {
|
||||||
if (err) {
|
if (err) {
|
||||||
console.error(err)
|
console.error({ _at: new Date().toJSON(), err })
|
||||||
} else {
|
} 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) {
|
} else if ('httpall' === wo.envar.webProtocol) {
|
||||||
@@ -136,8 +134,8 @@ console.log('******** Environment Variables ********\n')
|
|||||||
let portHttps = wo.envar.webPort?.portHttps || 443
|
let portHttps = wo.envar.webPort?.portHttps || 443
|
||||||
// if (wo.envar.webSsl.type==='greenlock') {
|
// if (wo.envar.webSsl.type==='greenlock') {
|
||||||
// greenlock.listen(portHttp, portHttps, function (err) {
|
// greenlock.listen(portHttp, portHttps, function (err) {
|
||||||
// if (err) console.error(err)
|
// if (err) console.error({ _at: new Date().toJSON(),err})
|
||||||
// else console.log(`Server listening on [${wo.envar.webProtocol}] http=>https://${wo.envar.webHostname}:${portHttp}=>${portHttps} for ${server.settings.env} environment`)
|
// 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 {
|
// }else {
|
||||||
require('http')
|
require('http')
|
||||||
@@ -147,9 +145,9 @@ console.log('******** Environment Variables ********\n')
|
|||||||
})
|
})
|
||||||
.listen(portHttp, function (err) {
|
.listen(portHttp, function (err) {
|
||||||
if (err) {
|
if (err) {
|
||||||
console.error(err)
|
console.error({ _at: new Date().toJSON(), err })
|
||||||
} else {
|
} 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')
|
webServer = require('https')
|
||||||
@@ -163,9 +161,9 @@ console.log('******** Environment Variables ********\n')
|
|||||||
)
|
)
|
||||||
.listen(portHttps, function (err) {
|
.listen(portHttps, function (err) {
|
||||||
if (err) {
|
if (err) {
|
||||||
console.error(err)
|
console.error({ _at: new Date().toJSON(), err })
|
||||||
} else {
|
} 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) {
|
.listen(portHttp, function (err) {
|
||||||
if (err) {
|
if (err) {
|
||||||
console.error(err)
|
console.error({ _at: new Date().toJSON(), err })
|
||||||
} else {
|
} 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) {
|
} else if ('proxyHttps2Http' === wo.envar.webProtocol) {
|
||||||
@@ -202,9 +200,9 @@ console.log('******** Environment Variables ********\n')
|
|||||||
})
|
})
|
||||||
proxy.listen(portHttps, function (err) {
|
proxy.listen(portHttps, function (err) {
|
||||||
if (err) {
|
if (err) {
|
||||||
console.error(err)
|
console.error({ _at: new Date().toJSON(), err })
|
||||||
} else {
|
} 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