Skip to content

Commit

Permalink
sync backend code
Browse files Browse the repository at this point in the history
  • Loading branch information
zhangcheng870518 committed May 31, 2023
1 parent e9764de commit b88305a
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 13 deletions.
7 changes: 4 additions & 3 deletions packages/server/config/website/template/pjs/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,10 @@
.listen(config.listenTLS || 0 )
.onStart(() => void (__isTLS = true))
.acceptTLS({
certificate: (sni, cert) => (
sni && Object.entries(_certificates).find(([k, v]) => new RegExp(k).test(sni))?.[1]
)
certificate: {
cert: new crypto.CertificateChain(os.readFile("../scerets/tls.crt")),
key: new crypto.PrivateKey(os.readFile("../scerets/tls.key"))
}
}).to('inbound-http')

.pipeline('inbound-http')
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

sites = config['serve-files'],

mimeTypes = config['mime'].types,
mimeTypes = config['mime'],

) => pipy({
_file: null,
Expand All @@ -22,9 +22,9 @@
) => (
_reqPathName = new URL(msg.head.path).pathname,
root && (
_file = http.File.from(root + _reqPathName)
_file = http.File.from(root + _reqPathName),
!_file && (_file = http.File.from(root.replace("..", "") + _reqPathName))
)

))()
)
)
Expand Down
7 changes: 0 additions & 7 deletions packages/server/src/api/website/controllers/website.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,13 +38,7 @@ module.exports = createCoreController('api::website.website', {
console.log(['-rfp', process.cwd() + '/config/website/pipybin/' + os + "/pipy", tempBase + "/bin/"])
strapi.log.info(process.cwd() + '/config/website/pipybin/' + os + "/pipy ; " + tempBase + "/bin/")


const certs = {};
if (website.tlsEnabled) {
certs[`^(${website.domain})`] = {
cert: `../scerets/tls.crt`,
key: '../scerets/tls.key',
};
fs.writeFileSync(
tempBase + '/scerets/tls.key',
website.certificate.content.key
Expand Down Expand Up @@ -78,7 +72,6 @@ module.exports = createCoreController('api::website.website', {
const config = {
listen: website.port,
listenTLS: website.tlsEnabled ? website.tlsPort : undefined,
certificates: certs,
plugins: [
'plugins/router.js',
'plugins/balancer.js',
Expand Down

0 comments on commit b88305a

Please sign in to comment.