mirror of
https://github.com/hanzozt/console.git
synced 2026-10-30 18:15:39 +00:00
The initial import replaced NetFoundry's copyright notice with Hanzo's in 112 source files rather than retaining it alongside. Apache-2.0 §4(c) requires retaining all copyright and attribution notices from the Source form of the Work; §4(b) requires modified files to carry notice of change. - Restore "Copyright NetFoundry Inc." in all 112 files, adding "Modifications Copyright (c) 2026 Hanzo AI, Inc." to satisfy §4(b). - Add NOTICE crediting github.com/openziti/ziti-console, matching the hanzoai/s3 pattern. - Prepend upstream derivation preamble to LICENSE, same pattern. - Remove the 0-byte LICENSE.md (inherited stub, carries no text). No functional change: every edit lands inside an existing comment block. Co-authored-by: Hanzo Dev <[email protected]>
76 lines
2.6 KiB
JavaScript
76 lines
2.6 KiB
JavaScript
/*
|
|
Copyright NetFoundry Inc.
|
|
Modifications Copyright (c) 2026 Hanzo AI, Inc.
|
|
|
|
Licensed under the Apache License, Version 2.0 (the "License");
|
|
you may not use this file except in compliance with the License.
|
|
You may obtain a copy of the License at
|
|
|
|
https://www.apache.org/licenses/LICENSE-2.0
|
|
|
|
Unless required by applicable law or agreed to in writing, software
|
|
distributed under the License is distributed on an "AS IS" BASIS,
|
|
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
See the License for the specific language governing permissions and
|
|
limitations under the License.
|
|
*/
|
|
|
|
import express from 'express';
|
|
import helmet from 'helmet';
|
|
import cors from 'cors';
|
|
import bodyParser from 'body-parser';
|
|
|
|
const app = express();
|
|
const port = process.env.PORT || 1408;
|
|
|
|
app.use(bodyParser.json());
|
|
app.use(bodyParser.urlencoded({extended:false}));
|
|
|
|
|
|
var corsOptions = {
|
|
origin: '*',
|
|
optionsSuccessStatus: 200,
|
|
}
|
|
var helmetOptions = {
|
|
contentSecurityPolicy: {
|
|
directives: {
|
|
styleSrc: ["'self'", 'openstreetmap.org', "'unsafe-inline'"],
|
|
scriptSrc: ["'self'", 'openstreetmap.org', "'unsafe-inline'", "'unsafe-eval'"],
|
|
scriptSrcAttr: ["'self'", 'openstreetmap.org', "'unsafe-inline'", "'unsafe-eval'"],
|
|
imgSrc: ["'self'", 'openstreetmap.org', 'b.tile.opernstreetmap.org', 'data:', 'blob:', 'https:'],
|
|
frameSrc: ["'self'", 'openstreetmap.org'],
|
|
frameAncestors: ["'self'", 'openstreetmap.org'],
|
|
mediaSrc: ["'self'", 'openstreetmap.org', 'data:', 'blob:', 'https:'],
|
|
connectSrc: ["'self'", '*'],
|
|
},
|
|
},
|
|
frameguard: { action: 'SAMEORIGIN' },
|
|
crossOriginEmbedderPolicy: false
|
|
};
|
|
|
|
app.use(cors(corsOptions));
|
|
app.use(helmet(helmetOptions));
|
|
|
|
app.use('/', express.static('dist/app-zt-console'));
|
|
app.use('/:name', express.static('dist/app-zt-console'));
|
|
app.use('/:name/:id', express.static('dist/app-zt-console'));
|
|
app.use('/:name/:type/:id', express.static('dist/app-zt-console'));
|
|
|
|
let maxAttempts = 100;
|
|
StartServer(port);
|
|
|
|
function StartServer(startupPort) {
|
|
app.listen(startupPort, function() {
|
|
console.log("Zero Trust Console is now listening on port "+startupPort);
|
|
}).on('error', function(err) {
|
|
if (err.code=="EADDRINUSE") {
|
|
maxAttempts--;
|
|
console.log("Port "+startupPort+" In Use, Attempting new port "+(startupPort+1));
|
|
startupPort++;
|
|
if (maxAttempts>0) StartServer(startupPort);
|
|
} else {
|
|
console.log("All Ports in use "+port+" to "+startupPort);
|
|
}
|
|
});
|
|
}
|