First build
Some checks failed
Client Admin / build-deploy (push) Failing after 8s
Client Client / build-deploy (push) Failing after 3s
Client Registration / build-deploy (push) Failing after 20s
Client Tech / build-deploy (push) Failing after 1s
Client Home / build-deploy (push) Successful in 14s
Some checks failed
Client Admin / build-deploy (push) Failing after 8s
Client Client / build-deploy (push) Failing after 3s
Client Registration / build-deploy (push) Failing after 20s
Client Tech / build-deploy (push) Failing after 1s
Client Home / build-deploy (push) Successful in 14s
This commit is contained in:
1
wwwroot/hostingstart.html
Normal file
1
wwwroot/hostingstart.html
Normal file
@@ -0,0 +1 @@
|
||||
<!DOCTYPE html><html lang="en"><head><meta charset="utf-8"/><meta name="viewport" content="width=device-width, initial-scale=1.0"/><meta http-equiv="X-UA-Compatible" content="IE=edge"/><title>Microsoft Azure App Service - Welcome</title><link rel="shortcut icon" href="https://appservice.azureedge.net/images/app-service/v4/favicon.ico" type="image/x-icon"/><link href="https://appservice.azureedge.net/css/app-service/v4/bootstrap.min.css" rel="stylesheet" crossorigin="anonymous"/><style>html, body{height: 100%; background-color: #ffffff; color: #000000; font-size: 13px;}*{border-radius: 0 !important;}</style><script src="https://appservice.azureedge.net/js/app-service/v4/loc.min.js" crossorigin="anonymous"></script><script type="text/javascript">window.onload=function (){try{var a=window.location.hostname; if (a.includes(".azurewebsites.net")){a=a.replace(".azurewebsites.net", "")};var b=document.getElementById("depCenterLink"); b.setAttribute("href", b.getAttribute("href") + "&sitename=" + a); loc()}catch (d){}}</script></head><body><nav class="navbar"><div class="navbar-brand "><div class="container pl-4 ml-5"><img src="https://appservice.azureedge.net/images/app-service/v4/azurelogo.svg" width="270" height="108" alt=""/></div></div></nav><div class="container-fluid mr-2 mt-5 pt-5"><div class="row"><div class="col-xs-12 col-sm-12 d-block d-lg-none d-xl-none d-md-block d-sm-block d-xs-block"><div class="text-center"><img src="https://appservice.azureedge.net/images/app-service/v4/web.svg"/></div></div><div class="pl-5 ml-5 col-xl-5 col-lg-5 col-md-10 col-sm-11 col-xs-11"><div class="container-fluid"><div class="row"><h2 id="upRunning">Your web app is running and waiting for your content</h2></div><div class="row mt-4 pt-4"><div id="appIsLive" style="font-size:16px;width: 516px;">Your web app is live, but we don’t have your content yet. If you’ve already deployed, it could take up to 5 minutes for your content to show up, so come back soon.</div></div><div class="row mt-4"><h5 class="mt-5"><img src="https://appservice.azureedge.net/images/app-service/v4/code.svg"/><span id="supporting">Supporting Node.js, Java, .NET and more</span></h5></div></div></div><div class="col-xl-5 col-lg-5 col-md-12 d-none d-lg-block"><div class="text-left"><img src="https://appservice.azureedge.net/images/app-service/v4/web.svg"/></div></div><div class="col-xl-1 col-lg-1 col-md-1"></div></div><div class="row mt-4"><div class="container-fluid"><div class="row mt-3"><div class="pl-5 ml-5 col-md-2 mt-4"><p><span id="haventDeployed">Haven’t deployed yet?</span><br/><span id="useDCenter">Use the deployment center to publish code or set up continuous deployment.</span><br/><a id="depCenterLink" href="https://go.microsoft.com/fwlink/?linkid=2057852"><button class="btn btn-primary mt-4" type="submit" id="deplCenter">Deployment center</button></a></p></div><div class="pl-5 ml-5 col-md-2 mt-4"><p><span id="newWebSite">Starting a new web site?</span><br/><span id="followQS">Follow our Quickstart guide to get a web app ready quickly.</span><br/><a href="https://go.microsoft.com/fwlink/?linkid=2084231"><button class="btn btn-primary mt-4" type="submit" id="quickStart">Quickstart</button></a></p></div></div></div></div></div></body></html>
|
||||
199
wwwroot/server.js
Normal file
199
wwwroot/server.js
Normal file
@@ -0,0 +1,199 @@
|
||||
const http = require('http');
|
||||
const fs = require('fs');
|
||||
const fsp = require('fs/promises');
|
||||
const path = require('path');
|
||||
const { URL } = require('url');
|
||||
|
||||
// Azure sets PORT
|
||||
const PORT = process.env.PORT || 8080;
|
||||
|
||||
// Default site if host doesn't map
|
||||
const DEFAULT_SITE = 'default';
|
||||
|
||||
// Explicit host ? folder mapping
|
||||
const HOST_MAP = {
|
||||
'adpadmin.usimdev.com': 'admin',
|
||||
'adpclient.usimdev.com': 'client',
|
||||
'adpregist.usimdev.com': 'regist',
|
||||
'adptestapi.usimdev.com': 'testapi',
|
||||
'localhost': 'default'
|
||||
};
|
||||
|
||||
const server = http.createServer(async (req, res) => {
|
||||
try {
|
||||
const hostHeader = (req.headers.host || '').toLowerCase();
|
||||
console.log(`[SRV ${new Date().toISOString()}] ${req.method} ${req.url} (Host: ${hostHeader})`);
|
||||
|
||||
// Parse URL with WHATWG API (avoids url.parse deprecation)
|
||||
const parsedUrl = new URL(req.url || '/', `http://${hostHeader || 'localhost'}`);
|
||||
const pathname = decodeURIComponent(parsedUrl.pathname || '/');
|
||||
const parts = pathname.replace(/^\/+/, '').split('/');
|
||||
const firstSegment = parts[0] || '';
|
||||
|
||||
// Decide which site folder to serve from
|
||||
const siteFolder = getSiteFolder(hostHeader);
|
||||
const BASEDIR = path.join(__dirname, 'websites', siteFolder);
|
||||
|
||||
console.log(`Site folder resolved: /websites/${siteFolder} (host=${hostHeader})`);
|
||||
|
||||
// --- favicon special case ---
|
||||
if (firstSegment === 'favicon.ico') {
|
||||
const favPath = safeJoin(BASEDIR, 'favicon.ico');
|
||||
if (await exists(favPath)) {
|
||||
res.writeHead(200, { 'Content-Type': 'image/x-icon' });
|
||||
return fs.createReadStream(favPath).pipe(res);
|
||||
} else {
|
||||
res.writeHead(204);
|
||||
return res.end();
|
||||
}
|
||||
}
|
||||
|
||||
// --- robots.txt (optional per-site) ---
|
||||
if (firstSegment === 'robots.txt') {
|
||||
const robotsPath = safeJoin(BASEDIR, 'robots.txt');
|
||||
if (await exists(robotsPath)) {
|
||||
res.writeHead(200, { 'Content-Type': 'text/plain' });
|
||||
return fs.createReadStream(robotsPath).pipe(res);
|
||||
}
|
||||
// no robots for this site ? 404
|
||||
res.writeHead(404, { 'Content-Type': 'text/plain' });
|
||||
return res.end('Not found');
|
||||
}
|
||||
|
||||
// Static file resolution
|
||||
let requested = firstSegment || 'index.html';
|
||||
if (parts.length > 1) {
|
||||
requested = parts.join('/');
|
||||
}
|
||||
|
||||
let filePath = safeJoin(BASEDIR, requested);
|
||||
|
||||
if (await isDir(filePath)) {
|
||||
filePath = safeJoin(filePath, 'index.html');
|
||||
}
|
||||
|
||||
// Handle Index.html vs index.html (case difference on dev machines)
|
||||
if (!(await exists(filePath)) && /Index\.html$/.test(filePath)) {
|
||||
const alt = filePath.replace(/Index\.html$/, 'index.html');
|
||||
if (await exists(alt)) filePath = alt;
|
||||
}
|
||||
|
||||
// If the requested file doesn't exist:
|
||||
// 1) try this site's index.html (SPA routing)
|
||||
// 2) try shared 404.html in root
|
||||
if (!(await exists(filePath))) {
|
||||
const siteIndex = safeJoin(BASEDIR, 'index.html');
|
||||
if (await exists(siteIndex)) {
|
||||
res.writeHead(200, { 'Content-Type': 'text/html' });
|
||||
return fs.createReadStream(siteIndex).pipe(res);
|
||||
}
|
||||
|
||||
const shared404 = path.join(__dirname, '404.html');
|
||||
if (await exists(shared404)) {
|
||||
res.writeHead(404, { 'Content-Type': 'text/html' });
|
||||
return fs.createReadStream(shared404).pipe(res);
|
||||
}
|
||||
|
||||
res.writeHead(404, { 'Content-Type': 'text/plain' });
|
||||
return res.end('404 Not Found');
|
||||
}
|
||||
|
||||
// Serve the static file
|
||||
res.writeHead(200, { 'Content-Type': getType(filePath) });
|
||||
return fs.createReadStream(filePath).pipe(res);
|
||||
|
||||
} catch (err) {
|
||||
console.error('[SERVER ERROR]', err);
|
||||
res.writeHead(500, { 'Content-Type': 'application/json' });
|
||||
return res.end(JSON.stringify({ status: 'error', error: err?.message || String(err) }));
|
||||
}
|
||||
});
|
||||
|
||||
server.listen(PORT, () => {
|
||||
console.log('===========================================');
|
||||
console.log(`Static HTTP server listening on ${PORT}`);
|
||||
console.log(`Default site: /websites/${DEFAULT_SITE}/`);
|
||||
console.log('Host mappings:');
|
||||
Object.entries(HOST_MAP).forEach(([host, folder]) => {
|
||||
console.log(` ${host} ? /websites/${folder}/`);
|
||||
});
|
||||
console.log('Fallback (subdomain): sub.domain.tld ? /websites/<sub>/');
|
||||
console.log('Shared 404 (optional): /404.html');
|
||||
console.log('===========================================');
|
||||
});
|
||||
|
||||
module.exports = server;
|
||||
|
||||
/* ------------ helpers ------------ */
|
||||
|
||||
function getSiteFolder(hostnameRaw) {
|
||||
if (!hostnameRaw) return DEFAULT_SITE;
|
||||
|
||||
const hostname = hostnameRaw.toLowerCase();
|
||||
|
||||
// 1) Explicit map wins
|
||||
if (HOST_MAP[hostname]) {
|
||||
return HOST_MAP[hostname];
|
||||
}
|
||||
|
||||
// 2) localhost or IP ? default
|
||||
if (hostname === 'localhost' || /^\d+\.\d+\.\d+\.\d+$/.test(hostname)) {
|
||||
return DEFAULT_SITE;
|
||||
}
|
||||
|
||||
// 3) For multi-tenant subdomains: foo.example.com ? "foo"
|
||||
const parts = hostname.split('.');
|
||||
if (parts.length >= 3) {
|
||||
return parts[0];
|
||||
}
|
||||
|
||||
// 4) Anything else ? default
|
||||
return DEFAULT_SITE;
|
||||
}
|
||||
|
||||
function safeJoin(base, target) {
|
||||
const resolved = path.resolve(base, target);
|
||||
if (!resolved.startsWith(base)) {
|
||||
// Prevent directory traversal – fall back to base
|
||||
return base;
|
||||
}
|
||||
return resolved;
|
||||
}
|
||||
|
||||
async function exists(p) {
|
||||
try {
|
||||
await fsp.access(p, fs.constants.R_OK);
|
||||
return true;
|
||||
} catch {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
async function isDir(p) {
|
||||
try {
|
||||
return (await fsp.stat(p)).isDirectory();
|
||||
} catch {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
function getType(filename) {
|
||||
const ext = path.extname(filename).toLowerCase();
|
||||
switch (ext) {
|
||||
case '.html': return 'text/html';
|
||||
case '.css': return 'text/css';
|
||||
case '.js': return 'application/javascript';
|
||||
case '.png': return 'image/png';
|
||||
case '.jpg':
|
||||
case '.jpeg': return 'image/jpeg';
|
||||
case '.svg': return 'image/svg+xml';
|
||||
case '.ico': return 'image/x-icon';
|
||||
case '.json': return 'application/json';
|
||||
case '.map': return 'application/json';
|
||||
case '.woff2': return 'font/woff2';
|
||||
case '.woff': return 'font/woff';
|
||||
case '.ttf': return 'font/ttf';
|
||||
case '.eot': return 'application/vnd.ms-fontobject';
|
||||
default: return 'text/plain';
|
||||
}
|
||||
}
|
||||
2
wwwroot/websites/admin/bundle.js
Normal file
2
wwwroot/websites/admin/bundle.js
Normal file
File diff suppressed because one or more lines are too long
47
wwwroot/websites/admin/bundle.js.LICENSE.txt
Normal file
47
wwwroot/websites/admin/bundle.js.LICENSE.txt
Normal file
@@ -0,0 +1,47 @@
|
||||
/*! @azure/msal-browser v3.30.0 2025-08-05 */
|
||||
|
||||
/*! @azure/msal-common v14.16.1 2025-08-05 */
|
||||
|
||||
/*! @azure/msal-react v2.2.0 2024-11-05 */
|
||||
|
||||
/*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/babel/babel/blob/main/packages/babel-helpers/LICENSE */
|
||||
|
||||
/**
|
||||
* @license React
|
||||
* react-dom.production.min.js
|
||||
*
|
||||
* Copyright (c) Facebook, Inc. and its affiliates.
|
||||
*
|
||||
* This source code is licensed under the MIT license found in the
|
||||
* LICENSE file in the root directory of this source tree.
|
||||
*/
|
||||
|
||||
/**
|
||||
* @license React
|
||||
* react-jsx-runtime.production.min.js
|
||||
*
|
||||
* Copyright (c) Facebook, Inc. and its affiliates.
|
||||
*
|
||||
* This source code is licensed under the MIT license found in the
|
||||
* LICENSE file in the root directory of this source tree.
|
||||
*/
|
||||
|
||||
/**
|
||||
* @license React
|
||||
* react.production.min.js
|
||||
*
|
||||
* Copyright (c) Facebook, Inc. and its affiliates.
|
||||
*
|
||||
* This source code is licensed under the MIT license found in the
|
||||
* LICENSE file in the root directory of this source tree.
|
||||
*/
|
||||
|
||||
/**
|
||||
* @license React
|
||||
* scheduler.production.min.js
|
||||
*
|
||||
* Copyright (c) Facebook, Inc. and its affiliates.
|
||||
*
|
||||
* This source code is licensed under the MIT license found in the
|
||||
* LICENSE file in the root directory of this source tree.
|
||||
*/
|
||||
1
wwwroot/websites/admin/index.html
Normal file
1
wwwroot/websites/admin/index.html
Normal file
@@ -0,0 +1 @@
|
||||
<!doctype html><html lang="en"><head><meta charset="UTF-8"><meta name="viewport" content="width=device-width,initial-scale=1"><title>AdPlatform Management</title><link rel="preconnect" href="https://fonts.googleapis.com"><link rel="preconnect" href="https://fonts.gstatic.com" crossorigin><link href="https://fonts.googleapis.com/css2?family=DM+Sans:wght@400;500;600;700&display=swap" rel="stylesheet"></head><body><div id="root"></div><script defer="defer" src="bundle.js"></script></body></html>
|
||||
2
wwwroot/websites/client/bundle.js
Normal file
2
wwwroot/websites/client/bundle.js
Normal file
File diff suppressed because one or more lines are too long
47
wwwroot/websites/client/bundle.js.LICENSE.txt
Normal file
47
wwwroot/websites/client/bundle.js.LICENSE.txt
Normal file
@@ -0,0 +1,47 @@
|
||||
/*! @azure/msal-browser v3.30.0 2025-08-05 */
|
||||
|
||||
/*! @azure/msal-common v14.16.1 2025-08-05 */
|
||||
|
||||
/*! @azure/msal-react v2.2.0 2024-11-05 */
|
||||
|
||||
/*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/babel/babel/blob/main/packages/babel-helpers/LICENSE */
|
||||
|
||||
/**
|
||||
* @license React
|
||||
* react-dom.production.min.js
|
||||
*
|
||||
* Copyright (c) Facebook, Inc. and its affiliates.
|
||||
*
|
||||
* This source code is licensed under the MIT license found in the
|
||||
* LICENSE file in the root directory of this source tree.
|
||||
*/
|
||||
|
||||
/**
|
||||
* @license React
|
||||
* react-jsx-runtime.production.min.js
|
||||
*
|
||||
* Copyright (c) Facebook, Inc. and its affiliates.
|
||||
*
|
||||
* This source code is licensed under the MIT license found in the
|
||||
* LICENSE file in the root directory of this source tree.
|
||||
*/
|
||||
|
||||
/**
|
||||
* @license React
|
||||
* react.production.min.js
|
||||
*
|
||||
* Copyright (c) Facebook, Inc. and its affiliates.
|
||||
*
|
||||
* This source code is licensed under the MIT license found in the
|
||||
* LICENSE file in the root directory of this source tree.
|
||||
*/
|
||||
|
||||
/**
|
||||
* @license React
|
||||
* scheduler.production.min.js
|
||||
*
|
||||
* Copyright (c) Facebook, Inc. and its affiliates.
|
||||
*
|
||||
* This source code is licensed under the MIT license found in the
|
||||
* LICENSE file in the root directory of this source tree.
|
||||
*/
|
||||
1
wwwroot/websites/client/index.html
Normal file
1
wwwroot/websites/client/index.html
Normal file
@@ -0,0 +1 @@
|
||||
<!doctype html><html lang="en"><head><meta charset="UTF-8"/><meta name="viewport" content="width=device-width,initial-scale=1"/><title>AdPlatform</title><link rel="preconnect" href="https://fonts.googleapis.com"/><link href="https://fonts.googleapis.com/css2?family=DM+Sans:wght@400;500;600;700&display=swap" rel="stylesheet"/><script defer="defer" src="/bundle.js"></script></head><body><div id="root"></div></body></html>
|
||||
2
wwwroot/websites/regist/bundle.js
Normal file
2
wwwroot/websites/regist/bundle.js
Normal file
File diff suppressed because one or more lines are too long
41
wwwroot/websites/regist/bundle.js.LICENSE.txt
Normal file
41
wwwroot/websites/regist/bundle.js.LICENSE.txt
Normal file
@@ -0,0 +1,41 @@
|
||||
/*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/babel/babel/blob/main/packages/babel-helpers/LICENSE */
|
||||
|
||||
/**
|
||||
* @license React
|
||||
* react-dom.production.min.js
|
||||
*
|
||||
* Copyright (c) Facebook, Inc. and its affiliates.
|
||||
*
|
||||
* This source code is licensed under the MIT license found in the
|
||||
* LICENSE file in the root directory of this source tree.
|
||||
*/
|
||||
|
||||
/**
|
||||
* @license React
|
||||
* react-jsx-runtime.production.min.js
|
||||
*
|
||||
* Copyright (c) Facebook, Inc. and its affiliates.
|
||||
*
|
||||
* This source code is licensed under the MIT license found in the
|
||||
* LICENSE file in the root directory of this source tree.
|
||||
*/
|
||||
|
||||
/**
|
||||
* @license React
|
||||
* react.production.min.js
|
||||
*
|
||||
* Copyright (c) Facebook, Inc. and its affiliates.
|
||||
*
|
||||
* This source code is licensed under the MIT license found in the
|
||||
* LICENSE file in the root directory of this source tree.
|
||||
*/
|
||||
|
||||
/**
|
||||
* @license React
|
||||
* scheduler.production.min.js
|
||||
*
|
||||
* Copyright (c) Facebook, Inc. and its affiliates.
|
||||
*
|
||||
* This source code is licensed under the MIT license found in the
|
||||
* LICENSE file in the root directory of this source tree.
|
||||
*/
|
||||
1
wwwroot/websites/regist/index.html
Normal file
1
wwwroot/websites/regist/index.html
Normal file
@@ -0,0 +1 @@
|
||||
<!doctype html><html lang="en"><head><meta charset="UTF-8"/><meta name="viewport" content="width=device-width,initial-scale=1"/><title>AdPlatform — Get Started</title><link rel="preconnect" href="https://fonts.googleapis.com"/><link rel="preconnect" href="https://fonts.gstatic.com" crossorigin/><link href="https://fonts.googleapis.com/css2?family=DM+Sans:wght@400;500;600;700&display=swap" rel="stylesheet"/></head><body><div id="root"></div><script defer="defer" src="bundle.js"></script></body></html>
|
||||
2
wwwroot/websites/testapi/bundle.js
Normal file
2
wwwroot/websites/testapi/bundle.js
Normal file
File diff suppressed because one or more lines are too long
37
wwwroot/websites/testapi/bundle.js.LICENSE.txt
Normal file
37
wwwroot/websites/testapi/bundle.js.LICENSE.txt
Normal file
@@ -0,0 +1,37 @@
|
||||
/*! @azure/msal-browser v3.30.0 2025-08-05 */
|
||||
|
||||
/*! @azure/msal-common v14.16.1 2025-08-05 */
|
||||
|
||||
/*! @azure/msal-react v2.2.0 2024-11-05 */
|
||||
|
||||
/*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/babel/babel/blob/main/packages/babel-helpers/LICENSE */
|
||||
|
||||
/**
|
||||
* @license React
|
||||
* react-dom.production.min.js
|
||||
*
|
||||
* Copyright (c) Facebook, Inc. and its affiliates.
|
||||
*
|
||||
* This source code is licensed under the MIT license found in the
|
||||
* LICENSE file in the root directory of this source tree.
|
||||
*/
|
||||
|
||||
/**
|
||||
* @license React
|
||||
* react.production.min.js
|
||||
*
|
||||
* Copyright (c) Facebook, Inc. and its affiliates.
|
||||
*
|
||||
* This source code is licensed under the MIT license found in the
|
||||
* LICENSE file in the root directory of this source tree.
|
||||
*/
|
||||
|
||||
/**
|
||||
* @license React
|
||||
* scheduler.production.min.js
|
||||
*
|
||||
* Copyright (c) Facebook, Inc. and its affiliates.
|
||||
*
|
||||
* This source code is licensed under the MIT license found in the
|
||||
* LICENSE file in the root directory of this source tree.
|
||||
*/
|
||||
11
wwwroot/websites/testapi/index.html
Normal file
11
wwwroot/websites/testapi/index.html
Normal file
@@ -0,0 +1,11 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="UTF-8" />
|
||||
<title>API Tech</title>
|
||||
</head>
|
||||
<body>
|
||||
<div id="root"></div>
|
||||
<script src="bundle.js"></script>
|
||||
</body>
|
||||
</html>
|
||||
Reference in New Issue
Block a user