Bye bye secondary domain
This commit is contained in:
parent
4814ac9d45
commit
336384a193
@ -37,7 +37,6 @@ type Source = {
|
||||
url: string;
|
||||
};
|
||||
url: string;
|
||||
secondary_url: string;
|
||||
port: number;
|
||||
https?: { [x: string]: string };
|
||||
mongodb: {
|
||||
@ -106,9 +105,6 @@ type Mixin = {
|
||||
hostname: string;
|
||||
scheme: string;
|
||||
ws_scheme: string;
|
||||
secondary_host: string;
|
||||
secondary_hostname: string;
|
||||
secondary_scheme: string;
|
||||
api_url: string;
|
||||
ws_url: string;
|
||||
auth_url: string;
|
||||
@ -129,21 +125,15 @@ export default function load() {
|
||||
|
||||
// Validate URLs
|
||||
if (!isUrl(config.url)) urlError(config.url);
|
||||
if (!isUrl(config.secondary_url)) urlError(config.secondary_url);
|
||||
|
||||
const url = new URL(config.url);
|
||||
const secondaryUrl = new URL(config.secondary_url);
|
||||
config.url = normalizeUrl(config.url);
|
||||
config.secondary_url = normalizeUrl(config.secondary_url);
|
||||
|
||||
mixin.host = url.host;
|
||||
mixin.hostname = url.hostname;
|
||||
mixin.scheme = url.protocol.replace(/:$/, '');
|
||||
mixin.ws_scheme = mixin.scheme.replace('http', 'ws');
|
||||
mixin.ws_url = `${mixin.ws_scheme}://${mixin.host}`;
|
||||
mixin.secondary_host = config.secondary_url.substr(config.secondary_url.indexOf('://') + 3);
|
||||
mixin.secondary_hostname = secondaryUrl.hostname;
|
||||
mixin.secondary_scheme = config.secondary_url.substr(0, config.secondary_url.indexOf('://'));
|
||||
mixin.api_url = `${mixin.scheme}://${mixin.host}/api`;
|
||||
mixin.auth_url = `${mixin.scheme}://auth.${mixin.host}`;
|
||||
mixin.ch_url = `${mixin.scheme}://ch.${mixin.host}`;
|
||||
@ -151,7 +141,7 @@ export default function load() {
|
||||
mixin.docs_url = `${mixin.scheme}://docs.${mixin.host}`;
|
||||
mixin.stats_url = `${mixin.scheme}://stats.${mixin.host}`;
|
||||
mixin.status_url = `${mixin.scheme}://status.${mixin.host}`;
|
||||
mixin.drive_url = `${mixin.secondary_scheme}://file.${mixin.secondary_host}`;
|
||||
mixin.drive_url = `${mixin.scheme}://${mixin.host}/files`;
|
||||
|
||||
return Object.assign(config, mixin);
|
||||
}
|
||||
|
Binary file not shown.
Before Width: | Height: | Size: 141 KiB |
@ -1,35 +0,0 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1, minimum-scale=1, maximum-scale=1, user-scalable=no">
|
||||
<meta name="description" content="ひまさく">
|
||||
<meta name="keywords" content="ひまさく, さくひま, 向日葵, 櫻子">
|
||||
<title>ひまさく</title>
|
||||
<style>
|
||||
html {
|
||||
height: 100%;
|
||||
font-size: 0;
|
||||
}
|
||||
|
||||
body {
|
||||
margin: 0;
|
||||
height: 100%;
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
img {
|
||||
display: block;
|
||||
position: absolute;
|
||||
max-width: 100%;
|
||||
margin: auto;
|
||||
top: 0; right: 0; bottom: 0; left: 0;
|
||||
pointer-events: none;
|
||||
user-select: none;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<img src="/himasaku.png" alt="ひまさく">
|
||||
</body>
|
||||
</html>
|
@ -1,23 +0,0 @@
|
||||
/**
|
||||
* Himasaku Server
|
||||
*/
|
||||
|
||||
import * as express from 'express';
|
||||
|
||||
/**
|
||||
* Init app
|
||||
*/
|
||||
const app = express();
|
||||
|
||||
app.disable('x-powered-by');
|
||||
app.locals.cache = true;
|
||||
|
||||
app.get('/himasaku.png', (req, res) => {
|
||||
res.sendFile(`${__dirname}/assets/himasaku.png`);
|
||||
});
|
||||
|
||||
app.get('*', (req, res) => {
|
||||
res.sendFile(`${__dirname}/assets/index.html`);
|
||||
});
|
||||
|
||||
module.exports = app;
|
@ -54,8 +54,7 @@ app.use((req, res, next) => {
|
||||
* Register modules
|
||||
*/
|
||||
app.use('/api', require('./api/server'));
|
||||
app.use(vhost(config.secondary_hostname, require('./himasaku/server')));
|
||||
app.use(vhost(`file.${config.secondary_hostname}`, require('./file/server')));
|
||||
app.use('/files', require('./file/server'));
|
||||
app.use(require('./web/server'));
|
||||
|
||||
/**
|
||||
|
Loading…
Reference in New Issue
Block a user