Download index.html from CVNSS/C2M: direct link, hf CLI and curl.
- Browser
- Download file 4.04 kB
-
https://huggingface.co/spaces/CVNSS/C2M/resolve/main/index.html
- Command line
-
hf download hf://spaces/CVNSS/C2M/index.html
-
curl -L -o index.html https://huggingface.co/spaces/CVNSS/C2M/resolve/main/index.html
4.04 kB
| <html lang="vi"> | |
| <head> | |
| <meta charset="UTF-8" /> | |
| <meta name="viewport" content="width=device-width,initial-scale=1" /> | |
| <base href="./" /> | |
| <title>CAD2MAP</title> | |
| <meta name="description" content="CAD2MAP - Công cụ chuyển đổi CAD/DXF/DWG sang bản đồ" /> | |
| <!-- Tất cả file nằm cùng cấp (ROOT) --> | |
| <link rel="icon" type="image/svg+xml" href="./cad2map-favicon.svg" /> | |
| <link rel="stylesheet" href="./index-nLRMG7XC.css" /> | |
| </head> | |
| <body> | |
| <div id="app"></div> | |
| <noscript>Ứng dụng cần bật JavaScript để chạy.</noscript> | |
| <!-- | |
| HF/ROOT FIX (không thư mục con): | |
| 1) Ép provinces về local ./provinces.json (hoặc fallback Firebase) | |
| 2) Chặn mọi Worker URL trỏ /assets/... -> ./... (vì bạn không có folder assets) | |
| --> | |
| <script> | |
| (function () { | |
| const LOG = "[CAD2MAP-FIX]"; | |
| const nativeFetch = window.fetch ? window.fetch.bind(window) : null; | |
| // ---------- 1) Fix provinces: không gọi server cloud (tránh CORS "No response") ---------- | |
| function isProvinces(url) { | |
| try { | |
| const u = new URL(url, location.href); | |
| const p = u.pathname || ""; | |
| return ( | |
| p.endsWith("/provinces") || | |
| p.endsWith("/api/provinces") || | |
| p.includes("/provinces?") | |
| ); | |
| } catch { | |
| return String(url || "").includes("provinces"); | |
| } | |
| } | |
| async function fetchProvincesFallback() { | |
| // Ưu tiên local file cùng cấp | |
| try { | |
| const r = await nativeFetch("./provinces.json", { cache: "no-store" }); | |
| if (r.ok) { | |
| console.info(LOG, "provinces -> ./provinces.json"); | |
| return r; | |
| } | |
| } catch (_) {} | |
| // Fallback cuối (nếu bạn có publish file này trên Firebase) | |
| try { | |
| const r2 = await nativeFetch("https://cad2map.web.app/provinces.json", { cache: "no-store" }); | |
| if (r2.ok) { | |
| console.info(LOG, "provinces -> https://cad2map.web.app/provinces.json"); | |
| return r2; | |
| } | |
| } catch (_) {} | |
| // Nếu cả 2 fail -> trả lỗi chuẩn | |
| throw new Error("Không tải được provinces (local provinces.json và fallback đều lỗi)."); | |
| } | |
| if (nativeFetch) { | |
| window.fetch = function (input, init) { | |
| const url = typeof input === "string" ? input : (input && input.url) || ""; | |
| if (isProvinces(url)) return fetchProvincesFallback(); | |
| return nativeFetch(input, init); | |
| }; | |
| } | |
| // ---------- 2) Fix Worker URL: /assets/... => ./... (vì không có thư mục con) ---------- | |
| const NativeWorker = window.Worker; | |
| function rewriteToRoot(spec) { | |
| let s = spec; | |
| // URL object -> string href | |
| if (spec && typeof spec === "object" && "href" in spec) s = spec.href; | |
| s = String(s || ""); | |
| // Chỉ rewrite các path có /assets/ hoặc ./assets/ hoặc assets/ | |
| // Ví dụ: | |
| // https://xxx.hf.space/assets/dxf-parser-worker.js -> ./dxf-parser-worker.js | |
| // /assets/libredwg-parser-worker.js -> ./libredwg-parser-worker.js | |
| // ./assets/mtext-renderer-worker.js -> ./mtext-renderer-worker.js | |
| s = s.replace(/^https?:\/\/[^/]+\/assets\//i, "./"); | |
| s = s.replace(/^\/assets\//i, "./"); | |
| s = s.replace(/^\.\/*assets\//i, "./"); | |
| s = s.replace(/^assets\//i, "./"); | |
| return s; | |
| } | |
| if (NativeWorker) { | |
| window.Worker = function (spec, options) { | |
| const rewritten = rewriteToRoot(spec); | |
| return new NativeWorker(rewritten, options); | |
| }; | |
| window.Worker.prototype = NativeWorker.prototype; | |
| } | |
| console.info(LOG, "installed (root-only, no subfolders)."); | |
| })(); | |
| </script> | |
| <!-- Bundle chạy sau khi đã patch fetch/Worker --> | |
| <script type="module" crossorigin src="./index-Cm1h4vpW.js"></script> | |
| </body> | |
| </html> | |