mirror of
https://github.com/pvrzz/toolscord.git
synced 2026-11-29 05:22:25 +00:00
Add files via upload
This commit is contained in:
@@ -0,0 +1,18 @@
|
||||
{
|
||||
"name": "Toolscord — Discord Toolbox",
|
||||
"short_name": "Toolscord",
|
||||
"description": "An all-in-one Discord toolbox: markdown editor, embed builder with webhook sender, timestamp generator, snowflake decoder, permissions calculator and color converter.",
|
||||
"id": "/",
|
||||
"start_url": "./",
|
||||
"scope": "./",
|
||||
"display": "standalone",
|
||||
"orientation": "any",
|
||||
"background_color": "#313338",
|
||||
"theme_color": "#5865f2",
|
||||
"categories": ["utilities", "developer", "productivity"],
|
||||
"icons": [
|
||||
{ "src": "icons/icon-192.png", "sizes": "192x192", "type": "image/png", "purpose": "any" },
|
||||
{ "src": "icons/icon-512.png", "sizes": "512x512", "type": "image/png", "purpose": "any" },
|
||||
{ "src": "icons/icon-maskable-512.png", "sizes": "512x512", "type": "image/png", "purpose": "maskable" }
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1,4 @@
|
||||
User-agent: *
|
||||
Allow: /
|
||||
|
||||
Sitemap: https://toolscord.pvrz.lol/sitemap.xml
|
||||
@@ -0,0 +1,8 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
|
||||
<url>
|
||||
<loc>https://toolscord.pvrz.lol/</loc>
|
||||
<changefreq>weekly</changefreq>
|
||||
<priority>1.0</priority>
|
||||
</url>
|
||||
</urlset>
|
||||
@@ -0,0 +1,56 @@
|
||||
/*
|
||||
===========================
|
||||
Toolscord
|
||||
by: github.com/pvrzz
|
||||
===========================
|
||||
*/
|
||||
|
||||
const CACHE = "toolscord-v1";
|
||||
const RUNTIME = "toolscord-runtime-v1";
|
||||
const CORE = [
|
||||
"./",
|
||||
"./index.html",
|
||||
"./styles.css",
|
||||
"./app.js",
|
||||
"./manifest.webmanifest",
|
||||
"./icons/icon-192.png",
|
||||
"./icons/icon-512.png",
|
||||
"./icons/icon-maskable-512.png",
|
||||
"./icons/apple-touch-icon.png",
|
||||
"./icons/favicon-32.png",
|
||||
];
|
||||
|
||||
self.addEventListener("install", (e) => {
|
||||
e.waitUntil(caches.open(CACHE).then((c) => c.addAll(CORE)).then(() => self.skipWaiting()));
|
||||
});
|
||||
|
||||
self.addEventListener("activate", (e) => {
|
||||
e.waitUntil(
|
||||
caches.keys().then((keys) =>
|
||||
Promise.all(keys.filter((k) => k !== CACHE && k !== RUNTIME).map((k) => caches.delete(k)))
|
||||
).then(() => self.clients.claim())
|
||||
);
|
||||
});
|
||||
|
||||
self.addEventListener("fetch", (e) => {
|
||||
const req = e.request;
|
||||
if (req.method !== "GET") return;
|
||||
|
||||
const url = new URL(req.url);
|
||||
if (url.hostname.endsWith("discord.com") || url.hostname.endsWith("discordapp.com")) return;
|
||||
|
||||
e.respondWith(
|
||||
caches.match(req).then((cached) => {
|
||||
const network = fetch(req)
|
||||
.then((res) => {
|
||||
if (res && res.status === 200 && (res.type === "basic" || res.type === "cors")) {
|
||||
const copy = res.clone();
|
||||
caches.open(RUNTIME).then((c) => c.put(req, copy));
|
||||
}
|
||||
return res;
|
||||
})
|
||||
.catch(() => cached);
|
||||
return cached || network;
|
||||
})
|
||||
);
|
||||
});
|
||||
Reference in New Issue
Block a user