This commit is contained in:
Rizky 2024-04-20 23:27:08 +07:00
parent 814c709814
commit 70766c4ea1
3 changed files with 25 additions and 15 deletions

File diff suppressed because one or more lines are too long

View File

@ -167,7 +167,7 @@ export const viEvalScript = (
try {
${src}
} catch(e) {
console.warn("Error at item ${meta.item.name}:", ${meta.item.adv?.js});
console.warn("Error at item ${meta.item.name}:", \`${meta.item.adv?.js}\`);
}
`
);

View File

@ -13,6 +13,16 @@ type PRELOAD = Exclude<VG["on_preload"], undefined>;
type PRELOAD_ARGS = Parameters<PRELOAD>[0];
const w = window as any;
if (!w.prasi_error_handler) {
w.prasi_error_handler = true;
window.addEventListener("error", (errorEvent) => {
const { lineno, colno } = errorEvent;
console.log(`Error thrown at: ${lineno}:${colno}`);
errorEvent.preventDefault();
});
}
export const Vi: FC<{
meta: Record<string, IMeta>;
mode: "mobile" | "desktop";
@ -56,7 +66,7 @@ export const Vi: FC<{
if (pathname.startsWith("http://") || pathname.startsWith("https://"))
return pathname;
try {
try {
if (["prasi.avolut.com", "localhost"].includes(location.hostname)) {
if (vi.site.api_url) {
if (!vi.site_url) {