-
Notifications
You must be signed in to change notification settings - Fork 6
/
serve.ts
113 lines (106 loc) · 4.75 KB
/
serve.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
import { serve } from "https://deno.land/x/[email protected]/mod.ts";
// import { serve } from "../esbuild_serve/mod.ts";
CI FAIL
const title = new Map(Object.entries({
"index": "BBN Music",
"admin": "BBN Admin",
"admin/review": "BBN Music - Review Drop",
"hosting": "BBN Hosting",
"hosting/create": "BBN Hosting",
"settings": "BBN - Settings",
"wallet": "BBN Wallet",
"music": "BBN Music",
"c/music": "BBN Music - Console",
"c/music/new-drop": "BBN Music - New Drop",
"c/music/edit": "BBN Music - Edit Drop",
"c/music/payout": "BBN Music - Payouts",
"p/privacy-policy": "BBN - Privacy Policy",
"p/terms-of-use": "BBN - Terms of Use",
"p/imprint": "BBN - Imprint",
"p/distribution-agreement": "BBN - Distribution Agreement",
}));
const description = new Map(Object.entries({
"default": "BBN Holding encompasses a variety of businesses, including music and hosting services. BBN Music provides music distribution, publishing, and label services, while BBN Hosting offers Minecraft hosting services.",
"music": "BBN Music, your gateway to unlimited music distribution at a low cost. Maximize your reach without limits. Join us and let the world hear your music.",
}));
serve({
port: 6969,
extraLoaders: {
".webp": "file",
".jpg": "file",
},
assets: {
"sitemap.xml": "./static/sitemap.xml",
"robots.txt": "./static/robots.txt",
"mitm.html": "./static/mitm.html",
"sw.js": "./static/sw.js",
"favicon.ico": "./static/favicon.ico",
"email-header.png": "./static/email-header.png",
"app.webmanifest": "./static/app.webmanifest",
".well-known/passkey-endpoints": "./static/.well-known/passkey-endpoints",
"images/icons/icon-72x72.png": "./static/images/icons/icon-72x72.png",
"images/icons/icon-96x96.png": "./static/images/icons/icon-96x96.png",
"images/icons/icon-128x128.png": "./static/images/icons/icon-128x128.png",
"images/icons/icon-144x144.png": "./static/images/icons/icon-144x144.png",
"images/icons/icon-152x152.png": "./static/images/icons/icon-152x152.png",
"images/icons/icon-192x192.png": "./static/images/icons/icon-192x192.png",
"images/icons/icon-384x384.png": "./static/images/icons/icon-384x384.png",
"images/icons/icon-512x512.png": "./static/images/icons/icon-512x512.png",
"images/apple.png": "./static/images/apple.png",
},
pages: {
// "index": "./pages/holding/index.ts",
"index": "./pages/music-landing/main.ts",
// "p/privacy-policy": "./pages/holding/privacyPolicy.ts",
// "p/terms": "./pages/holding/terms.ts",
// "p/imprint": "./pages/holding/imprint.ts",
// "signin": "./pages/user/signin.ts",
// "callback": "./pages/misc/callback.ts",
// "oauth": "./pages/user/oauth.ts",
// "music": "./pages/music-landing/main.ts",
// "c/music": "./pages/music/main.ts",
// "c/music/new-drop": "./pages/music/newDrop.ts",
// "c/music/edit": "./pages/music/edit.ts",
// "c/music/payout": "./pages/payout/main.ts",
// "hosting": "./pages/hosting/main.ts",
// "hosting/create": "./pages/hosting/views/create.ts",
// "settings": "./pages/user/settings.ts",
// "admin": "./pages/admin/admin.ts",
// "admin/review": "./pages/admin/review.ts",
// "wallet": "./pages/wallet/wallet.ts",
// "share": "./pages/music/share.ts",
},
defaultTemplate: createTemplate,
poylfills: [
"./polyfill.ts",
"./bug-reporter.ts",
"https://cdn.jsdelivr.net/npm/[email protected]/mod.js",
"https://unpkg.com/urlpattern-polyfill",
],
});
function createTemplate(name: string, path: string) {
return `
<!DOCTYPE html>
<html lang="en">
<head>
<title>${title.get(path) ?? "BBN Holding"}</title>
<link rel="manifest" href="/app.webmanifest">
<meta charset='UTF-8'>
<meta name="description" content="${description.get(path) ?? description.get("default")}">
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta name='theme-color' content='black'>
<meta name="mobile-web-app-capable" content="yes">
<meta name="apple-mobile-web-app-status-bar-style" content="black">
<meta name="apple-mobile-web-app-title" content="${title.get(path) ?? "BBN Holding"}">
<meta name="google" content="notranslate"/>
<link rel="me" href="https://chaos.social/@bbn">
<link rel="apple-touch-icon" href="/images/apple.png">
<link rel="stylesheet" href="${name}.css">
<script defer data-domain="bbn.one" src="https://pl.bbn.one/js/script.js"></script>
</head>
<body>
<script src="${name}.js" type="module"></script>
</body>
</html>
`.trim();
}