penambahan web socket

This commit is contained in:
2025-09-18 19:01:22 +07:00
parent 1d053646a9
commit d7bb2eb5bb
15070 changed files with 2402916 additions and 0 deletions

No files matched your search

@@ -0,0 +1,39 @@
import { defineNuxtPlugin } from "../nuxt.js";
import { getAppManifest } from "../composables/manifest.js";
import { onNuxtReady } from "../composables/ready.js";
import { buildAssetsURL } from "#internal/nuxt/paths";
import { outdatedBuildInterval } from "#build/nuxt.config.mjs";
export default defineNuxtPlugin((nuxtApp) => {
if (import.meta.test) {
return;
}
let timeout;
async function getLatestManifest() {
let currentManifest;
try {
currentManifest = await getAppManifest();
} catch (e) {
const err = e;
if (!("status" in err && (err.status === 404 || err.status === 403))) {
throw err;
}
}
if (timeout) {
clearTimeout(timeout);
}
timeout = setTimeout(getLatestManifest, outdatedBuildInterval);
try {
const meta = await $fetch(buildAssetsURL("builds/latest.json") + `?${Date.now()}`);
if (meta.id !== currentManifest?.id) {
nuxtApp.hooks.callHook("app:manifest:update", meta);
if (timeout) {
clearTimeout(timeout);
}
}
} catch {
}
}
onNuxtReady(() => {
timeout = setTimeout(getLatestManifest, outdatedBuildInterval);
});
});