Added escape key funtionality
This commit is contained in:
parent
11d2a8cb32
commit
d4af74f60e
4 changed files with 39 additions and 3 deletions
13
src/index.ts
13
src/index.ts
|
@ -99,6 +99,10 @@ const instances = JSON.parse(
|
||||||
readFileSync(process.env.JANK_INSTANCES_PATH || __dirname + "/webpage/instances.json").toString(),
|
readFileSync(process.env.JANK_INSTANCES_PATH || __dirname + "/webpage/instances.json").toString(),
|
||||||
) as instace[];
|
) as instace[];
|
||||||
|
|
||||||
|
const manifest = JSON.parse(
|
||||||
|
readFileSync(process.env.JANK_INSTANCES_PATH || __dirname + "/webpage/manifest.json").toString(),
|
||||||
|
) as object;
|
||||||
|
|
||||||
const instanceNames = new Map<string, Instance>();
|
const instanceNames = new Map<string, Instance>();
|
||||||
|
|
||||||
for (const instance of instances) {
|
for (const instance of instances) {
|
||||||
|
@ -118,7 +122,7 @@ async function updateInstances(): Promise<void> {
|
||||||
const existingInstance = instanceNames.get(instance.name);
|
const existingInstance = instanceNames.get(instance.name);
|
||||||
if (existingInstance) {
|
if (existingInstance) {
|
||||||
for (const key of Object.keys(instance)) {
|
for (const key of Object.keys(instance)) {
|
||||||
if (!existingInstance[key]) {
|
if (!(key in existingInstance)) {
|
||||||
existingInstance[key] = instance[key];
|
existingInstance[key] = instance[key];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -183,6 +187,11 @@ app.use("/", async (req: Request, res: Response) => {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (req.path.startsWith("/manifest.json")) {
|
||||||
|
res.json(manifest);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (req.path.startsWith("/invite/")) {
|
if (req.path.startsWith("/invite/")) {
|
||||||
res.sendFile(path.join(__dirname, "webpage", "invite.html"));
|
res.sendFile(path.join(__dirname, "webpage", "invite.html"));
|
||||||
return;
|
return;
|
||||||
|
@ -193,7 +202,7 @@ app.use("/", async (req: Request, res: Response) => {
|
||||||
|
|
||||||
app.set("trust proxy", (ip: string) => ip.startsWith("127."));
|
app.set("trust proxy", (ip: string) => ip.startsWith("127."));
|
||||||
|
|
||||||
const PORT = process.env.PORT || Number(process.argv[2]) || 8080;
|
const PORT = process.env.PORT || Number(process.argv[2]) || 8333;
|
||||||
app.listen(PORT, () => {
|
app.listen(PORT, () => {
|
||||||
console.log(`Server running on port ${PORT}`);
|
console.log(`Server running on port ${PORT}`);
|
||||||
});
|
});
|
||||||
|
|
|
@ -1,4 +1,18 @@
|
||||||
[
|
[
|
||||||
|
{
|
||||||
|
"name": "NomBar",
|
||||||
|
"description": "The Tastiest Chat around, get your fill today",
|
||||||
|
"image": "https://munchy.impassivedev.com/images/icon.png",
|
||||||
|
"url": "https://spacebar.nomchy-verse.com",
|
||||||
|
"language": "en",
|
||||||
|
"country": "US",
|
||||||
|
"display": true,
|
||||||
|
"contactInfo": {
|
||||||
|
"dicord": "munchy420",
|
||||||
|
"github": "https://tea.nomchy-verse.com/munchy",
|
||||||
|
"email": "thedudedies22@gmail.com"
|
||||||
|
}
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"name": "Spacebar",
|
"name": "Spacebar",
|
||||||
"description": "The official Spacebar instance.",
|
"description": "The official Spacebar instance.",
|
||||||
|
@ -30,5 +44,9 @@
|
||||||
"github": "https://github.com/greysilly7",
|
"github": "https://github.com/greysilly7",
|
||||||
"email": "greysilly7@gmail.com"
|
"email": "greysilly7@gmail.com"
|
||||||
}
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "Vanilla Minigames",
|
||||||
|
"display": false
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
|
|
|
@ -6,8 +6,11 @@
|
||||||
"sizes": "512x512"
|
"sizes": "512x512"
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"start_url": "/channels/@me",
|
"start_url": "https://chat.nomchy-verse.com/",
|
||||||
"display": "standalone",
|
"display": "standalone",
|
||||||
|
"scope": "/",
|
||||||
"theme_color": "#05050a",
|
"theme_color": "#05050a",
|
||||||
|
"description": "Welcome to the Jank Client, a spacebar FOSS client implementation",
|
||||||
|
"background_color": "#05050a",
|
||||||
"offline_enabled": true
|
"offline_enabled": true
|
||||||
}
|
}
|
||||||
|
|
|
@ -1431,6 +1431,12 @@ class Settings extends Buttons {
|
||||||
exit.onclick = (_) => {
|
exit.onclick = (_) => {
|
||||||
this.hide();
|
this.hide();
|
||||||
};
|
};
|
||||||
|
onkeyup = (event) => {
|
||||||
|
if (event.key === "Escape") {
|
||||||
|
// Cancel the default action, if needed
|
||||||
|
this.hide()
|
||||||
|
}
|
||||||
|
}
|
||||||
document.body.append(background);
|
document.body.append(background);
|
||||||
this.html = background;
|
this.html = background;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue