init
This commit is contained in:
9
.dockerignore
Normal file
9
.dockerignore
Normal file
@@ -0,0 +1,9 @@
|
|||||||
|
node_modules
|
||||||
|
dist
|
||||||
|
hairline
|
||||||
|
.git
|
||||||
|
.DS_Store
|
||||||
|
Dockerfile
|
||||||
|
docker-compose.yml
|
||||||
|
.dockerignore
|
||||||
|
*.log
|
||||||
4
.gitignore
vendored
Normal file
4
.gitignore
vendored
Normal file
@@ -0,0 +1,4 @@
|
|||||||
|
node_modules
|
||||||
|
dist
|
||||||
|
.DS_Store
|
||||||
|
/hairline
|
||||||
19
Dockerfile
Normal file
19
Dockerfile
Normal file
@@ -0,0 +1,19 @@
|
|||||||
|
# syntax=docker/dockerfile:1
|
||||||
|
|
||||||
|
# ---- Build: install deps from the lockfile and produce dist/ ----
|
||||||
|
FROM node:22-alpine AS build
|
||||||
|
WORKDIR /app
|
||||||
|
COPY package.json package-lock.json ./
|
||||||
|
RUN npm ci --no-audit --no-fund
|
||||||
|
COPY index.html vite.config.js ./
|
||||||
|
COPY public ./public
|
||||||
|
COPY src ./src
|
||||||
|
RUN npm run build
|
||||||
|
|
||||||
|
# ---- Serve: static files on nginx, as a non-root user, port 8080 ----
|
||||||
|
FROM nginxinc/nginx-unprivileged:1.27-alpine
|
||||||
|
COPY nginx.conf /etc/nginx/conf.d/default.conf
|
||||||
|
COPY --from=build /app/dist /usr/share/nginx/html
|
||||||
|
EXPOSE 8080
|
||||||
|
HEALTHCHECK --interval=30s --timeout=3s --start-period=5s --retries=3 \
|
||||||
|
CMD wget -qO- http://127.0.0.1:8080/healthz || exit 1
|
||||||
7
docker-compose.yml
Normal file
7
docker-compose.yml
Normal file
@@ -0,0 +1,7 @@
|
|||||||
|
services:
|
||||||
|
web:
|
||||||
|
build: .
|
||||||
|
image: ofsaver:latest
|
||||||
|
restart: unless-stopped
|
||||||
|
ports:
|
||||||
|
- "${PORT:-8080}:8080"
|
||||||
417
ext/background.js
Normal file
417
ext/background.js
Normal file
@@ -0,0 +1,417 @@
|
|||||||
|
// Service worker: relay content-script requests to the offscreen worker,
|
||||||
|
// create the offscreen document on demand, trigger downloads.
|
||||||
|
|
||||||
|
import { buildPath } from "./lib/paths.js";
|
||||||
|
|
||||||
|
const OFFSCREEN_URL = "offscreen.html";
|
||||||
|
|
||||||
|
function toUnixSeconds(d) {
|
||||||
|
if (d == null) return null;
|
||||||
|
if (typeof d === "number") return d > 1e12 ? Math.floor(d / 1000) : Math.floor(d);
|
||||||
|
const parsed = Date.parse(d);
|
||||||
|
return Number.isNaN(parsed) ? null : Math.floor(parsed / 1000);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Folder/file names want the creator's handle. No API calls — the page's
|
||||||
|
// own traffic already names every user it shows (chat batches, author
|
||||||
|
// objects, the hook's users map). Capture-only, fanripper-style: cache →
|
||||||
|
// ask the sending tab → numeric id as last resort.
|
||||||
|
const USERNAME_TTL = 7 * 24 * 3600 * 1000;
|
||||||
|
async function resolveCreator(media, tabId = null) {
|
||||||
|
if (media.username) return media.username;
|
||||||
|
const id = String(media.creatorId ?? "");
|
||||||
|
if (!id) return "unknown";
|
||||||
|
try {
|
||||||
|
const { usernames } = await chrome.storage.local.get("usernames");
|
||||||
|
const hit = usernames?.[id];
|
||||||
|
if (hit?.u && Date.now() - (hit.t ?? 0) < USERNAME_TTL) return hit.u;
|
||||||
|
if (tabId) {
|
||||||
|
const w = await chrome.tabs.sendMessage(tabId, { op: "whoIs", mediaId: media.id, creatorId: media.creatorId }).catch(() => null);
|
||||||
|
const u = w?.ok ? (w.username ?? null) : null;
|
||||||
|
if (u) {
|
||||||
|
await chrome.storage.local.set({ usernames: { ...(usernames ?? {}), [id]: { u, t: Date.now() } } });
|
||||||
|
return u;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} catch {}
|
||||||
|
return id;
|
||||||
|
}
|
||||||
|
|
||||||
|
async function fileNamingOpts(media, { bulk = false, ext = "mp4", quality = null, section = null, tabId = null } = {}) {
|
||||||
|
const stored = await chrome.storage.local.get(["singleScheme", "bulkScheme", "nameTemplate"]);
|
||||||
|
const createdAt = media.createdAt ?? null;
|
||||||
|
return {
|
||||||
|
scheme: bulk ? (stored.bulkScheme ?? "creator-section-type") : (stored.singleScheme ?? "creator-type"),
|
||||||
|
singleScheme: stored.singleScheme,
|
||||||
|
bulk,
|
||||||
|
creator: await resolveCreator(media, tabId),
|
||||||
|
type: media.type ?? "video",
|
||||||
|
section,
|
||||||
|
date: createdAt,
|
||||||
|
timestamp: toUnixSeconds(createdAt),
|
||||||
|
mediaId: media.id,
|
||||||
|
postId: media.postId,
|
||||||
|
quality,
|
||||||
|
ext,
|
||||||
|
template: stored.nameTemplate,
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
async function hasOffscreen() {
|
||||||
|
const contexts = await chrome.runtime.getContexts({
|
||||||
|
contextTypes: ["OFFSCREEN_DOCUMENT"],
|
||||||
|
});
|
||||||
|
return contexts.length > 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
async function ensureOffscreen() {
|
||||||
|
if (await hasOffscreen()) return;
|
||||||
|
await chrome.offscreen.createDocument({
|
||||||
|
url: OFFSCREEN_URL,
|
||||||
|
reasons: ["DOM_SCRAPING"],
|
||||||
|
justification: "hosts the OnlyFans request signer (module-eval) and the DRM pipeline",
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
async function callOffscreen(msg) {
|
||||||
|
await ensureOffscreen();
|
||||||
|
return chrome.runtime.sendMessage(msg);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Free the offscreen's OPFS files + blob URLs once the download actually
|
||||||
|
// finishes (or fails) — not on a fixed timer, since multi-GB downloads can
|
||||||
|
// run for many minutes.
|
||||||
|
function cleanupAfterDownload(downloadId, { urls = [], ids = [] } = {}) {
|
||||||
|
if (!downloadId) return;
|
||||||
|
let done = false;
|
||||||
|
const finish = () => {
|
||||||
|
if (done) return;
|
||||||
|
done = true;
|
||||||
|
chrome.downloads.onChanged.removeListener(listener);
|
||||||
|
if (urls.length) callOffscreen({ op: "revokeUrls", urls }).catch(() => {});
|
||||||
|
if (ids.length) callOffscreen({ op: "dropHeld", ids }).catch(() => {});
|
||||||
|
};
|
||||||
|
const listener = (delta) => {
|
||||||
|
if (delta.id !== downloadId) return;
|
||||||
|
const st = delta.state?.current;
|
||||||
|
if (st === "complete" || st === "interrupted") finish();
|
||||||
|
};
|
||||||
|
chrome.downloads.onChanged.addListener(listener);
|
||||||
|
// safety net in case the state event never arrives
|
||||||
|
setTimeout(finish, 30 * 60 * 1000);
|
||||||
|
}
|
||||||
|
|
||||||
|
const safe = (s) => String(s ?? "").replace(/[^\w.-]/g, "_");
|
||||||
|
|
||||||
|
// ---- saved-media registry (so the UI can mark what we already have) ----
|
||||||
|
async function getSavedSet() {
|
||||||
|
const { savedMedia } = await chrome.storage.local.get("savedMedia");
|
||||||
|
return savedMedia ?? {};
|
||||||
|
}
|
||||||
|
async function markSaved(mediaIds) {
|
||||||
|
if (!mediaIds?.length) return;
|
||||||
|
const set = await getSavedSet();
|
||||||
|
for (const id of mediaIds) if (id != null) set[id] = Date.now();
|
||||||
|
await chrome.storage.local.set({ savedMedia: set });
|
||||||
|
// let open tabs update their buttons
|
||||||
|
for (const tab of await chrome.tabs.query({ url: "https://onlyfans.com/*" })) {
|
||||||
|
chrome.tabs.sendMessage(tab.id, { op: "savedUpdated", ids: mediaIds }).catch(() => {});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
async function saveViaPage(tabId, url, filename) {
|
||||||
|
if (!tabId) return { ok: false, error: "no page tab" };
|
||||||
|
return chrome.tabs.sendMessage(tabId, { op: "saveUrl", url, filename });
|
||||||
|
}
|
||||||
|
|
||||||
|
/** Ensure the content scripts exist in a tab (reloads orphan open tabs). */
|
||||||
|
async function ensureContentScripts(tabId) {
|
||||||
|
try {
|
||||||
|
await chrome.tabs.sendMessage(tabId, { op: "ping" });
|
||||||
|
return true;
|
||||||
|
} catch {
|
||||||
|
try {
|
||||||
|
await chrome.scripting.executeScript({
|
||||||
|
target: { tabId },
|
||||||
|
world: "MAIN",
|
||||||
|
files: ["lib/main-hook.js"],
|
||||||
|
});
|
||||||
|
await chrome.scripting.executeScript({
|
||||||
|
target: { tabId },
|
||||||
|
files: ["content.js"],
|
||||||
|
});
|
||||||
|
return true;
|
||||||
|
} catch (e) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
chrome.runtime.onMessage.addListener((msg, sender, sendResponse) => {
|
||||||
|
if (msg.op === "lastLog") {
|
||||||
|
// content-side probe after a hung item: surface the offscreen's last log
|
||||||
|
callOffscreen({ op: "lastLog" })
|
||||||
|
.then((r) => sendResponse(r ?? { ok: false }))
|
||||||
|
.catch(() => sendResponse({ ok: false }));
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
if (msg.op === "dlProgress") {
|
||||||
|
if (msg.tabId) chrome.tabs.sendMessage(msg.tabId, { op: "dlProgress", id: msg.id, pct: msg.pct }).catch(() => {});
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (msg.op === "downloadUrl") {
|
||||||
|
(async () => {
|
||||||
|
try {
|
||||||
|
const naming = await fileNamingOpts(msg.media ?? {}, {
|
||||||
|
ext: msg.ext ?? "jpg",
|
||||||
|
quality: msg.quality ?? null,
|
||||||
|
tabId: sender?.tab?.id,
|
||||||
|
});
|
||||||
|
const filename = buildPath(naming);
|
||||||
|
// same proven path as DRM: fetch in offscreen → blob → chrome.downloads
|
||||||
|
const hold = await callOffscreen({ op: "fetchAndHold", files: [{ url: msg.url, filename }], tabId: sender?.tab?.id, dlId: msg.media?.id });
|
||||||
|
const h = hold?.held?.[0];
|
||||||
|
if (!h?.ok) {
|
||||||
|
sendResponse({ ok: false, error: h?.error ?? hold?.error ?? "fetch failed" });
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
const dl = await chrome.downloads.download({
|
||||||
|
url: h.blobUrl,
|
||||||
|
filename, // buildPath already sanitizes each segment — don't flatten the path
|
||||||
|
conflictAction: "uniquify",
|
||||||
|
saveAs: false,
|
||||||
|
});
|
||||||
|
cleanupAfterDownload(dl, { urls: [h.blobUrl], ids: [h.id] });
|
||||||
|
await markSaved([msg.media?.id]);
|
||||||
|
sendResponse({ ok: true, size: h.size });
|
||||||
|
} catch (e) {
|
||||||
|
sendResponse({ ok: false, error: e.message });
|
||||||
|
}
|
||||||
|
})();
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (msg.op === "download") {
|
||||||
|
(async () => {
|
||||||
|
try {
|
||||||
|
let userId = null, xBc = null;
|
||||||
|
// Prefer the SENDING TAB's own session identity (captured by the
|
||||||
|
// main-world hook from the page's signed API requests). In incognito
|
||||||
|
// the cookies API only sees the regular jar, so cookie-based auth
|
||||||
|
// signs the license with the wrong user-id and OF kills the session.
|
||||||
|
try {
|
||||||
|
const tabId = sender?.tab?.id;
|
||||||
|
if (tabId) {
|
||||||
|
const auth = await chrome.tabs.sendMessage(tabId, { op: "getAuth" }).catch(() => null);
|
||||||
|
if (auth?.ok && auth.auth?.uid) {
|
||||||
|
userId = auth.auth.uid;
|
||||||
|
xBc = auth.auth.bc ?? null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} catch {}
|
||||||
|
if (userId == null) {
|
||||||
|
// fallback: regular-jar cookies (normal windows)
|
||||||
|
try {
|
||||||
|
const [c1, c2] = await Promise.all([
|
||||||
|
chrome.cookies.get({ url: "https://onlyfans.com", name: "auth_id" }),
|
||||||
|
chrome.cookies.get({ url: "https://onlyfans.com", name: "fp" }),
|
||||||
|
]);
|
||||||
|
userId = c1?.value ?? null;
|
||||||
|
xBc = c2?.value ?? null;
|
||||||
|
} catch {}
|
||||||
|
}
|
||||||
|
let media = { ...msg.media };
|
||||||
|
const tabId = sender?.tab?.id;
|
||||||
|
// DRM manifest signatures expire — refresh the media's drm object
|
||||||
|
// from the post detail endpoint so the MPD URL is freshly signed
|
||||||
|
if (tabId && media.responseType !== "message" && media.postId) {
|
||||||
|
try {
|
||||||
|
const rf = await callOffscreen({ op: "refreshDrm", postId: media.postId, mediaId: media.id, userId });
|
||||||
|
if (rf?.ok && rf.media) {
|
||||||
|
media = { ...media, drm: rf.media.files?.drm ?? media.drm };
|
||||||
|
// keep the page-world store fresh for the next downloads too
|
||||||
|
await chrome.tabs.sendMessage(tabId, {
|
||||||
|
op: "ingest",
|
||||||
|
data: { list: [{ id: media.postId, responseType: media.responseType ?? "post", postedAt: 0, media: [rf.media] }] },
|
||||||
|
}).catch(() => {});
|
||||||
|
}
|
||||||
|
} catch {}
|
||||||
|
}
|
||||||
|
const res = await callOffscreen({ op: "prepareLicense", media: { ...media, xBc }, userId });
|
||||||
|
if (!res?.ok) {
|
||||||
|
sendResponse({ ok: false, error: `${res?.error ?? "offscreen failed"} [${(res?.log ?? []).slice(-1)[0] ?? "no log"}]`, log: res?.log });
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
// relay the license POST through the page (same-origin fetch — OF
|
||||||
|
// rejects extension origins with a CORS error)
|
||||||
|
if (tabId) await ensureContentScripts(tabId);
|
||||||
|
let licenseRes = null;
|
||||||
|
if (tabId) {
|
||||||
|
licenseRes = await chrome.tabs.sendMessage(tabId, {
|
||||||
|
op: "licensePost",
|
||||||
|
url: `https://onlyfans.com${res.licensePath}`,
|
||||||
|
headers: res.headers,
|
||||||
|
bodyB64: res.challengeB64,
|
||||||
|
}).catch((e) => ({ ok: false, error: "relay failed: " + e.message }));
|
||||||
|
} else {
|
||||||
|
licenseRes = { ok: false, error: "no page tab to relay through" };
|
||||||
|
}
|
||||||
|
if (!licenseRes?.ok) {
|
||||||
|
sendResponse({ ok: false, error: licenseRes?.error ?? `license relay failed (HTTP ${licenseRes?.status ?? "?"}) :: ${(res.log ?? []).slice(-1)[0] ?? "no log"}`, log: res.log });
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
const fin = await callOffscreen({
|
||||||
|
op: "finishLicense",
|
||||||
|
licenseB64: licenseRes.bodyB64,
|
||||||
|
licenseRequestB64: res.licenseRequestB64,
|
||||||
|
mpd: res.mpd,
|
||||||
|
mpdUrl: res.mpdUrl ?? null,
|
||||||
|
});
|
||||||
|
if (!fin?.ok) {
|
||||||
|
sendResponse({ ok: false, error: fin?.error ?? "license processing failed", log: fin?.log });
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
const s = fin.summary;
|
||||||
|
const saved = [];
|
||||||
|
// fetch both tracks, decrypt with the content key, mux into one mp4
|
||||||
|
const hold = await callOffscreen({
|
||||||
|
op: "fetchAndHold",
|
||||||
|
tabId,
|
||||||
|
dlId: msg.media.id,
|
||||||
|
files: (s.reps ?? []).map((rep) => ({
|
||||||
|
url: rep.url,
|
||||||
|
filename: `${rep.kind}.mp4.part`,
|
||||||
|
})),
|
||||||
|
});
|
||||||
|
if (!hold?.ok) {
|
||||||
|
sendResponse({ ok: false, error: hold?.error ?? "fetch failed", log: hold?.log });
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
const videoFile = (hold.held ?? []).find((h) => h.filename?.startsWith("video"));
|
||||||
|
const audioFile = (hold.held ?? []).find((h) => h.filename?.startsWith("audio"));
|
||||||
|
if (!videoFile?.ok) {
|
||||||
|
sendResponse({ ok: false, error: videoFile?.error ?? "video fetch failed" });
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
const keyB64 = btoa(String.fromCharCode(...(s.key ?? "").match(/../g).map((h) => parseInt(h, 16))));
|
||||||
|
const mux = await callOffscreen({
|
||||||
|
op: "decryptAndMux",
|
||||||
|
tabId,
|
||||||
|
dlId: msg.media.id,
|
||||||
|
videoId: videoFile.id,
|
||||||
|
audioId: audioFile?.ok ? audioFile.id : null,
|
||||||
|
keyB64,
|
||||||
|
});
|
||||||
|
if (!mux?.ok) {
|
||||||
|
sendResponse({ ok: false, error: mux?.error ?? "decrypt failed", log: mux?.log });
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
try {
|
||||||
|
const naming = await fileNamingOpts(msg.media, {
|
||||||
|
quality: "source", // DRM mux = the original-quality stream
|
||||||
|
ext: "mp4",
|
||||||
|
tabId,
|
||||||
|
});
|
||||||
|
const dl = await chrome.downloads.download({
|
||||||
|
url: mux.blobUrl,
|
||||||
|
filename: buildPath(naming),
|
||||||
|
conflictAction: "uniquify",
|
||||||
|
saveAs: false,
|
||||||
|
});
|
||||||
|
saved.push(`${mux.size}B`);
|
||||||
|
cleanupAfterDownload(dl, { urls: [mux.blobUrl], ids: mux.files ?? [] });
|
||||||
|
try {
|
||||||
|
// ground-truth capture is a build-time diagnostic — opt-in only,
|
||||||
|
// users shouldn't get a surprise ofsaver-drm-sample.json
|
||||||
|
const { drmDebug } = await chrome.storage.local.get("drmDebug");
|
||||||
|
if (drmDebug) {
|
||||||
|
const cap = await callOffscreen({ op: "getCapture" });
|
||||||
|
if (cap?.ok && cap.jsonB64) {
|
||||||
|
await chrome.downloads.download({ url: "data:application/json;base64," + cap.jsonB64, filename: "ofsaver-drm-sample.json", conflictAction: "overwrite", saveAs: false });
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} catch {}
|
||||||
|
} catch (e) {
|
||||||
|
saved.push(`ERR ${e.message}`);
|
||||||
|
// the blob URL and mux file would leak — free them anyway
|
||||||
|
callOffscreen({ op: "revokeUrls", urls: [mux.blobUrl] }).catch(() => {});
|
||||||
|
if (mux.files?.length) callOffscreen({ op: "dropHeld", ids: mux.files }).catch(() => {});
|
||||||
|
}
|
||||||
|
const okCount = saved.filter((x) => !x.startsWith("ERR")).length;
|
||||||
|
if (okCount > 0) await markSaved([msg.media.id]);
|
||||||
|
sendResponse({
|
||||||
|
ok: okCount > 0 && saved.every((x) => !x.startsWith("ERR")),
|
||||||
|
detail: "saved",
|
||||||
|
key: s.key,
|
||||||
|
kid: s.kid,
|
||||||
|
log: [...(res.log ?? []), `downloads: ${saved.join(" ")}`],
|
||||||
|
});
|
||||||
|
} catch (err) {
|
||||||
|
sendResponse({ ok: false, error: String(err.message ?? err) });
|
||||||
|
}
|
||||||
|
})();
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (msg.op === "getSaved") {
|
||||||
|
getSavedSet().then((set) => sendResponse({ ok: true, set }));
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
if (msg.op === "bundle") {
|
||||||
|
(async () => {
|
||||||
|
try {
|
||||||
|
let userId = null;
|
||||||
|
try {
|
||||||
|
const c = await chrome.cookies.get({ url: "https://onlyfans.com", name: "auth_id" });
|
||||||
|
userId = c?.value ?? null;
|
||||||
|
} catch {}
|
||||||
|
const stored = await chrome.storage.local.get(["singleScheme", "bulkScheme", "nameTemplate"]);
|
||||||
|
const res = await callOffscreen({ op: "bundle", who: msg.who, max: msg.max ?? 200, userId, naming: stored });
|
||||||
|
if (!res?.ok) {
|
||||||
|
sendResponse({ ok: false, error: res?.error ?? "bundle failed", log: res?.log });
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
const s = res.summary;
|
||||||
|
let started = 0;
|
||||||
|
for (const d of s.downloads ?? []) {
|
||||||
|
try {
|
||||||
|
await chrome.downloads.download({
|
||||||
|
url: d.url,
|
||||||
|
filename: safe(d.filename),
|
||||||
|
conflictAction: "uniquify",
|
||||||
|
saveAs: false,
|
||||||
|
});
|
||||||
|
started++;
|
||||||
|
} catch {}
|
||||||
|
}
|
||||||
|
if (s.savedIds?.length) await markSaved(s.savedIds);
|
||||||
|
sendResponse({
|
||||||
|
ok: true,
|
||||||
|
count: started,
|
||||||
|
keys: s.keys,
|
||||||
|
log: [...(res.log ?? []), `downloads started: ${started}`],
|
||||||
|
});
|
||||||
|
} catch (err) {
|
||||||
|
sendResponse({ ok: false, error: String(err.message ?? err) });
|
||||||
|
}
|
||||||
|
})();
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
chrome.action.onClicked.addListener(() => {
|
||||||
|
chrome.runtime.openOptionsPage();
|
||||||
|
});
|
||||||
|
|
||||||
|
// re-inject content scripts into every open OF tab after (re)install —
|
||||||
|
// otherwise their pills are orphaned and clicks die silently
|
||||||
|
async function injectEverywhere() {
|
||||||
|
for (const tab of await chrome.tabs.query({ url: "https://onlyfans.com/*" })) {
|
||||||
|
try {
|
||||||
|
await chrome.scripting.executeScript({ target: { tabId: tab.id }, world: "MAIN", files: ["lib/main-hook.js"] });
|
||||||
|
await chrome.scripting.executeScript({ target: { tabId: tab.id }, files: ["content.js"] });
|
||||||
|
} catch {}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
chrome.runtime.onInstalled.addListener(injectEverywhere);
|
||||||
|
chrome.runtime.onStartup.addListener(injectEverywhere);
|
||||||
790
ext/content.js
Normal file
790
ext/content.js
Normal file
@@ -0,0 +1,790 @@
|
|||||||
|
// Isolated world: per-media Download pills in post/message
|
||||||
|
// toolbars + a BUNDLE pill for multi-media groups. Menus offer quality
|
||||||
|
// variants; DRM media run the full license flow; saved media are marked.
|
||||||
|
(() => {
|
||||||
|
if (window.__ofsaverContentLoaded) return;
|
||||||
|
window.__ofsaverContentLoaded = true;
|
||||||
|
|
||||||
|
// drop pills left by a previous (orphaned) instance
|
||||||
|
document.querySelectorAll("[data-ofsaver-media]").forEach((el) => el.remove());
|
||||||
|
|
||||||
|
if (!document.getElementById("ofsaver-style")) {
|
||||||
|
const st = document.createElement("style");
|
||||||
|
st.id = "ofsaver-style";
|
||||||
|
st.textContent = "@keyframes ofsaverspin{to{transform:rotate(360deg)}}";
|
||||||
|
document.documentElement.appendChild(st);
|
||||||
|
}
|
||||||
|
|
||||||
|
const media = new Map(); // id -> entry
|
||||||
|
const buttons = new Map(); // key -> pill element
|
||||||
|
const savedSet = new Map(); // mediaId -> ts
|
||||||
|
let openMenu = null;
|
||||||
|
let activeBundle = null; // { btn, done, items } while a bundle runs
|
||||||
|
|
||||||
|
function refreshSaved() {
|
||||||
|
chrome.runtime.sendMessage({ op: "getSaved" }, (res) => {
|
||||||
|
if (res?.ok && res.set) {
|
||||||
|
for (const [id, ts] of Object.entries(res.set)) savedSet.set(id, ts);
|
||||||
|
render();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
refreshSaved();
|
||||||
|
|
||||||
|
function postMedia(postId) {
|
||||||
|
return [...media.values()].filter((m) => String(m.postId) === String(postId));
|
||||||
|
}
|
||||||
|
|
||||||
|
const POST_ANCHORS = [
|
||||||
|
(id) => document.getElementById(`postId_${id}`),
|
||||||
|
(id) => document.querySelector(`[data-post-id="${id}"]`),
|
||||||
|
];
|
||||||
|
const TOOLBARS = [".b-post__tools", ".b-post__actions", ".feed-item-stats"];
|
||||||
|
const MESSAGE_ANCHORS = [
|
||||||
|
(id) => document.querySelector(`[data-message-id="${id}"]`),
|
||||||
|
(id) => document.getElementById(`messageId_${id}`),
|
||||||
|
];
|
||||||
|
const MESSAGE_TOOLBARS = [".m-chat-message__actions"];
|
||||||
|
|
||||||
|
function findToolbar(postId) {
|
||||||
|
for (const anchor of POST_ANCHORS) {
|
||||||
|
const root = anchor(postId);
|
||||||
|
if (!root) continue;
|
||||||
|
for (const sel of TOOLBARS) {
|
||||||
|
const bar = root.querySelector(sel) ?? (root.matches(sel) ? root : null);
|
||||||
|
if (bar) return bar;
|
||||||
|
}
|
||||||
|
return root;
|
||||||
|
}
|
||||||
|
for (const anchor of MESSAGE_ANCHORS) {
|
||||||
|
const root = anchor(postId);
|
||||||
|
if (!root) continue;
|
||||||
|
for (const sel of MESSAGE_TOOLBARS) {
|
||||||
|
const bar = root.querySelector(sel) ?? (root.matches(sel) ? root : null);
|
||||||
|
if (bar) return bar;
|
||||||
|
}
|
||||||
|
return root;
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
function pageUsername() {
|
||||||
|
if (/\/my\/chats\//.test(location.pathname)) return null; // chat routes have no creator in the path
|
||||||
|
const segs = location.pathname.split("/").filter(Boolean);
|
||||||
|
for (let i = segs.length - 1; i >= 0; i--) {
|
||||||
|
if (!/^\d+$/.test(segs[i]) && segs[i].length > 1) return segs[i];
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
// ---- pills -------------------------------------------------------------
|
||||||
|
|
||||||
|
const BADGES = { photo: "PIC", video: "VID", gif: "GIF", audio: "AUD" };
|
||||||
|
|
||||||
|
function fmtDuration(sec) {
|
||||||
|
const s = Math.round(Number(sec) || 0);
|
||||||
|
if (!s) return "";
|
||||||
|
return `${Math.floor(s / 60)}:${String(s % 60).padStart(2, "0")}`;
|
||||||
|
}
|
||||||
|
|
||||||
|
const SPINNER = `<span style="width:12px;height:12px;flex:none;border:2px solid #d8d8de;border-top-color:#e5484d;border-radius:50%;display:inline-block;animation:ofsaverspin .7s linear infinite"></span>`;
|
||||||
|
|
||||||
|
function pillEl(key) {
|
||||||
|
let btn = buttons.get(key);
|
||||||
|
if (btn && btn.isConnected) return btn;
|
||||||
|
btn = document.createElement("div");
|
||||||
|
btn.dataset.ofsaverMedia = key;
|
||||||
|
btn.__ofsaverMine = true;
|
||||||
|
btn.style.cssText =
|
||||||
|
"display:inline-flex;align-items:center;gap:4px;margin-left:8px;cursor:pointer;user-select:none;flex:none;vertical-align:middle;";
|
||||||
|
buttons.set(key, btn);
|
||||||
|
return btn;
|
||||||
|
}
|
||||||
|
|
||||||
|
function pillInner(entry, status, pct) {
|
||||||
|
const hasDrm = Boolean(entry.drm);
|
||||||
|
const saved = savedSet.has(String(entry.id));
|
||||||
|
const dur = fmtDuration(entry.duration);
|
||||||
|
const label = status === "loading" ? `Downloading ${pct ?? 0}%` : (status || (saved ? "Saved" : "Download"));
|
||||||
|
return (
|
||||||
|
`<span style="background:#fff;border-radius:8px;color:#111;font:600 13px/1 -apple-system,system-ui,sans-serif;padding:6px 10px;display:inline-flex;align-items:center;gap:6px;box-shadow:0 1px 2px rgba(0,0,0,.25);position:relative;overflow:hidden">` +
|
||||||
|
(status === "loading" && pct != null ? `<span data-bar style="position:absolute;left:0;bottom:0;height:2px;background:#e5484d;width:${pct}%;transition:width .2s"></span>` : "") +
|
||||||
|
(status === "loading" ? SPINNER : "") +
|
||||||
|
`<span data-label>${label}</span>` +
|
||||||
|
(dur && !status ? `<span style="color:#e5484d;font-size:11px">· ${dur}</span>` : "") +
|
||||||
|
`<span style="font-size:9px;opacity:.6">▼</span></span>` +
|
||||||
|
(hasDrm ? `<span style="background:#111;color:#fff;border-radius:6px;font:700 10px/1 -apple-system,system-ui,sans-serif;padding:4px 7px;display:inline-flex;align-items:center">DRM</span>` : "") +
|
||||||
|
(saved && !status ? `<span style="color:#23a55a;font:600 12px -apple-system,system-ui,sans-serif">✓</span>` : "")
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
function paintPill(btn, entry, status, pct) {
|
||||||
|
pct = pct ?? (Number(btn.dataset.pct) || 0);
|
||||||
|
if (status === "loading" && btn.dataset.status === "loading" && btn.querySelector("[data-bar]")) {
|
||||||
|
paintPillProgress(btn, pct); // smooth: update label + bar in place
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
btn.innerHTML = pillInner(entry, status, pct);
|
||||||
|
}
|
||||||
|
function paintPillProgress(btn, pct) {
|
||||||
|
btn.dataset.pct = pct;
|
||||||
|
const lbl = btn.querySelector("[data-label]");
|
||||||
|
if (lbl) lbl.textContent = `Downloading ${pct}%`;
|
||||||
|
const bar = btn.querySelector("[data-bar]");
|
||||||
|
if (bar) bar.style.width = pct + "%";
|
||||||
|
}
|
||||||
|
|
||||||
|
function paintBundlePill(btn, count, status, pct) {
|
||||||
|
const saved = status === "saved";
|
||||||
|
btn.innerHTML =
|
||||||
|
`<span style="background:#fff;border-radius:8px;color:#111;font:600 13px/1 -apple-system,system-ui,sans-serif;padding:6px 10px;display:inline-flex;align-items:center;gap:6px;box-shadow:0 1px 2px rgba(0,0,0,.25);position:relative;overflow:hidden">` +
|
||||||
|
(status === "loading" && pct != null ? `<span data-bar style="position:absolute;left:0;bottom:0;height:2px;background:#e5484d;width:${pct}%;transition:width .2s"></span>` : "") +
|
||||||
|
(status === "loading" ? SPINNER : "") +
|
||||||
|
`<span data-blabel>${status === "loading" ? (pct != null ? `Downloading ${pct}%` : "Downloading…") : saved ? "Saved" : "Download all"}</span>` +
|
||||||
|
`<span style="color:#888;font-size:11px">${count}</span></span>`;
|
||||||
|
}
|
||||||
|
|
||||||
|
/** In-place bundle label/bar update (no innerHTML churn). */
|
||||||
|
function paintBundleProgress(btn, text, pct) {
|
||||||
|
btn.dataset.pct = pct ?? "";
|
||||||
|
const lbl = btn.querySelector("[data-blabel]");
|
||||||
|
if (lbl) lbl.textContent = text;
|
||||||
|
const bar = btn.querySelector("[data-bar]");
|
||||||
|
if (pct != null) {
|
||||||
|
if (bar) { bar.style.width = pct + "%"; return; }
|
||||||
|
// no bar yet (pill was painted without one) — add it
|
||||||
|
const shell = btn.firstElementChild;
|
||||||
|
if (shell) {
|
||||||
|
const el = document.createElement("span");
|
||||||
|
el.dataset.bar = "";
|
||||||
|
el.style.cssText = "position:absolute;left:0;bottom:0;height:2px;background:#e5484d;width:" + pct + "%;transition:width .2s";
|
||||||
|
shell.prepend(el);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// ---- menu --------------------------------------------------------------
|
||||||
|
|
||||||
|
function closeMenu() {
|
||||||
|
openMenu?.remove();
|
||||||
|
openMenu = null;
|
||||||
|
}
|
||||||
|
document.addEventListener("click", (e) => {
|
||||||
|
if (openMenu && !openMenu.contains(e.target) && !e.target.closest("[data-ofsaver-media]")) closeMenu();
|
||||||
|
}, true);
|
||||||
|
|
||||||
|
const fmtSize = (n) => {
|
||||||
|
if (!n || n <= 0) return "";
|
||||||
|
if (n < 1024 * 1024) return Math.max(1, Math.round(n / 1024)) + " KB";
|
||||||
|
return (n / (1024 * 1024)).toFixed(1) + " MB";
|
||||||
|
};
|
||||||
|
|
||||||
|
function qualityOptions(entry) {
|
||||||
|
const out = [];
|
||||||
|
const files = entry.raw?.files ?? {};
|
||||||
|
if (entry.type === "photo" || entry.type === "gif") {
|
||||||
|
if (files.full?.url) out.push({ label: "source", url: files.full.url, ext: entry.type === "gif" ? "gif" : "jpg", size: files.full?.size });
|
||||||
|
if (!files.full?.url && files.preview?.url) out.push({ label: "preview", url: files.preview.url, ext: "jpg" });
|
||||||
|
} else if (entry.drm) {
|
||||||
|
out.push({ label: "source", drm: true, size: files.source?.size });
|
||||||
|
} else {
|
||||||
|
const vs = entry.raw?.videoSources;
|
||||||
|
const variants = [];
|
||||||
|
if (Array.isArray(vs)) for (const v of vs) if (v?.url) variants.push(v);
|
||||||
|
else if (files.source?.sources) for (const v of files.source.sources) if (v?.url) variants.push(v);
|
||||||
|
const seen = new Set();
|
||||||
|
for (const v of variants) {
|
||||||
|
if (seen.has(v.url)) continue;
|
||||||
|
seen.add(v.url);
|
||||||
|
out.push({ label: v.height ? v.height + "p" : (v.type ?? "video"), url: v.url, ext: "mp4", size: v.size ?? files.source?.size });
|
||||||
|
}
|
||||||
|
if (files.source?.url) out.push({ label: "source", url: files.source.url, ext: "mp4", size: files.source?.size });
|
||||||
|
else if (files.full?.url) out.push({ label: "source", url: files.full.url, ext: "mp4", size: files.full?.size });
|
||||||
|
}
|
||||||
|
return out;
|
||||||
|
}
|
||||||
|
|
||||||
|
function thumbFor(entry) {
|
||||||
|
return (
|
||||||
|
entry.raw?.files?.preview?.url ??
|
||||||
|
entry.raw?.files?.full?.url ??
|
||||||
|
entry.raw?.files?.source?.url ??
|
||||||
|
""
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
/** Backfill: if the DOM shows more media than we indexed, fetch the post. */
|
||||||
|
async function backfillIfNeeded(postId, entries, root) {
|
||||||
|
if (!root) return;
|
||||||
|
const countEl = [...root.querySelectorAll("*")].find((el) =>
|
||||||
|
el.children.length === 0 && /^\s*\d+\s*\/\s*\d+\s*$/.test(el.textContent ?? "")
|
||||||
|
);
|
||||||
|
if (!countEl) return;
|
||||||
|
const expected = Number(countEl.textContent.split("/")[1]);
|
||||||
|
if (!expected || expected <= entries.length) return;
|
||||||
|
const any = entries[0];
|
||||||
|
const res = await new Promise((r) =>
|
||||||
|
chrome.runtime.sendMessage(
|
||||||
|
{ op: "fetchPostMedia", postId, creatorId: any?.creatorId, username: any?.username ?? pageUsername() },
|
||||||
|
r
|
||||||
|
)
|
||||||
|
);
|
||||||
|
if (res?.ok && res.data) {
|
||||||
|
window.dispatchEvent(new CustomEvent("ofsaver-ingest", { detail: res.data }));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function toggleMenu(btn, entry) {
|
||||||
|
const key = String(entry.id);
|
||||||
|
if (openMenu && openMenu.dataset.media === key) { closeMenu(); return; }
|
||||||
|
closeMenu();
|
||||||
|
const who = entry.username ? `@${entry.username}` : (entry.creatorId ? `#${entry.creatorId}` : "");
|
||||||
|
const menu = document.createElement("div");
|
||||||
|
menu.dataset.media = key;
|
||||||
|
menu.style.cssText = [
|
||||||
|
"position:absolute", "z-index:1000000", "background:#fff", "color:#111",
|
||||||
|
"border-radius:14px", "padding:14px 16px", "min-width:340px",
|
||||||
|
"max-height:65vh", "overflow:auto", "box-shadow:0 8px 32px rgba(0,0,0,.35)",
|
||||||
|
"font:13px/1.5 -apple-system,system-ui,sans-serif",
|
||||||
|
].join(";");
|
||||||
|
|
||||||
|
const opts = qualityOptions(entry);
|
||||||
|
const thumb = thumbFor(entry);
|
||||||
|
const rows = [];
|
||||||
|
opts.forEach((opt, i) => {
|
||||||
|
const isSaved = savedSet.has(String(entry.id));
|
||||||
|
rows.push(
|
||||||
|
`<div style="display:flex;align-items:center;gap:10px;padding:6px 0${isSaved ? ";opacity:.55" : ""}">` +
|
||||||
|
(thumb
|
||||||
|
? `<img src="${thumb}" style="width:44px;height:44px;border-radius:8px;object-fit:cover;flex:none" referrerpolicy="no-referrer">`
|
||||||
|
: `<div style="width:44px;height:44px;border-radius:8px;background:#eee;flex:none"></div>`) +
|
||||||
|
`<div style="flex:1;min-width:0"><div style="font-weight:600">${opt.label}${isSaved ? ` <span style="color:#23a55a;font-size:11px;font-weight:700">saved</span>` : ""}</div>` +
|
||||||
|
`<div style="font-size:11px;color:#777">${fmtSize(opt.size)}</div></div>` +
|
||||||
|
`<button data-idx="${i}" title="download" style="width:34px;height:34px;border-radius:50%;border:1px solid #f3c1c3;background:#fdf3f4;color:#e5484d;font-size:14px;cursor:pointer;flex:none">${isSaved ? "↻" : "⬇"}</button>` +
|
||||||
|
`</div>`
|
||||||
|
);
|
||||||
|
});
|
||||||
|
if (!opts.length) rows.push(`<div style="color:#888;padding:8px 0">no downloadable media</div>`);
|
||||||
|
|
||||||
|
menu.innerHTML =
|
||||||
|
`<div style="display:flex;align-items:baseline;gap:8px;margin-bottom:4px">` +
|
||||||
|
`<div style="font-weight:700;font-size:14px">${entry.type} by ${who}</div>` +
|
||||||
|
`<button data-close style="margin-left:auto;border:0;background:none;font-size:14px;cursor:pointer;color:#888">✕</button>` +
|
||||||
|
`</div>` +
|
||||||
|
rows.join("");
|
||||||
|
|
||||||
|
menu.querySelector("[data-close]")?.addEventListener("click", closeMenu);
|
||||||
|
menu.querySelectorAll("button[data-idx]").forEach((b) => {
|
||||||
|
b.addEventListener("click", () => {
|
||||||
|
const opt = opts[Number(b.dataset.idx)];
|
||||||
|
closeMenu();
|
||||||
|
runOne(entry, opt, btn);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
document.body.appendChild(menu);
|
||||||
|
const r = btn.getBoundingClientRect();
|
||||||
|
menu.style.left = Math.max(8, Math.min(r.left - 120, window.innerWidth - 380)) + "px";
|
||||||
|
menu.style.top = r.bottom + window.scrollY + 8 + "px";
|
||||||
|
openMenu = menu;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Watchdog: resolve a hard failure if the SW never answers — but dlProgress
|
||||||
|
// activity re-arms the timer, so a slow multi-GB item is never killed mid-
|
||||||
|
// flight. Registered per media id so the dlProgress handler can feed it.
|
||||||
|
const pendingTouches = new Map(); // mediaId -> arm()
|
||||||
|
function sendMessageP(msg, timeoutMs = 300000) {
|
||||||
|
return new Promise((resolve) => {
|
||||||
|
let done = false;
|
||||||
|
let timer = null;
|
||||||
|
const finish = (res) => {
|
||||||
|
if (done) return;
|
||||||
|
done = true;
|
||||||
|
pendingTouches.delete(String(msg.media?.id));
|
||||||
|
clearTimeout(timer);
|
||||||
|
resolve(res);
|
||||||
|
};
|
||||||
|
const arm = () => {
|
||||||
|
clearTimeout(timer);
|
||||||
|
timer = setTimeout(() => finish({ ok: false, error: `no response in ${Math.round(timeoutMs / 1000)}s` }), timeoutMs);
|
||||||
|
};
|
||||||
|
arm();
|
||||||
|
if (msg.media?.id != null) pendingTouches.set(String(msg.media.id), arm);
|
||||||
|
try {
|
||||||
|
chrome.runtime.sendMessage(msg, (res) => {
|
||||||
|
if (chrome.runtime.lastError) finish({ ok: false, error: chrome.runtime.lastError.message });
|
||||||
|
else finish(res ?? { ok: false, error: "no response" });
|
||||||
|
});
|
||||||
|
} catch (e) { finish({ ok: false, error: String(e.message ?? e) }) }
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
/** Ask the offscreen doc for its last log line — names the stage that's
|
||||||
|
* stuck when an item dies without a response. 3s budget: if the offscreen
|
||||||
|
* can't even answer this, its event loop is blocked (that's the answer). */
|
||||||
|
async function probeOffscreenLog() {
|
||||||
|
try {
|
||||||
|
const res = await Promise.race([
|
||||||
|
new Promise((r) => {
|
||||||
|
try { chrome.runtime.sendMessage({ op: "lastLog" }, (x) => r(chrome.runtime.lastError ? null : x)); } catch { r(null); }
|
||||||
|
}),
|
||||||
|
new Promise((r) => setTimeout(() => r(null), 3000)),
|
||||||
|
]);
|
||||||
|
return res?.ok ? String(res.line ?? "") : null;
|
||||||
|
} catch { return null; }
|
||||||
|
}
|
||||||
|
|
||||||
|
async function runOne(entry, opt, btn) {
|
||||||
|
if (btn) { btn.__entry = entry; btn.dataset.status = "loading"; paintPill(btn, entry, "loading", 0); }
|
||||||
|
const quality = /^\d+p$/.test(opt.label) ? opt.label : (opt.label === "source" ? "source" : null);
|
||||||
|
const enriched = { ...entry, username: entry.username ?? pageUsername() };
|
||||||
|
const msg = opt.drm
|
||||||
|
? { op: "download", media: { ...enriched, responseType: entry.responseType ?? "post" } }
|
||||||
|
: { op: "downloadUrl", url: opt.url, media: enriched, ext: opt.ext, quality };
|
||||||
|
const res = await sendMessageP(msg);
|
||||||
|
if (res?.ok) {
|
||||||
|
savedSet.set(String(entry.id), Date.now());
|
||||||
|
if (btn) { delete btn.dataset.status; paintPill(btn, entry); }
|
||||||
|
} else {
|
||||||
|
const err = String(res?.error ?? "failed").slice(0, 90);
|
||||||
|
console.log("[ofsaver] download failed:", err);
|
||||||
|
if (btn) {
|
||||||
|
btn.innerHTML =
|
||||||
|
`<span style="background:#fff;border-radius:8px;color:#c2333a;font:600 11px/1.2 -apple-system,system-ui,sans-serif;padding:6px 10px;display:inline-flex;align-items:center;max-width:340px;word-break:break-word">${err}</span>`;
|
||||||
|
setTimeout(() => { delete btn.dataset.status; paintPill(btn, entry); }, 8000);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
async function runBundle(postId, entries, btn) {
|
||||||
|
if (btn) { btn.dataset.status = "loading"; btn.dataset.pct = 0; paintBundlePill(btn, entries.length, "loading", 0); }
|
||||||
|
activeBundle = { btn, done: 0, items: entries };
|
||||||
|
let i = 0, ok = 0, fail = 0, firstError = null;
|
||||||
|
const n = entries.length;
|
||||||
|
const step = async () => {
|
||||||
|
if (i >= n) {
|
||||||
|
activeBundle = null;
|
||||||
|
if (btn) {
|
||||||
|
delete btn.dataset.status;
|
||||||
|
if (fail === 0) for (const e of entries) savedSet.set(String(e.id), Date.now());
|
||||||
|
if (fail === 0) {
|
||||||
|
paintBundlePill(btn, n, "saved");
|
||||||
|
setTimeout(() => { delete btn.dataset.status; paintBundlePill(btn, n); }, 3000);
|
||||||
|
} else {
|
||||||
|
const err = String(firstError ?? `${fail} failed`).slice(0, 90);
|
||||||
|
console.log("[ofsaver] bundle finished with failures:", fail, firstError);
|
||||||
|
btn.innerHTML =
|
||||||
|
`<span style="background:#fff;border-radius:8px;color:#c2333a;font:600 11px/1.2 -apple-system,system-ui,sans-serif;padding:6px 10px;display:inline-flex;align-items:center;max-width:340px;word-break:break-word">${err}</span>`;
|
||||||
|
setTimeout(() => { delete btn.dataset.status; paintBundlePill(btn, n); }, 8000);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
const entry = entries[i++];
|
||||||
|
const k = i; // 1-based index of the item now starting
|
||||||
|
if (activeBundle) activeBundle.done = i - 1;
|
||||||
|
if (btn?.isConnected) paintBundleProgress(btn, `${k}/${n}`, Math.round(((k - 1) / n) * 100));
|
||||||
|
const opts = qualityOptions(entry);
|
||||||
|
if (!opts.length) { await step(); return; }
|
||||||
|
const quality = /^\d+p$/.test(opts[0].label) ? opts[0].label : (opts[0].label === "source" ? "source" : null);
|
||||||
|
const enriched = { ...entry, username: entry.username ?? pageUsername() };
|
||||||
|
const msg = opts[0].drm
|
||||||
|
? { op: "download", media: { ...enriched, responseType: entry.responseType ?? "post" } }
|
||||||
|
: { op: "downloadUrl", url: opts[0].url, media: enriched, ext: opts[0].ext, quality };
|
||||||
|
const res = await sendMessageP(msg);
|
||||||
|
if (res?.ok) {
|
||||||
|
ok++;
|
||||||
|
} else {
|
||||||
|
fail++;
|
||||||
|
const err = String(res?.error ?? "failed").slice(0, 60);
|
||||||
|
const line = await probeOffscreenLog();
|
||||||
|
const shown = line ? `${err} · ${line}` : err;
|
||||||
|
firstError = firstError ?? shown;
|
||||||
|
console.log(`[ofsaver] bundle item ${k}/${n} (${entry.type} ${entry.id}) failed:`, shown);
|
||||||
|
if (btn?.isConnected) paintBundleProgress(btn, `${k}/${n} · ${err.slice(0, 40)}`, null);
|
||||||
|
}
|
||||||
|
await step();
|
||||||
|
};
|
||||||
|
await step();
|
||||||
|
}
|
||||||
|
|
||||||
|
// ---- injection ---------------------------------------------------------
|
||||||
|
|
||||||
|
function expectedCount(root) {
|
||||||
|
if (!root) return 0;
|
||||||
|
const countEl = [...root.querySelectorAll("*")].find((el) =>
|
||||||
|
el.children.length === 0 && /^\s*\d+\s*\/\s*\d+\s*$/.test(el.textContent ?? "")
|
||||||
|
);
|
||||||
|
if (!countEl) return 0;
|
||||||
|
return Number(countEl.textContent.split("/")[1]) || 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
function render() {
|
||||||
|
const postIds = new Set(
|
||||||
|
[...media.values()].filter((m) => m.postId != null).map((m) => String(m.postId))
|
||||||
|
);
|
||||||
|
for (const postId of postIds) {
|
||||||
|
const bar = findToolbar(postId);
|
||||||
|
if (!bar) continue;
|
||||||
|
const entries = postMedia(postId);
|
||||||
|
|
||||||
|
// backfill once when the DOM advertises more media than we indexed
|
||||||
|
const root = bar.closest('[id^="postId_"],[data-post-id],[data-message-id]');
|
||||||
|
if (entries.length && entries.length < expectedCount(root)) {
|
||||||
|
const marker = `bf_${postId}`;
|
||||||
|
if (!bar.dataset[marker]) {
|
||||||
|
bar.dataset[marker] = "1";
|
||||||
|
backfillIfNeeded(postId, entries, root);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
const withOpts = entries.filter((e) => qualityOptions(e).length);
|
||||||
|
// BUNDLE pill first (toolbars clip on the right; it must stay visible)
|
||||||
|
if (withOpts.length > 1) {
|
||||||
|
const key = `b_${postId}`;
|
||||||
|
const btn = pillEl(key);
|
||||||
|
if (!btn.isConnected) {
|
||||||
|
btn.addEventListener("click", (ev) => {
|
||||||
|
ev.preventDefault();
|
||||||
|
ev.stopPropagation();
|
||||||
|
runBundle(postId, withOpts, btn);
|
||||||
|
});
|
||||||
|
bar.prepend(btn);
|
||||||
|
}
|
||||||
|
if (btn.dataset.status !== "loading") paintBundlePill(btn, withOpts.length, btn.dataset.status);
|
||||||
|
}
|
||||||
|
for (const entry of withOpts) {
|
||||||
|
const key = `m_${entry.id}`;
|
||||||
|
const btn = pillEl(key);
|
||||||
|
if (!btn.isConnected) {
|
||||||
|
btn.addEventListener("click", (ev) => {
|
||||||
|
ev.preventDefault();
|
||||||
|
ev.stopPropagation();
|
||||||
|
toggleMenu(btn, entry);
|
||||||
|
});
|
||||||
|
bar.appendChild(btn);
|
||||||
|
}
|
||||||
|
paintPill(btn, entry, btn.dataset.status);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
renderChat();
|
||||||
|
}
|
||||||
|
|
||||||
|
// MAIN world pushes the full store whenever new media shows up
|
||||||
|
window.addEventListener("ofsaver-media-data", (e) => {
|
||||||
|
for (const it of e.detail ?? []) media.set(it.id, it);
|
||||||
|
render();
|
||||||
|
});
|
||||||
|
|
||||||
|
// id → handle pairs seen in any API response (naming fallback)
|
||||||
|
const userNames = new Map();
|
||||||
|
window.addEventListener("ofsaver-users", (e) => {
|
||||||
|
for (const [id, u] of e.detail ?? []) userNames.set(String(id), u);
|
||||||
|
});
|
||||||
|
|
||||||
|
chrome.runtime.onMessage.addListener((msg, _s, sendResponse) => {
|
||||||
|
if (msg.op === "ingest" && msg.data) {
|
||||||
|
// refreshed media data (fresh DRM signatures) from the background
|
||||||
|
window.dispatchEvent(new CustomEvent("ofsaver-ingest", { detail: msg.data }));
|
||||||
|
sendResponse({ ok: true });
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (msg.op === "whoIs") {
|
||||||
|
// sender username for a media id, straight from what the page has
|
||||||
|
// already shown us — no API call needed (naming fallback)
|
||||||
|
let username = null;
|
||||||
|
outer: for (const st of chatState.values()) {
|
||||||
|
for (const m of st.chrono) {
|
||||||
|
if ((m.media ?? []).some((x) => String(x.id) === String(msg.mediaId))) {
|
||||||
|
username = m.username ?? null;
|
||||||
|
break outer;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (!username && msg.creatorId != null) username = userNames.get(String(msg.creatorId)) ?? null;
|
||||||
|
sendResponse({ ok: true, username });
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (msg.op === "getAuth") {
|
||||||
|
// session identity captured by the MAIN-world hook from the page's own
|
||||||
|
// signed API requests — correct even in incognito
|
||||||
|
try {
|
||||||
|
const raw = document.documentElement.getAttribute("data-ofsaver-auth");
|
||||||
|
sendResponse({ ok: true, auth: raw ? JSON.parse(raw) : null });
|
||||||
|
} catch { sendResponse({ ok: true, auth: null }); }
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (msg.op === "dlProgress") {
|
||||||
|
const pct = Math.max(0, Math.min(100, Number(msg.pct) || 0));
|
||||||
|
pendingTouches.get(String(msg.id))?.(); // activity: re-arm the watchdog
|
||||||
|
const btn = buttons.get(`m_${msg.id}`);
|
||||||
|
if (btn && btn.dataset.status === "loading") paintPillProgress(btn, pct);
|
||||||
|
if (activeBundle && activeBundle.btn?.isConnected) {
|
||||||
|
const n = activeBundle.items.length;
|
||||||
|
const k = Math.min(n, activeBundle.done + 1); // item in flight
|
||||||
|
const overall = Math.min(100, Math.round(((activeBundle.done + pct / 100) / n) * 100));
|
||||||
|
paintBundleProgress(activeBundle.btn, `${k}/${n} · ${overall}%`, overall);
|
||||||
|
}
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (msg.op === "savedUpdated") {
|
||||||
|
for (const id of msg.ids ?? []) savedSet.set(String(id), Date.now());
|
||||||
|
render();
|
||||||
|
sendResponse({});
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (msg.op === "licensePost") {
|
||||||
|
// same-origin relay: the page's origin is what OF's CORS check accepts
|
||||||
|
(async () => {
|
||||||
|
try {
|
||||||
|
const body = Uint8Array.from(atob(msg.bodyB64), (c) => c.charCodeAt(0));
|
||||||
|
const res = await fetch(msg.url, { method: "POST", credentials: "include", headers: msg.headers, body });
|
||||||
|
const buf = new Uint8Array(await res.arrayBuffer());
|
||||||
|
let bin = "";
|
||||||
|
for (const b of buf) bin += String.fromCharCode(b);
|
||||||
|
if (!res.ok) console.log("[ofsaver] license relay status:", res.status);
|
||||||
|
sendResponse({ ok: res.ok, status: res.status, bodyB64: btoa(bin) });
|
||||||
|
} catch (e) {
|
||||||
|
sendResponse({ ok: false, error: String(e.message ?? e) });
|
||||||
|
}
|
||||||
|
})();
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
// orphaned instances (extension reloaded under us) must stop rendering —
|
||||||
|
// otherwise they keep re-adding duplicate pills forever. The LAST injected
|
||||||
|
// instance owns the token; older ones see a mismatch and self-terminate.
|
||||||
|
const myToken = Math.random().toString(36).slice(2);
|
||||||
|
document.documentElement.setAttribute("data-ofsaver-inst", myToken);
|
||||||
|
const renderTimer = setInterval(() => {
|
||||||
|
try {
|
||||||
|
if (document.documentElement.getAttribute("data-ofsaver-inst") !== myToken) {
|
||||||
|
throw new Error("superseded");
|
||||||
|
}
|
||||||
|
void chrome.runtime.id;
|
||||||
|
render();
|
||||||
|
} catch {
|
||||||
|
clearInterval(renderTimer);
|
||||||
|
document.querySelectorAll("[data-ofsaver-media]").forEach((el) => {
|
||||||
|
if (el.__ofsaverMine) el.remove();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}, 1500);
|
||||||
|
|
||||||
|
// ---- chat pills (new OF chat UI) ----------------------------------------
|
||||||
|
// Chat rows carry [at-attr="chat_message"] but expose NO message/media ids.
|
||||||
|
// Rows are mapped to API messages positionally (the messages list order
|
||||||
|
// mirrors the row order); locked media (no files in the API) get a
|
||||||
|
// duration pill instead of a download. Pills mount in their own
|
||||||
|
// flex-wrap block at the bottom of the row — never inside
|
||||||
|
// .b-chat__message__controls (a non-wrapping flex strip that shoves the
|
||||||
|
// media swiper off-view when filled).
|
||||||
|
document.documentElement.dataset.ofsaverV = "0.5.14";
|
||||||
|
const diagTick = () => { document.documentElement.dataset.ofsaverMediaCount = String(media.size); };
|
||||||
|
|
||||||
|
const CHAT_ROW_SEL = '.b-chat__messages-wrapper [at-attr="chat_message"]';
|
||||||
|
const chatState = new Map(); // chatId -> { chrono: [], seen: Set }
|
||||||
|
|
||||||
|
const TYPE_LABELS = { video: "Videos", photo: "Photos", gif: "GIFs", audio: "Audio" };
|
||||||
|
|
||||||
|
function paintGroupPill(btn, label, count, status, pct) {
|
||||||
|
const saved = status === "saved";
|
||||||
|
const loading = status === "loading";
|
||||||
|
const text = loading ? (pct != null ? `Downloading ${pct}%` : "Downloading…") : saved ? "Saved" : label;
|
||||||
|
btn.innerHTML =
|
||||||
|
`<span style="background:#fff;border-radius:8px;color:#111;font:600 13px/1 -apple-system,system-ui,sans-serif;padding:6px 10px;display:inline-flex;align-items:center;gap:6px;box-shadow:0 1px 2px rgba(0,0,0,.25);position:relative;overflow:hidden">` +
|
||||||
|
(loading && pct != null ? `<span data-bar style="position:absolute;left:0;bottom:0;height:2px;background:#e5484d;width:${pct}%;transition:width .2s"></span>` : "") +
|
||||||
|
(loading ? SPINNER : "") +
|
||||||
|
`<span data-blabel>${text}</span>` +
|
||||||
|
(!loading && !saved ? `<span style="color:#888;font-size:11px">${count}</span>` : "") +
|
||||||
|
(saved ? `<span style="color:#23a55a;font:600 12px -apple-system,system-ui,sans-serif">✓</span>` : "") +
|
||||||
|
`</span>`;
|
||||||
|
}
|
||||||
|
|
||||||
|
function attachPills(bar, entries, groupKey) {
|
||||||
|
// bundles: one pill per media type ("Videos 3", "Photos 22") instead of a
|
||||||
|
// pill per media — individual pills overflow post toolbars and flood
|
||||||
|
// chat rows. Single media keeps the quality menu.
|
||||||
|
if (entries.length > 1) {
|
||||||
|
const groups = new Map();
|
||||||
|
for (const e of entries) {
|
||||||
|
const t = TYPE_LABELS[e.type] ? e.type : "video";
|
||||||
|
if (!groups.has(t)) groups.set(t, []);
|
||||||
|
groups.get(t).push(e);
|
||||||
|
}
|
||||||
|
const single = groups.size === 1;
|
||||||
|
for (const [t, list] of groups) {
|
||||||
|
const key = `b_${groupKey}_${t}`;
|
||||||
|
const btn = pillEl(key);
|
||||||
|
const label = single ? `Download all` : (TYPE_LABELS[t] ?? t);
|
||||||
|
if (!btn.isConnected) {
|
||||||
|
btn.addEventListener("click", (ev) => {
|
||||||
|
ev.preventDefault();
|
||||||
|
ev.stopPropagation();
|
||||||
|
runBundle(null, list, btn);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
bar.appendChild(btn);
|
||||||
|
// loading pills are owned by runBundle/dlProgress (live k/N + pct) —
|
||||||
|
// repainting here fights them and the label flickers every tick
|
||||||
|
if (btn.dataset.status !== "loading") paintGroupPill(btn, label, list.length, btn.dataset.status);
|
||||||
|
}
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
const entry = entries[0];
|
||||||
|
const key = `m_${entry.id}`;
|
||||||
|
const btn = pillEl(key);
|
||||||
|
if (!btn.isConnected) {
|
||||||
|
btn.addEventListener("click", (ev) => {
|
||||||
|
ev.preventDefault();
|
||||||
|
ev.stopPropagation();
|
||||||
|
toggleMenu(btn, entry);
|
||||||
|
});
|
||||||
|
bar.appendChild(btn);
|
||||||
|
}
|
||||||
|
paintPill(btn, entry, btn.dataset.status);
|
||||||
|
}
|
||||||
|
|
||||||
|
window.addEventListener("ofsaver-chat-batch", (e) => {
|
||||||
|
try {
|
||||||
|
const { chatId, msgs } = e.detail ?? {};
|
||||||
|
if (!chatId || !Array.isArray(msgs) || !msgs.length) return;
|
||||||
|
let st = chatState.get(chatId);
|
||||||
|
if (!st) { st = { chrono: [], seen: new Set() }; chatState.set(chatId, st); }
|
||||||
|
const chrono = [...msgs].reverse(); // oldest → newest
|
||||||
|
const nums = chrono.map((m) => Number(m.id)).filter((x) => !Number.isNaN(x));
|
||||||
|
if (st.seen.size === 0) {
|
||||||
|
st.chrono = chrono;
|
||||||
|
} else {
|
||||||
|
const seenNums = [...st.seen].map(Number).filter((x) => !Number.isNaN(x));
|
||||||
|
const minSeen = seenNums.length ? Math.min(...seenNums) : Infinity;
|
||||||
|
const maxSeen = seenNums.length ? Math.max(...seenNums) : -Infinity;
|
||||||
|
const batchMin = nums.length ? Math.min(...nums) : Infinity;
|
||||||
|
const batchMax = nums.length ? Math.max(...nums) : -Infinity;
|
||||||
|
if (batchMax < minSeen) st.chrono = [...chrono, ...st.chrono]; // history scroll-up
|
||||||
|
else if (batchMin > maxSeen) st.chrono = [...st.chrono, ...chrono]; // live messages
|
||||||
|
}
|
||||||
|
for (const m of chrono) st.seen.add(String(m.id));
|
||||||
|
render();
|
||||||
|
} catch {}
|
||||||
|
});
|
||||||
|
|
||||||
|
function currentChatId() {
|
||||||
|
// both routes: classic /my/chats/chat/{id} and the newer /chat/{id} SPA
|
||||||
|
const m = location.pathname.match(/\/(?:my\/chats\/)?chat\/([^/]+)/);
|
||||||
|
return m ? m[1] : null;
|
||||||
|
}
|
||||||
|
|
||||||
|
/** Stable hex tokens for a media file url (file-id hash + shard dir). */
|
||||||
|
function fileTokens(url) {
|
||||||
|
const out = new Set();
|
||||||
|
if (!url) return out;
|
||||||
|
const segs = String(url).split("?")[0].split("/").filter(Boolean);
|
||||||
|
const last = decodeURIComponent(segs[segs.length - 1] ?? "");
|
||||||
|
const m = last.match(/^(?:\d+x\d+_)?([0-9a-f]{16,})(?:_frame_\d+)?\.(?:jpe?g|png|webp|gif|mp4|webm|mov|m4v)$/i);
|
||||||
|
if (m) out.add(m[1].toLowerCase());
|
||||||
|
const dir = segs[segs.length - 2];
|
||||||
|
if (dir && /^[0-9a-f]{16,}$/i.test(dir)) out.add(dir.toLowerCase());
|
||||||
|
return out;
|
||||||
|
}
|
||||||
|
|
||||||
|
function entryTokens(entry) {
|
||||||
|
const out = new Set();
|
||||||
|
const files = entry.raw?.files ?? {};
|
||||||
|
const urls = [
|
||||||
|
files.full?.url,
|
||||||
|
files.preview?.url,
|
||||||
|
files.source?.url,
|
||||||
|
...(files.source?.sources ?? []).map((s) => s?.url),
|
||||||
|
...(entry.raw?.videoSources ?? []).map((s) => s?.url),
|
||||||
|
].filter(Boolean);
|
||||||
|
for (const u of urls) for (const t of fileTokens(u)) out.add(t);
|
||||||
|
return out;
|
||||||
|
}
|
||||||
|
|
||||||
|
function rowTokens(row) {
|
||||||
|
const out = new Set();
|
||||||
|
for (const el of row.querySelectorAll("img, video, source")) {
|
||||||
|
const urls = [el.currentSrc || "", el.getAttribute("src") || "", el.tagName === "VIDEO" ? el.poster || "" : ""];
|
||||||
|
for (const u of urls.filter(Boolean)) for (const t of fileTokens(u)) out.add(t);
|
||||||
|
}
|
||||||
|
return out;
|
||||||
|
}
|
||||||
|
|
||||||
|
function renderChat() {
|
||||||
|
try {
|
||||||
|
diagTick();
|
||||||
|
const chatId = currentChatId();
|
||||||
|
const st = chatId ? chatState.get(chatId) : null;
|
||||||
|
const rows = [...document.querySelectorAll(CHAT_ROW_SEL)];
|
||||||
|
for (let ri = 0; ri < rows.length; ri++) {
|
||||||
|
const row = rows[ri];
|
||||||
|
let bar = row.querySelector(":scope > .ofsaver-chat-pills");
|
||||||
|
if (!bar) {
|
||||||
|
bar = document.createElement("div");
|
||||||
|
bar.className = "ofsaver-chat-pills";
|
||||||
|
bar.style.cssText = "display:flex;flex-wrap:wrap;gap:4px;align-items:center;margin:6px 0 2px;width:100%;";
|
||||||
|
row.appendChild(bar);
|
||||||
|
}
|
||||||
|
|
||||||
|
// positional mapping: rows are chronological, aligned from the bottom
|
||||||
|
const rowEntries = [];
|
||||||
|
if (st && st.chrono.length) {
|
||||||
|
const msg = st.chrono[Math.max(0, st.chrono.length - rows.length + ri)];
|
||||||
|
if (msg) {
|
||||||
|
for (const mm of msg.media) {
|
||||||
|
let entry = media.get(mm.id) ?? media.get(Number(mm.id));
|
||||||
|
// the sender's handle names the file — the store entry may lack
|
||||||
|
// it, but the batch always knows who sent the message
|
||||||
|
if (entry && !entry.username && msg.username) entry = { ...entry, username: msg.username };
|
||||||
|
rowEntries.push({ mm, entry });
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// fallback: match by file-hash tokens between row thumbs and index
|
||||||
|
if (!rowEntries.length) {
|
||||||
|
const rowTok = rowTokens(row);
|
||||||
|
if (rowTok.size) {
|
||||||
|
for (const e of media.values()) {
|
||||||
|
const toks = entryTokens(e);
|
||||||
|
if (!toks.size) continue;
|
||||||
|
let hit = false;
|
||||||
|
for (const t of toks) if (rowTok.has(t)) { hit = true; break; }
|
||||||
|
if (hit && !rowEntries.some((x) => String(x.entry?.id) === String(e.id))) rowEntries.push({ mm: null, entry: e });
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
const downloadable = rowEntries.map((r) => r.entry).filter((e) => e && qualityOptions(e).length);
|
||||||
|
if (downloadable.length) attachPills(bar, downloadable, "c" + String(downloadable[0].id));
|
||||||
|
|
||||||
|
// locked media (no files in the API) — one pill per media, with the
|
||||||
|
// video duration like ofcheck shows
|
||||||
|
for (const r of rowEntries) {
|
||||||
|
if (r.entry && qualityOptions(r.entry).length) continue;
|
||||||
|
const key = `l_${r.mm?.id ?? "h" + String(r.entry?.id ?? "")}`;
|
||||||
|
const btn = pillEl(key);
|
||||||
|
if (!btn.isConnected) {
|
||||||
|
const dur = r.mm && fmtDuration(r.mm.duration);
|
||||||
|
btn.innerHTML =
|
||||||
|
`<span style="background:#ececee;border-radius:8px;color:#8b8b93;font:600 12px/1 -apple-system,system-ui,sans-serif;padding:6px 10px;display:inline-flex;align-items:center;gap:4px;margin-left:8px;vertical-align:middle">Locked${dur ? ` <span style="color:#e5484d;font-size:11px">${dur}</span>` : ""}</span>`;
|
||||||
|
bar.appendChild(btn);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// row has media we never saw in any batch — generic locked marker
|
||||||
|
const hasMedia = row.matches(".m-has-media") || row.querySelector(".b-chat__message__media-wrapper");
|
||||||
|
if (!rowEntries.length && hasMedia && !row.dataset.ofsaverLocked) {
|
||||||
|
row.dataset.ofsaverLocked = "1";
|
||||||
|
const lbtn = document.createElement("div");
|
||||||
|
lbtn.dataset.ofsaverMedia = "locked";
|
||||||
|
lbtn.innerHTML =
|
||||||
|
`<span style="background:#ececee;border-radius:8px;color:#8b8b93;font:600 12px/1 -apple-system,system-ui,sans-serif;padding:6px 10px;display:inline-flex;align-items:center;margin-left:8px;vertical-align:middle">Locked</span>`;
|
||||||
|
bar.appendChild(lbtn);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} catch (e) {
|
||||||
|
console.log("[ofsaver] renderChat error:", e.message);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
})();
|
||||||
4
ext/lib/device.js
Normal file
4
ext/lib/device.js
Normal file
@@ -0,0 +1,4 @@
|
|||||||
|
// Classic Widevine L3 device (same files OF-Scraper's manual mode uses).
|
||||||
|
export const CLIENT_BLOB_B64 = "CAESmgsK3QMIAhIQT30ajtB91RUzwMQQ0Wc8MRj0n96PBiKOAjCCAQoCggEBALOpKShDvD0RTJlg//DxrSMYR506TuPd6/XcFl0ZDMFmFPjLF2kANsB3S7MoJZtR0eBngTBpnawgM/vv49S3IXV+ItkrSHYGhXNM5Mqj1tlDStO1TEXTqk9bPneSZvaE+PoURNB9f+sKJXWFOSqngXQwDgbK877pZbjQ4RfBaZTZ8LA9nHz9pTO6bgOtKnTUFOn4bitaWT7ryqrF5NRirrQ9bJ+TP3A0u+XJxurvglTYH8Ib4cSMbWVMnWbiVKqMS03EHn36h2e6zGvO8pNd+vcx2UCdklAjfMBGR/L8nnMIceY92sKIkdhN6k7nX+AwwtmyWCZVjq8s8b0O04BSWIMCAwEAASjwIkgBUqoBCAEQABqBAQRAgPPDpqjCqwmKLpGRDD/T1qazqZRCXGfOJ3L3sI4XanzS2wyipwtUAUw9aiKD3c4SykB4InynJLji3fFZjMjDfQGRKQNtI6KW0DWZDHFuD0VOylica+BaK8+r3/KDACSxVvm/gLIJCJX/IlzB+YE2rnOokXoeRisZrLWsoZeTTiIgu2bvvdxDvB4cc+3s0+ktKzUG56ExJGaoezNJeoqIf1ASgAIeOsyI1pwR2NPA7YgU+rODJV9lmGgf8zJ2Lo94oBxlM2Thz2puj+y/ZwbuJJRV2fBIPZRKrPMH3ZJHZqxmv9rhs53qLXuhvk+ESVdTES5YP0oXyJuP+ifUphinyxjyrBQj2lCpW5o4aY2035vPeSeeTLwyNKdjYAcQ7RZsjG5y5aQJ2tfcAl6Vz3HH6nFm74PP0oHv0p1KH1ohGgl2f3q1dIG6vtojsz80ZaCouCKola52Tg8QGQc41HIFQiJ8VhIgK0+Buxcp4N7yHFYk7MpzkNZ9fToo/D54FKirEz3JBL1T4JPIewG9p2Ocgwkjbhs12GxUI4ThF+cRvBtQwwmTGrQFCq4CCAESEGnj6Ji7LD+4o7MoHYT4jBQYjtW+kQUijgIwggEKAoIBAQDY9um1ifBRIOmkPtDZTqH+CZUBbb0eK0Cn3NHFf8MFUDzPEz+emK/OTub/hNxCJCao//pP5L8tRNUPFDrrvCBMo7Rn+iUb+mA/2yXiJ6ivqcN9Cu9i5qOU1ygon9SWZRsujFFB8nxVreY5Lzeq0283zn1Cg1stcX4tOHT7utPzFG/ReDFQt0O/GLlzVwB0d1sn3SKMO4XLjhZdncrtF9jljpg7xjMIlnWJUqxDo7TQkTytJmUl0kcM7bndBLerAdJFGaXc6oSY4eNy/IGDluLCQR3KZEQsy/mLeV1ggQ44MFr7XOM+rd+4/314q/deQbjHqjWFuVr8iIaKbq+R63ShAgMBAAEo8CISgAMii2Mw6z+Qs1bvvxGStie9tpcgoO2uAt5Zvv0CDXvrFlwnSbo+qR71Ru2IlZWVSbN5XYSIDwcwBzHjY8rNr3fgsXtSJty425djNQtF5+J2jrAhf3Q2m7EI5aohZGpD2E0cr+dVj9o8x0uJR2NWR8FVoVQSXZpad3M/4QzBLNto/tz+UKyZwa7Sc/eTQc2+ZcDS3ZEO3lGRsH864Kf/cEGvJRBBqcpJXKfG+ItqEW1AAPptjuggzmZEzRq5xTGf6or+bXrKjCpBS9G1SOyvCNF1k5z6lG8KsXhgQxL6ADHMoulxvUIihyPY5MpimdXfUdEQ5HA2EqNiNVNIO4qP007jW51yAeThOry4J22xs8RdkIClOGAauLIl0lLA4flMzW+VfQl5xYxP0E5tuhn0h+844DslU8ZF7U1dU2QprIApffXD9wgAACk26Rggy8e96z8i86/+YYyZQkc9hIdCAERrgEYCEbByzONrdRDs1MrS/ch1moV5pJv63BIKvQHGvLkaFgoMY29tcGFueV9uYW1lEgZHb29nbGUaIQoKbW9kZWxfbmFtZRITQU9TUCBvbiBJQSBFbXVsYXRvchoYChFhcmNoaXRlY3R1cmVfbmFtZRIDeDg2Gh4KC2RldmljZV9uYW1lEg9nZW5lcmljX3g4Nl9hcm0aIgoMcHJvZHVjdF9uYW1lEhJzZGtfZ3Bob25lX3g4Nl9hcm0aZAoKYnVpbGRfaW5mbxJWZ29vZ2xlL3Nka19ncGhvbmVfeDg2X2FybS9nZW5lcmljX3g4Nl9hcm06OS9QU1IxLjE4MDcyMC4xMjIvNjczNjc0Mjp1c2VyZGVidWcvZGV2LWtleXMaHgoUd2lkZXZpbmVfY2RtX3ZlcnNpb24SBjE0LjAuMBokCh9vZW1fY3J5cHRvX3NlY3VyaXR5X3BhdGNoX2xldmVsEgEwMg4QASAAKA0wAEAASABQAA==";
|
||||||
|
// device_private_key as PKCS#8 DER (base64) — WebCrypto importKey('pkcs8') ready
|
||||||
|
export const PRIVATE_KEY_DER_B64 = "MIIEvwIBADANBgkqhkiG9w0BAQEFAASCBKkwggSlAgEAAoIBAQCzqSkoQ7w9EUyZYP/w8a0jGEedOk7j3ev13BZdGQzBZhT4yxdpADbAd0uzKCWbUdHgZ4EwaZ2sIDP77+PUtyF1fiLZK0h2BoVzTOTKo9bZQ0rTtUxF06pPWz53kmb2hPj6FETQfX/rCiV1hTkqp4F0MA4GyvO+6WW40OEXwWmU2fCwPZx8/aUzum4DrSp01BTp+G4rWlk+68qqxeTUYq60PWyfkz9wNLvlycbq74JU2B/CG+HEjG1lTJ1m4lSqjEtNxB59+odnusxrzvKTXfr3MdlAnZJQI3zARkfy/J5zCHHmPdrCiJHYTepO51/gMMLZslgmVY6vLPG9DtOAUliDAgMBAAECggEBAID8ljv+RYtifCgyaA7ItJFZwTC0yCb5EYu2s6ercGj5rVziErCkIqsT+xlpXXahy5jdNvdXHIiTpj7fACecQz1jjgl09dUm4XDiZ/DEqF/b3EEbDOOlD8VhsPuP9LRQy6BgJPe64rgQ1MwHFf/1uw974NYnp9ANKacC8Fhp2C+xAoubeZCAWxBZXsCG9Uu+MbxpQMyraKUyGWKNYAsCsHl3eSi0Ti5kYk4jBPiiTWL5ZqYooo1HiM+6MkgJ8UEL1AgSEP92cpgMq6DHC1nAjrqWtfM5tdDvOirs1bDUSbudpgCHRS/1RyOMLriJV9ZwWaA7F9ttesSVF1VREf5MPmECgYEA89kIgWSG64Yc9qGbfKOcd4J90ITa2VLLLX9Q+r35yGMcwEKqVTpnulndeeIKPz34MJQDSE8e1o9Z8uAMwPR3ZoPDn6VDV91cS/PHiLIneM9w8sKOOFaDB1cl8oTK5/gfF07JGXggac2nfx7VS1vCNExI4kqxCM6q6D8qNz1st38CgYEAvJ09vUvmw692bZnh2vudWX0urXY0WChlevRb8B0kN8wci7ecVh507T/lqwKLbz1m8a9qqhjbp+bttwdB6C34DTm+jB0exGMMEJOcL5JotqGCssXLDZJxJoHrgtzkgUUNFIYw42A+YEXqMtbMPXoMwLwtVAvMGSMVDDL11CyfAP0CgYBSSddY8vek22lCwV6bPQs8OUkD6RGBbTMrc198fkegm/HD37tjb4Y5mMHos6MJnHv4yLoi2LBrb4zHLVygcN8qNST65uZG7GiNKQMY2iX/2uEeyxD7ahZlj786jB19EnpLf0bV1Xf6vG/dsiYAfEKZK3UdCF+dvUBnh4lTguMBOQKBgQCq5zOFLZxIndmKUA/1c15NMv+zj1K4usnREk+oD0+8+0a2VsXixrAeNXKudJzRS+rWfaMBw4ps5fNpj7rpXZXQrgz5On2hZzoMXyP7ewdEzK33vP9TKek7AifbKLooY+AJQ9pSfOeoJlGihT0FS2z4ysmryRDDiiVNK3PSMChXJQKBgQCgCwDgzmbxFLi7qxFyFsncBLMQ38WLS3JwZvLXXgfmJxb2/CAcuKd2viwrN0c7Mb0xLIOIukLWNsioCkqY9SWqTp8F9wsM7Owl6n0YYGPHqiUxYjFKLVKSPstzdaVOZWlndl1S88k4mKJdIGz3T6J2BVFMevK5VR1pusLcWqMxJA==";
|
||||||
BIN
ext/lib/device_client_id_blob
Normal file
BIN
ext/lib/device_client_id_blob
Normal file
Binary file not shown.
27
ext/lib/device_private_key
Normal file
27
ext/lib/device_private_key
Normal file
@@ -0,0 +1,27 @@
|
|||||||
|
-----BEGIN RSA PRIVATE KEY-----
|
||||||
|
MIIEpQIBAAKCAQEAs6kpKEO8PRFMmWD/8PGtIxhHnTpO493r9dwWXRkMwWYU+MsX
|
||||||
|
aQA2wHdLsyglm1HR4GeBMGmdrCAz++/j1LchdX4i2StIdgaFc0zkyqPW2UNK07VM
|
||||||
|
RdOqT1s+d5Jm9oT4+hRE0H1/6woldYU5KqeBdDAOBsrzvulluNDhF8FplNnwsD2c
|
||||||
|
fP2lM7puA60qdNQU6fhuK1pZPuvKqsXk1GKutD1sn5M/cDS75cnG6u+CVNgfwhvh
|
||||||
|
xIxtZUydZuJUqoxLTcQeffqHZ7rMa87yk1369zHZQJ2SUCN8wEZH8vyecwhx5j3a
|
||||||
|
woiR2E3qTudf4DDC2bJYJlWOryzxvQ7TgFJYgwIDAQABAoIBAQCA/JY7/kWLYnwo
|
||||||
|
MmgOyLSRWcEwtMgm+RGLtrOnq3Bo+a1c4hKwpCKrE/sZaV12ocuY3Tb3VxyIk6Y+
|
||||||
|
3wAnnEM9Y44JdPXVJuFw4mfwxKhf29xBGwzjpQ/FYbD7j/S0UMugYCT3uuK4ENTM
|
||||||
|
BxX/9bsPe+DWJ6fQDSmnAvBYadgvsQKLm3mQgFsQWV7AhvVLvjG8aUDMq2ilMhli
|
||||||
|
jWALArB5d3kotE4uZGJOIwT4ok1i+WamKKKNR4jPujJICfFBC9QIEhD/dnKYDKug
|
||||||
|
xwtZwI66lrXzObXQ7zoq7NWw1Em7naYAh0Uv9UcjjC64iVfWcFmgOxfbbXrElRdV
|
||||||
|
URH+TD5hAoGBAPPZCIFkhuuGHPahm3yjnHeCfdCE2tlSyy1/UPq9+chjHMBCqlU6
|
||||||
|
Z7pZ3XniCj89+DCUA0hPHtaPWfLgDMD0d2aDw5+lQ1fdXEvzx4iyJ3jPcPLCjjhW
|
||||||
|
gwdXJfKEyuf4HxdOyRl4IGnNp38e1UtbwjRMSOJKsQjOqug/Kjc9bLd/AoGBALyd
|
||||||
|
Pb1L5sOvdm2Z4dr7nVl9Lq12NFgoZXr0W/AdJDfMHIu3nFYedO0/5asCi289ZvGv
|
||||||
|
aqoY26fm7bcHQegt+A05vowdHsRjDBCTnC+SaLahgrLFyw2ScSaB64Lc5IFFDRSG
|
||||||
|
MONgPmBF6jLWzD16DMC8LVQLzBkjFQwy9dQsnwD9AoGAUknXWPL3pNtpQsFemz0L
|
||||||
|
PDlJA+kRgW0zK3NffH5HoJvxw9+7Y2+GOZjB6LOjCZx7+Mi6Itiwa2+Mxy1coHDf
|
||||||
|
KjUk+ubmRuxojSkDGNol/9rhHssQ+2oWZY+/OowdfRJ6S39G1dV3+rxv3bImAHxC
|
||||||
|
mSt1HQhfnb1AZ4eJU4LjATkCgYEAquczhS2cSJ3ZilAP9XNeTTL/s49SuLrJ0RJP
|
||||||
|
qA9PvPtGtlbF4sawHjVyrnSc0Uvq1n2jAcOKbOXzaY+66V2V0K4M+Tp9oWc6DF8j
|
||||||
|
+3sHRMyt97z/UynpOwIn2yi6KGPgCUPaUnznqCZRooU9BUts+MrJq8kQw4olTStz
|
||||||
|
0jAoVyUCgYEAoAsA4M5m8RS4u6sRchbJ3ASzEN/Fi0tycGby114H5icW9vwgHLin
|
||||||
|
dr4sKzdHOzG9MSyDiLpC1jbIqApKmPUlqk6fBfcLDOzsJep9GGBjx6olMWIxSi1S
|
||||||
|
kj7Lc3WlTmVpZ3ZdUvPJOJiiXSBs90+idgVRTHryuVUdabrC3FqjMSQ=
|
||||||
|
-----END RSA PRIVATE KEY-----
|
||||||
229
ext/lib/holds.js
Normal file
229
ext/lib/holds.js
Normal file
@@ -0,0 +1,229 @@
|
|||||||
|
// Disk-backed holds: media streams into the browser's private filesystem
|
||||||
|
// (OPFS) instead of living in RAM, so multi-GB files never bloat the
|
||||||
|
// offscreen document. Files are laid out exactly like the old in-memory
|
||||||
|
// arrays (header first, then each decrypted fragment in order) so the
|
||||||
|
// MuxPlanner offsets match the previous behavior byte for byte.
|
||||||
|
|
||||||
|
// ground-truth capture for building our own decrypt/mux: the first DRM
|
||||||
|
// download after load records real inputs and the wasm's exact outputs
|
||||||
|
export const drmCapture = { frags: [], moofs: [], headers: {}, mux: null, sent: false };
|
||||||
|
const b64 = (bytes) => {
|
||||||
|
let s = "";
|
||||||
|
for (let i = 0; i < bytes.length; i += 0x8000) s += String.fromCharCode.apply(null, bytes.subarray(i, i + 0x8000));
|
||||||
|
return btoa(s);
|
||||||
|
};
|
||||||
|
|
||||||
|
export async function holdsDir() {
|
||||||
|
const root = await navigator.storage.getDirectory();
|
||||||
|
return root.getDirectoryHandle("holds", { create: true });
|
||||||
|
}
|
||||||
|
|
||||||
|
/** Stream a fetch Response body into OPFS. Returns {id, size}. */
|
||||||
|
export async function streamIntoHold(dir, res, onChunk) {
|
||||||
|
const id = "h_" + Math.random().toString(36).slice(2);
|
||||||
|
const fh = await dir.getFileHandle(id, { create: true });
|
||||||
|
const w = await fh.createWritable();
|
||||||
|
let size = 0;
|
||||||
|
for await (const chunk of res.body) {
|
||||||
|
await w.write(chunk);
|
||||||
|
size += chunk.byteLength;
|
||||||
|
if (onChunk) onChunk(chunk.byteLength);
|
||||||
|
}
|
||||||
|
await w.close();
|
||||||
|
return { id, size };
|
||||||
|
}
|
||||||
|
|
||||||
|
/** Blob URL for a held file — disk-backed, so chrome.downloads streams it. */
|
||||||
|
export async function holdFileUrl(dir, id, mime = "application/octet-stream") {
|
||||||
|
const fh = await dir.getFileHandle(id);
|
||||||
|
const file = await fh.getFile();
|
||||||
|
// slice with a contentType — OPFS files carry no MIME type, and an untyped
|
||||||
|
// blob makes Chrome append .txt to the download
|
||||||
|
return URL.createObjectURL(file.slice(0, file.size, mime || "application/octet-stream"));
|
||||||
|
}
|
||||||
|
|
||||||
|
export async function removeHolds(dir, names) {
|
||||||
|
for (const name of names ?? []) {
|
||||||
|
if (!name) continue;
|
||||||
|
try { await dir.removeEntry(name); } catch {}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Async-iterate the top-level boxes of an mp4 File with chunked reads.
|
||||||
|
* Yields {type, start, end, bytes} — `bytes` is a copy only for types in
|
||||||
|
* `withBytes`. Boxes bigger than a chunk are skipped without buffering
|
||||||
|
* unless their bytes were requested, so huge mdats never enter RAM here.
|
||||||
|
*/
|
||||||
|
export async function* mp4Boxes(file, { withBytes = [], chunkSize = 1 << 22 } = {}) {
|
||||||
|
const want = new Set(withBytes);
|
||||||
|
let buf = new Uint8Array(0); // pending bytes, starting at file offset `base`
|
||||||
|
let base = 0;
|
||||||
|
for (;;) {
|
||||||
|
let size = 0;
|
||||||
|
if (buf.length >= 8) {
|
||||||
|
const dv = new DataView(buf.buffer, buf.byteOffset, buf.byteLength);
|
||||||
|
size = dv.getUint32(0);
|
||||||
|
if (size === 1) {
|
||||||
|
size = buf.length >= 16 ? Number(dv.getBigUint64(8)) : -1; // need more
|
||||||
|
} else if (size === 0) {
|
||||||
|
size = file.size - base; // box extends to EOF
|
||||||
|
}
|
||||||
|
if (size >= 0 && size < 8) return; // malformed, like the old parser
|
||||||
|
if (size >= 8) {
|
||||||
|
const type = String.fromCharCode(buf[4], buf[5], buf[6], buf[7]);
|
||||||
|
if (buf.length >= size) {
|
||||||
|
yield { type, start: base, end: base + size, bytes: want.has(type) ? buf.slice(0, size) : undefined };
|
||||||
|
buf = buf.subarray(size);
|
||||||
|
base += size;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
if (!want.has(type) && base + size <= file.size) {
|
||||||
|
// large box we don't need bytes for — skip past it without buffering
|
||||||
|
yield { type, start: base, end: base + size, bytes: undefined };
|
||||||
|
buf = new Uint8Array(0);
|
||||||
|
base += size;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (base + buf.length >= file.size) return; // EOF (or partial box at EOF)
|
||||||
|
const from = base + buf.length;
|
||||||
|
const to = Math.min(from + chunkSize, file.size);
|
||||||
|
const chunk = new Uint8Array(await file.slice(from, to).arrayBuffer());
|
||||||
|
const merged = new Uint8Array(buf.length + chunk.length);
|
||||||
|
merged.set(buf);
|
||||||
|
merged.set(chunk, buf.length);
|
||||||
|
buf = merged;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Stream-decrypt one track. Reads the source hold, decrypts each
|
||||||
|
* moof..mdat fragment in place with the same wasm calls as the in-memory
|
||||||
|
* flow, and appends to a new OPFS file laid out like the old result array:
|
||||||
|
* header first, fragments in order. Returns {header} (the pre-strip source
|
||||||
|
* header, as the old code used it).
|
||||||
|
*/
|
||||||
|
export async function decryptTrackToOpfs(dir, srcId, decId, keyBytes, fns, label = "video", onProgress) {
|
||||||
|
const src = await (await dir.getFileHandle(srcId)).getFile();
|
||||||
|
const dec = await dir.getFileHandle(decId, { create: true });
|
||||||
|
const w = await dec.createWritable();
|
||||||
|
let header = null;
|
||||||
|
try {
|
||||||
|
let marker = 0, pattern = null, civ = null;
|
||||||
|
let moofStart = -1, done = 0;
|
||||||
|
for await (const box of mp4Boxes(src)) {
|
||||||
|
if (header === null) {
|
||||||
|
if (box.type !== "moof") continue;
|
||||||
|
header = new Uint8Array(await src.slice(0, box.start).arrayBuffer());
|
||||||
|
marker = fns.tencMarker(header);
|
||||||
|
if (marker < 0) throw new Error("no tenc — not CENC-protected");
|
||||||
|
fns.stripInit(header);
|
||||||
|
pattern = fns.tencCryptPattern(header);
|
||||||
|
civ = fns.tencConstantIv(header);
|
||||||
|
await w.write(header);
|
||||||
|
moofStart = box.start;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
if (box.type === "moof") { moofStart = box.start; continue; }
|
||||||
|
if (box.type === "mdat" && moofStart >= 0) {
|
||||||
|
const bytes = new Uint8Array(await src.slice(moofStart, box.end).arrayBuffer());
|
||||||
|
if (!drmCapture.sent && drmCapture.frags.filter((f) => f.track === label).length < 1) {
|
||||||
|
drmCapture.headers[label] = b64(header);
|
||||||
|
drmCapture.key = b64(keyBytes);
|
||||||
|
drmCapture.marker = marker;
|
||||||
|
drmCapture.pattern = pattern ? [...pattern] : null;
|
||||||
|
drmCapture.civ = civ ? [...civ] : null;
|
||||||
|
var capIn = b64(bytes);
|
||||||
|
}
|
||||||
|
if (pattern) {
|
||||||
|
fns.decryptAndStripFragmentCbcs(bytes, keyBytes, marker, pattern[0] ?? 0, pattern[1] ?? 0, civ ?? new Uint8Array());
|
||||||
|
} else {
|
||||||
|
fns.decryptAndStripFragment(bytes, keyBytes, marker);
|
||||||
|
}
|
||||||
|
await w.write(bytes);
|
||||||
|
done += bytes.length;
|
||||||
|
if (onProgress) onProgress(done, src.size);
|
||||||
|
if (capIn) { drmCapture.frags.push({ track: label, in: capIn, out: b64(bytes) }); capIn = null; }
|
||||||
|
moofStart = -1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (header === null) {
|
||||||
|
// degenerate track with no fragments: the old flow treated the whole
|
||||||
|
// file as its own "header"
|
||||||
|
await w.write(new Uint8Array(await src.slice(0, src.size).arrayBuffer()));
|
||||||
|
}
|
||||||
|
} catch (e) {
|
||||||
|
try { await w.close(); } catch {}
|
||||||
|
try { await dir.removeEntry(decId); } catch {}
|
||||||
|
throw e;
|
||||||
|
}
|
||||||
|
await w.close();
|
||||||
|
return { header };
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Re-parse a decrypted track file and feed every moof into the MuxPlanner
|
||||||
|
* exactly like the in-memory flow did: bytes from the moof's start through
|
||||||
|
* whatever follows it up to (not including) the next mdat, at the moof's
|
||||||
|
* offset. Returns the bytes before the first moof — the header the planner
|
||||||
|
* constructor wants.
|
||||||
|
*/
|
||||||
|
export async function pushTrackMoofs(dir, decId, planner, isVideo) {
|
||||||
|
const file = await (await dir.getFileHandle(decId)).getFile();
|
||||||
|
let header = null, moofStart = -1;
|
||||||
|
for await (const box of mp4Boxes(file)) {
|
||||||
|
if (box.type === "moof") {
|
||||||
|
if (header === null) header = new Uint8Array(await file.slice(0, box.start).arrayBuffer());
|
||||||
|
moofStart = box.start;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
if (box.type === "mdat" && moofStart >= 0) {
|
||||||
|
const moof = new Uint8Array(await file.slice(moofStart, box.start).arrayBuffer());
|
||||||
|
const track = isVideo ? "video" : "audio";
|
||||||
|
if (!drmCapture.sent && drmCapture.moofs.filter((x) => x.track === track).length < 3) {
|
||||||
|
drmCapture.moofs.push({ track, offset: moofStart, moof: b64(moof) });
|
||||||
|
}
|
||||||
|
isVideo ? planner.pushVideoMoof(moof, moofStart) : planner.pushAudioMoof(moof, moofStart);
|
||||||
|
moofStart = -1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return header ?? new Uint8Array(await file.slice(0, file.size).arrayBuffer());
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Write the muxed output: muxed header, then each layout range copied from
|
||||||
|
* the decrypted track files in chunks. Returns {blobUrl, size}.
|
||||||
|
*/
|
||||||
|
export async function writeMuxedFile(dir, finalId, muxed, videoFile, audioFile) {
|
||||||
|
const fh = await dir.getFileHandle(finalId, { create: true });
|
||||||
|
const w = await fh.createWritable();
|
||||||
|
try {
|
||||||
|
await w.write(muxed.header());
|
||||||
|
const layout = muxed.layout();
|
||||||
|
for (let i = 0; i < layout.length; i += 3) {
|
||||||
|
const isVideo = layout[i], off = layout[i + 1], len = layout[i + 2];
|
||||||
|
const f = (isVideo || !audioFile) ? videoFile : audioFile;
|
||||||
|
let p = off;
|
||||||
|
const end = off + len;
|
||||||
|
while (p < end) {
|
||||||
|
const n = Math.min(1 << 22, end - p);
|
||||||
|
await w.write(await f.slice(p, p + n).arrayBuffer());
|
||||||
|
p += n;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} catch (e) {
|
||||||
|
try { await w.close(); } catch {}
|
||||||
|
try { await dir.removeEntry(finalId); } catch {}
|
||||||
|
throw e;
|
||||||
|
}
|
||||||
|
await w.close();
|
||||||
|
if (!drmCapture.sent) {
|
||||||
|
try { drmCapture.mux = { header: b64(muxed.header()), layout: [...muxed.layout()] }; } catch {}
|
||||||
|
}
|
||||||
|
const ofile = await fh.getFile();
|
||||||
|
// OPFS files have no MIME type — an untyped blob URL makes Chrome append
|
||||||
|
// .txt to the download, so hand out a typed view of the same file
|
||||||
|
return { blobUrl: URL.createObjectURL(ofile.slice(0, ofile.size, "video/mp4")), size: ofile.size };
|
||||||
|
}
|
||||||
234
ext/lib/main-hook.js
Normal file
234
ext/lib/main-hook.js
Normal file
@@ -0,0 +1,234 @@
|
|||||||
|
// MAIN world: hook the page's network and index every media entry OF sends us.
|
||||||
|
// Posts/media land in window.__ofsaverMedia; the content script picks them up
|
||||||
|
// via a DOM CustomEvent, so both worlds see the same data.
|
||||||
|
(() => {
|
||||||
|
if (window.__ofsaverHooked) return;
|
||||||
|
window.__ofsaverHooked = true;
|
||||||
|
const store = new Map(); // mediaId -> entry (includes .raw = full media object)
|
||||||
|
const users = new Map(); // userId -> username (from any response that names a user)
|
||||||
|
|
||||||
|
const emit = () => {
|
||||||
|
try {
|
||||||
|
window.dispatchEvent(new CustomEvent("ofsaver-media-data", {
|
||||||
|
detail: [...store.values()],
|
||||||
|
}));
|
||||||
|
window.dispatchEvent(new CustomEvent("ofsaver-users", {
|
||||||
|
detail: [...users.entries()],
|
||||||
|
}));
|
||||||
|
} catch {}
|
||||||
|
};
|
||||||
|
|
||||||
|
const walk = (obj, found) => {
|
||||||
|
if (!obj || typeof obj !== "object") return;
|
||||||
|
if (Array.isArray(obj)) { for (const v of obj) walk(v, found); return; }
|
||||||
|
const type = obj.type;
|
||||||
|
const files = obj.files;
|
||||||
|
if ((type === "video" || type === "audio" || type === "photo" || type === "gif") && files && typeof files === "object" && obj.id != null) {
|
||||||
|
found.add(obj);
|
||||||
|
}
|
||||||
|
for (const k of Object.keys(obj)) walk(obj[k], found);
|
||||||
|
};
|
||||||
|
|
||||||
|
const ingest = (json, url) => {
|
||||||
|
let data;
|
||||||
|
try { data = JSON.parse(json); } catch { return; }
|
||||||
|
// chat messages: emit the ordered batch so the content script can map
|
||||||
|
// DOM rows positionally (the chat rows expose no message ids). Locked
|
||||||
|
// chat media ships WITHOUT a files key and is NOT added to the media
|
||||||
|
// store — its info rides in this batch instead, keeping the store
|
||||||
|
// exactly as the download flow expects it.
|
||||||
|
if (url) {
|
||||||
|
const cm = String(url).match(/\/api2\/v2\/chats\/([^/]+)\/messages/);
|
||||||
|
if (cm) {
|
||||||
|
const list = data?.list ?? (Array.isArray(data) ? data : null);
|
||||||
|
if (list && list.length) {
|
||||||
|
const fu = list.find((m) => m.fromUser)?.fromUser;
|
||||||
|
if (fu) console.log("[ofsaver] chat batch fromUser sample:", fu.id, fu.username);
|
||||||
|
try {
|
||||||
|
window.dispatchEvent(new CustomEvent("ofsaver-chat-batch", {
|
||||||
|
detail: {
|
||||||
|
chatId: cm[1],
|
||||||
|
msgs: list.map((m) => ({
|
||||||
|
id: String(m.id),
|
||||||
|
username: m.fromUser?.username ?? null,
|
||||||
|
media: (m.media ?? []).map((x) => ({
|
||||||
|
id: x.id,
|
||||||
|
type: x.type,
|
||||||
|
duration: x.duration ?? x.videoDuration ?? null,
|
||||||
|
canView: x.canView !== false,
|
||||||
|
})),
|
||||||
|
})),
|
||||||
|
},
|
||||||
|
}));
|
||||||
|
} catch {}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
const found = new Set();
|
||||||
|
walk(data, found);
|
||||||
|
// find post context: any post objects mapping postId → their media list
|
||||||
|
const postMedia = new Map();
|
||||||
|
// containers: posts (postedAt/responseType) and chat messages (fromUser/createdAt)
|
||||||
|
const containers = [];
|
||||||
|
const walkContainers = (o) => {
|
||||||
|
if (!o || typeof o !== "object") return;
|
||||||
|
if (Array.isArray(o)) { for (const v of o) walkContainers(v); return; }
|
||||||
|
if (o.id != null && Array.isArray(o.media) && o.media.length) {
|
||||||
|
const isPost = o.postedAt !== undefined || o.responseType !== undefined;
|
||||||
|
const isMessage = Array.isArray(o.media) && (o.fromUser !== undefined || o.createdAt !== undefined) && !isPost;
|
||||||
|
if (isPost || isMessage) {
|
||||||
|
containers.push({
|
||||||
|
id: o.id,
|
||||||
|
responseType: isMessage ? "message" : (o.responseType ?? "post"),
|
||||||
|
username: o.author?.username ?? o.fromUser?.username,
|
||||||
|
creatorId: o.author?.id ?? o.fromUser?.id,
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
for (const k of Object.keys(o)) walkContainers(o[k]);
|
||||||
|
};
|
||||||
|
walkContainers(data);
|
||||||
|
// second pass: map media ids to their container
|
||||||
|
const containerMedia = new Map();
|
||||||
|
const walkMediaLinks = (o) => {
|
||||||
|
if (!o || typeof o !== "object") return;
|
||||||
|
if (Array.isArray(o)) { for (const v of o) walkMediaLinks(v); return; }
|
||||||
|
if (o.id != null && Array.isArray(o.media) && o.media.length) {
|
||||||
|
const isPost = o.postedAt !== undefined || o.responseType !== undefined;
|
||||||
|
const isMessage = o.fromUser !== undefined || (o.createdAt !== undefined && !isPost);
|
||||||
|
if (isPost || isMessage) {
|
||||||
|
for (const m of o.media) {
|
||||||
|
if (m?.id != null) containerMedia.set(m.id, {
|
||||||
|
postId: o.id,
|
||||||
|
responseType: isMessage ? "message" : (o.responseType ?? "post"),
|
||||||
|
username: o.author?.username ?? o.fromUser?.username,
|
||||||
|
creatorId: o.author?.id ?? o.fromUser?.id,
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
for (const k of Object.keys(o)) walkMediaLinks(o[k]);
|
||||||
|
};
|
||||||
|
walkMediaLinks(data);
|
||||||
|
|
||||||
|
// any response that names a user fixes the id → handle mapping for all
|
||||||
|
// future naming (some views ship fromUser.id without the username)
|
||||||
|
const usersBefore = users.size;
|
||||||
|
const walkUsers = (o) => {
|
||||||
|
if (!o || typeof o !== "object") return;
|
||||||
|
if (Array.isArray(o)) { for (const v of o) walkUsers(v); return; }
|
||||||
|
if (o.id != null && typeof o.username === "string" && o.username) users.set(String(o.id), o.username);
|
||||||
|
for (const k of Object.keys(o)) walkUsers(o[k]);
|
||||||
|
};
|
||||||
|
walkUsers(data);
|
||||||
|
|
||||||
|
for (const m of found) {
|
||||||
|
const drm = m.files?.drm;
|
||||||
|
const src = m.files?.source?.url ?? m.files?.full?.url ?? null;
|
||||||
|
const prev = store.get(m.id);
|
||||||
|
// keep the richest info we've seen (later API views may be less privileged)
|
||||||
|
const ctx = containerMedia.get(m.id) ?? {};
|
||||||
|
const entry = {
|
||||||
|
id: m.id,
|
||||||
|
postId: ctx.postId ?? prev?.postId ?? null,
|
||||||
|
responseType: ctx.responseType ?? prev?.responseType ?? null,
|
||||||
|
username: ctx.username ?? (ctx.creatorId != null ? users.get(String(ctx.creatorId)) : null) ?? prev?.username ?? null,
|
||||||
|
creatorId: ctx.creatorId ?? prev?.creatorId ?? null,
|
||||||
|
type: m.type,
|
||||||
|
canView: m.canView !== false, // latest API view wins
|
||||||
|
duration: m.duration ?? m.videoDuration ?? prev?.duration ?? null,
|
||||||
|
createdAt: m.createdAt ?? prev?.createdAt ?? null,
|
||||||
|
height: m.height ?? m.files?.source?.h ?? prev?.height ?? null,
|
||||||
|
drm: (drm?.manifest && drm) || prev?.drm || null,
|
||||||
|
source: (m.canView !== false && src) || prev?.source || null,
|
||||||
|
raw: m, // full media object for quality variants
|
||||||
|
};
|
||||||
|
if (m.canView === false) entry.canView = false;
|
||||||
|
store.set(m.id, entry);
|
||||||
|
}
|
||||||
|
if (found.size || users.size !== usersBefore) emit();
|
||||||
|
};
|
||||||
|
|
||||||
|
const of = window.fetch;
|
||||||
|
window.fetch = async function (...args) {
|
||||||
|
try {
|
||||||
|
const u = typeof args[0] === "string" ? args[0] : args[0]?.url ?? "";
|
||||||
|
if (/\/api2\//.test(u)) {
|
||||||
|
const h = args[1]?.headers;
|
||||||
|
const get = (k) => {
|
||||||
|
if (!h) return null;
|
||||||
|
if (typeof Headers !== "undefined" && h instanceof Headers) return h.get(k);
|
||||||
|
return h[k] ?? h[k.toLowerCase()] ?? null;
|
||||||
|
};
|
||||||
|
const uid = get("user-id");
|
||||||
|
const bc = get("x-bc");
|
||||||
|
if (uid != null || bc != null) {
|
||||||
|
const store = JSON.parse(document.documentElement.getAttribute("data-ofsaver-auth") || "{}");
|
||||||
|
if (uid != null) store.uid = String(uid);
|
||||||
|
if (bc != null) store.bc = String(bc);
|
||||||
|
store.t = Date.now();
|
||||||
|
document.documentElement.setAttribute("data-ofsaver-auth", JSON.stringify(store));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} catch {}
|
||||||
|
const res = await of.apply(this, args);
|
||||||
|
try {
|
||||||
|
const url = typeof args[0] === "string" ? args[0] : args[0]?.url ?? "";
|
||||||
|
if (/\/api2\/v2\//.test(url) && res.ok) {
|
||||||
|
const clone = res.clone();
|
||||||
|
clone.text().then((t) => ingest(t, url)).catch(() => {});
|
||||||
|
}
|
||||||
|
} catch {}
|
||||||
|
return res;
|
||||||
|
};
|
||||||
|
|
||||||
|
// capture the page's own license request headers for auth debugging
|
||||||
|
const osrh = XMLHttpRequest.prototype.setRequestHeader;
|
||||||
|
XMLHttpRequest.prototype.setRequestHeader = function (k, v) {
|
||||||
|
try {
|
||||||
|
const lk = String(k).toLowerCase();
|
||||||
|
const u = String(this.__ofsaverUrl ?? "");
|
||||||
|
// session auth capture: every signed /api2/ request carries user-id
|
||||||
|
// and x-bc — the tab's own session, which is the only correct one in
|
||||||
|
// incognito (chrome.cookies reads the regular jar there)
|
||||||
|
if (/\/api2\//.test(u) && (lk === "user-id" || lk === "x-bc")) {
|
||||||
|
const store = JSON.parse(document.documentElement.getAttribute("data-ofsaver-auth") || "{}");
|
||||||
|
if (lk === "user-id") store.uid = String(v);
|
||||||
|
else store.bc = String(v);
|
||||||
|
store.t = Date.now();
|
||||||
|
document.documentElement.setAttribute("data-ofsaver-auth", JSON.stringify(store));
|
||||||
|
}
|
||||||
|
if (/\/drm\/|\/licenses?\b|type=widevine/i.test(u) || /sign|time|x-bc|app-token|user-id|x-of-rev/i.test(lk)) {
|
||||||
|
const store = JSON.parse(document.documentElement.getAttribute("data-ofsaver-lic") || "{}");
|
||||||
|
(store.h = store.h || {})[lk] = v;
|
||||||
|
store.url = u.slice(0, 120);
|
||||||
|
store.t = Date.now();
|
||||||
|
document.documentElement.setAttribute("data-ofsaver-lic", JSON.stringify(store));
|
||||||
|
}
|
||||||
|
} catch {}
|
||||||
|
return osrh.call(this, k, v);
|
||||||
|
};
|
||||||
|
|
||||||
|
const oo = XMLHttpRequest.prototype.open;
|
||||||
|
const os = XMLHttpRequest.prototype.send;
|
||||||
|
XMLHttpRequest.prototype.open = function (method, url, ...rest) {
|
||||||
|
this.__ofsaverUrl = url;
|
||||||
|
return oo.call(this, method, url, ...rest);
|
||||||
|
};
|
||||||
|
XMLHttpRequest.prototype.send = function (...args) {
|
||||||
|
this.addEventListener("load", () => {
|
||||||
|
try {
|
||||||
|
if (/\/api2\/v2\//.test(String(this.__ofsaverUrl ?? "")) && this.responseText) ingest(this.responseText, this.__ofsaverUrl);
|
||||||
|
} catch {}
|
||||||
|
});
|
||||||
|
return os.apply(this, args);
|
||||||
|
};
|
||||||
|
|
||||||
|
emit();
|
||||||
|
|
||||||
|
// content script can push fetched API data back in (backfills for posts
|
||||||
|
// whose responses happened before this hook installed)
|
||||||
|
window.addEventListener("ofsaver-ingest", (e) => {
|
||||||
|
try { ingest(e.detail); } catch {}
|
||||||
|
});
|
||||||
|
})();
|
||||||
556
ext/lib/owndrm.js
Normal file
556
ext/lib/owndrm.js
Normal file
@@ -0,0 +1,556 @@
|
|||||||
|
// Own DRM module — drop-in replacement for fanripper's drm.wasm.
|
||||||
|
// Decrypt is AES-128-CTR (cenc) / CBC (cbcs) with per-sample IVs from senc,
|
||||||
|
// verified byte-identical against the wasm. The muxer builds a progressive
|
||||||
|
// MP4 (merged header + interleaved mdat), mirroring MuxPlanner.
|
||||||
|
|
||||||
|
// AES-128 decrypt — equivalent inverse cipher, T-table driven.
|
||||||
|
const S = new Uint8Array(256)
|
||||||
|
const SI = new Uint8Array(256)
|
||||||
|
const xt0 = (a, b) => { let r = 0; while (b) { if (b & 1) r ^= a; a = (a << 1) ^ ((a >> 7) * 0x11b); b >>>= 1 } return r & 255 }
|
||||||
|
const rotl8 = (v, n) => ((v << n) | (v >>> (8 - n))) & 255
|
||||||
|
for (let i = 0; i < 256; i++) {
|
||||||
|
let inv = 0
|
||||||
|
if (i !== 0) { let base = i, e = 254, r = 1; while (e) { if (e & 1) r = xt0(r, base); base = xt0(base, base); e >>= 1 } inv = r }
|
||||||
|
S[i] = inv ^ rotl8(inv, 1) ^ rotl8(inv, 2) ^ rotl8(inv, 3) ^ rotl8(inv, 4) ^ 0x63
|
||||||
|
SI[S[i]] = i
|
||||||
|
}
|
||||||
|
const xt = (a, b) => { let r = 0; while (b) { if (b & 1) r ^= a; a = (a << 1) ^ ((a >> 7) * 0x11b); b >>>= 1 } return r & 255 }
|
||||||
|
const U0 = new Uint32Array(256), U1 = new Uint32Array(256), U2 = new Uint32Array(256), U3 = new Uint32Array(256)
|
||||||
|
for (let i = 0; i < 256; i++) {
|
||||||
|
const s = SI[i]
|
||||||
|
const r0 = xt(s, 0xe), r1 = xt(s, 9), r2 = xt(s, 0xd), r3 = xt(s, 0xb)
|
||||||
|
U0[i] = (r0 << 24) | (r1 << 16) | (r2 << 8) | r3
|
||||||
|
U1[i] = (r3 << 24) | (r0 << 16) | (r1 << 8) | r2
|
||||||
|
U2[i] = (r2 << 24) | (r3 << 16) | (r0 << 8) | r1
|
||||||
|
U3[i] = (r1 << 24) | (r2 << 16) | (r3 << 8) | r0
|
||||||
|
}
|
||||||
|
export function makeKeys(key) {
|
||||||
|
const w = new Uint32Array(44)
|
||||||
|
for (let i = 0; i < 4; i++) w[i] = (key[4*i] << 24) | (key[4*i+1] << 16) | (key[4*i+2] << 8) | key[4*i+3]
|
||||||
|
let rc = 1
|
||||||
|
for (let i = 4; i < 44; i++) {
|
||||||
|
let t = w[i-1]
|
||||||
|
if (i % 4 === 0) {
|
||||||
|
t = ((t << 8) | (t >>> 24)) >>> 0
|
||||||
|
t = (S[t >>> 24] << 24) ^ (S[(t >>> 16) & 255] << 16) ^ (S[(t >>> 8) & 255] << 8) ^ S[t & 255] ^ (rc << 24)
|
||||||
|
rc = xt(rc, 2)
|
||||||
|
}
|
||||||
|
w[i] = w[i-4] ^ t
|
||||||
|
}
|
||||||
|
const dw = new Uint32Array(44)
|
||||||
|
for (let r = 1; r < 10; r++) {
|
||||||
|
for (let c = 0; c < 4; c++) {
|
||||||
|
const col = w[r*4+c]
|
||||||
|
const a0 = col >>> 24, a1 = (col >>> 16) & 255, a2 = (col >>> 8) & 255, a3 = col & 255
|
||||||
|
dw[r*4+c] = ((xt(a0, 14) ^ xt(a1, 11) ^ xt(a2, 13) ^ xt(a3, 9)) << 24) |
|
||||||
|
((xt(a0, 9) ^ xt(a1, 14) ^ xt(a2, 11) ^ xt(a3, 13)) << 16) |
|
||||||
|
((xt(a0, 13) ^ xt(a1, 9) ^ xt(a2, 14) ^ xt(a3, 11)) << 8) |
|
||||||
|
(xt(a0, 11) ^ xt(a1, 13) ^ xt(a2, 9) ^ xt(a3, 14))
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return { w, dw }
|
||||||
|
}
|
||||||
|
/** In-place CBC decrypt of buf[off .. off+len] (len%16 tail copied as-is).
|
||||||
|
* iv: 16-byte initial chain. Returns nothing (mutates buf). */
|
||||||
|
export function cbcDecrypt(buf, off, len, iv, keys) {
|
||||||
|
const { w, dw } = keys
|
||||||
|
const st = new Uint8Array(16)
|
||||||
|
const xti = (a, b) => { let r = 0; while (b) { if (b & 1) r ^= a; a = (a << 1) ^ ((a >> 7) * 0x11b); b >>>= 1 } return r & 255 }
|
||||||
|
const full = Math.floor(len / 16) * 16
|
||||||
|
for (let p = off; p < off + full; p += 16) {
|
||||||
|
const prev = buf.subarray(p, p + 16)
|
||||||
|
const prevCopy = Uint8Array.from(prev)
|
||||||
|
for (let k = 0; k < 16; k++) st[k] = prev[k]
|
||||||
|
const rk = (getWord) => { for (let k = 0; k < 16; k++) st[k] ^= (getWord(k >> 2) >>> ((3 - (k & 3)) * 8)) & 255 }
|
||||||
|
rk((i) => w[40 + i])
|
||||||
|
for (let r = 9; r >= 1; r--) {
|
||||||
|
// InvShiftRows: row j rotates right by j
|
||||||
|
for (let j = 1; j < 4; j++) {
|
||||||
|
const row = [st[j], st[4 + j], st[8 + j], st[12 + j]]
|
||||||
|
const rot = [row[(4 - j) % 4], row[(5 - j) % 4], row[(6 - j) % 4], row[(7 - j) % 4]]
|
||||||
|
st[j] = rot[0]; st[4 + j] = rot[1]; st[8 + j] = rot[2]; st[12 + j] = rot[3]
|
||||||
|
}
|
||||||
|
for (let k = 0; k < 16; k++) st[k] = SI[st[k]]
|
||||||
|
rk((i) => w[r * 4 + i])
|
||||||
|
// InvMixColumns
|
||||||
|
for (let c = 0; c < 4; c++) {
|
||||||
|
const a0 = st[c * 4], a1 = st[c * 4 + 1], a2 = st[c * 4 + 2], a3 = st[c * 4 + 3]
|
||||||
|
st[c * 4] = xti(a0, 14) ^ xti(a1, 11) ^ xti(a2, 13) ^ xti(a3, 9)
|
||||||
|
st[c * 4 + 1] = xti(a0, 9) ^ xti(a1, 14) ^ xti(a2, 11) ^ xti(a3, 13)
|
||||||
|
st[c * 4 + 2] = xti(a0, 13) ^ xti(a1, 9) ^ xti(a2, 14) ^ xti(a3, 11)
|
||||||
|
st[c * 4 + 3] = xti(a0, 11) ^ xti(a1, 13) ^ xti(a2, 9) ^ xti(a3, 14)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
for (let j = 1; j < 4; j++) {
|
||||||
|
const row = [st[j], st[4 + j], st[8 + j], st[12 + j]]
|
||||||
|
const rot = [row[(4 - j) % 4], row[(5 - j) % 4], row[(6 - j) % 4], row[(7 - j) % 4]]
|
||||||
|
st[j] = rot[0]; st[4 + j] = rot[1]; st[8 + j] = rot[2]; st[12 + j] = rot[3]
|
||||||
|
}
|
||||||
|
for (let k = 0; k < 16; k++) st[k] = SI[st[k]]
|
||||||
|
for (let k = 0; k < 16; k++) st[k] ^= (w[k >> 2] >>> ((3 - (k & 3)) * 8)) & 255
|
||||||
|
for (let k = 0; k < 16; k++) buf[p + k] = st[k] ^ iv[k]
|
||||||
|
iv = prevCopy
|
||||||
|
}
|
||||||
|
return iv
|
||||||
|
}
|
||||||
|
|
||||||
|
// forward AES block encrypt (for CTR keystream)
|
||||||
|
const T0 = new Uint32Array(256), T1 = new Uint32Array(256), T2 = new Uint32Array(256), T3 = new Uint32Array(256)
|
||||||
|
for (let i = 0; i < 256; i++) {
|
||||||
|
const s2 = xt(S[i], 2), s3 = xt(S[i], 3)
|
||||||
|
T0[i] = (s2 << 24) | (S[i] << 16) | (S[i] << 8) | s3
|
||||||
|
T1[i] = (s3 << 24) | (s2 << 16) | (S[i] << 8) | S[i]
|
||||||
|
T2[i] = (S[i] << 24) | (s3 << 16) | (s2 << 8) | S[i]
|
||||||
|
T3[i] = (S[i] << 24) | (S[i] << 16) | (s3 << 8) | s2
|
||||||
|
}
|
||||||
|
export function encryptBlock(out, o, inp, i2, keys) {
|
||||||
|
const { w } = keys
|
||||||
|
let s0 = ((inp[i2] << 24) | (inp[i2+1] << 16) | (inp[i2+2] << 8) | inp[i2+3]) ^ w[0]
|
||||||
|
let s1 = ((inp[i2+4] << 24) | (inp[i2+5] << 16) | (inp[i2+6] << 8) | inp[i2+7]) ^ w[1]
|
||||||
|
let s2 = ((inp[i2+8] << 24) | (inp[i2+9] << 16) | (inp[i2+10] << 8) | inp[i2+11]) ^ w[2]
|
||||||
|
let s3 = ((inp[i2+12] << 24) | (inp[i2+13] << 16) | (inp[i2+14] << 8) | inp[i2+15]) ^ w[3]
|
||||||
|
for (let r = 1; r <= 9; r++) {
|
||||||
|
const t0 = T0[s0 >>> 24] ^ T1[(s1 >>> 16) & 255] ^ T2[(s2 >>> 8) & 255] ^ T3[s3 & 255] ^ w[r*4]
|
||||||
|
const t1 = T0[s1 >>> 24] ^ T1[(s2 >>> 16) & 255] ^ T2[(s3 >>> 8) & 255] ^ T3[s0 & 255] ^ w[r*4+1]
|
||||||
|
const t2 = T0[s2 >>> 24] ^ T1[(s3 >>> 16) & 255] ^ T2[(s0 >>> 8) & 255] ^ T3[s1 & 255] ^ w[r*4+2]
|
||||||
|
const t3 = T0[s3 >>> 24] ^ T1[(s0 >>> 16) & 255] ^ T2[(s1 >>> 8) & 255] ^ T3[s2 & 255] ^ w[r*4+3]
|
||||||
|
s0 = t0; s1 = t1; s2 = t2; s3 = t3
|
||||||
|
}
|
||||||
|
const e0 = ((S[s0 >>> 24] << 24) | (S[(s1 >>> 16) & 255] << 16) | (S[(s2 >>> 8) & 255] << 8) | S[s3 & 255]) ^ w[40]
|
||||||
|
const e1 = ((S[s1 >>> 24] << 24) | (S[(s2 >>> 16) & 255] << 16) | (S[(s3 >>> 8) & 255] << 8) | S[s0 & 255]) ^ w[41]
|
||||||
|
const e2 = ((S[s2 >>> 24] << 24) | (S[(s3 >>> 16) & 255] << 16) | (S[(s0 >>> 8) & 255] << 8) | S[s1 & 255]) ^ w[42]
|
||||||
|
const e3 = ((S[s3 >>> 24] << 24) | (S[(s0 >>> 16) & 255] << 16) | (S[(s1 >>> 8) & 255] << 8) | S[s2 & 255]) ^ w[43]
|
||||||
|
const put = (v, k) => { out[o + 4*k] = v >>> 24; out[o + 4*k + 1] = (v >>> 16) & 255; out[o + 4*k + 2] = (v >>> 8) & 255; out[o + 4*k + 3] = v & 255 }
|
||||||
|
put(e0, 0); put(e1, 1); put(e2, 2); put(e3, 3)
|
||||||
|
}
|
||||||
|
|
||||||
|
// ---- box helpers -----------------------------------------------------------
|
||||||
|
function u32(v) { return [(v >>> 24) & 255, (v >>> 16) & 255, (v >>> 8) & 255, v & 255] }
|
||||||
|
function b64bytes(s) { return Uint8Array.from(atob(s), (c) => c.charCodeAt(0)) }
|
||||||
|
|
||||||
|
function parseBoxes(buf, start, end) {
|
||||||
|
const out = []; let i = start
|
||||||
|
while (i + 8 <= end) {
|
||||||
|
let size = ((buf[i] << 24) | (buf[i+1] << 16) | (buf[i+2] << 8) | buf[i+3]) >>> 0
|
||||||
|
const type = String.fromCharCode(buf[i+4], buf[i+5], buf[i+6], buf[i+7])
|
||||||
|
let hdr = 8
|
||||||
|
if (size === 1) { size = Number((BigInt(buf[i+8]) << 56n) | (BigInt(buf[i+9]) << 48n) | (BigInt(buf[i+10]) << 40n) | (BigInt(buf[i+11]) << 32n) | (BigInt(buf[i+12]) << 24n) | (BigInt(buf[i+13]) << 16n) | (BigInt(buf[i+14]) << 8n) | BigInt(buf[i+15])); hdr = 16 }
|
||||||
|
if (size < 8 || i + size > end) break
|
||||||
|
out.push({ type, start: i, end: i + size, hdr })
|
||||||
|
i += size
|
||||||
|
}
|
||||||
|
return out
|
||||||
|
}
|
||||||
|
function child(buf, start, end, type) { return parseBoxes(buf, start, end).find((b) => b.type === type) || null }
|
||||||
|
function sub(buf, b) { return buf.subarray(b.start, b.end) }
|
||||||
|
function box(type, ...parts) {
|
||||||
|
const len = 8 + parts.reduce((n, p) => n + p.length, 0)
|
||||||
|
const out = new Uint8Array(len)
|
||||||
|
out.set(u32(len), 0)
|
||||||
|
out.set([...type].map((c) => c.charCodeAt(0)), 4)
|
||||||
|
let o = 8
|
||||||
|
for (const p of parts) { out.set(p, o); o += p.length }
|
||||||
|
return out
|
||||||
|
}
|
||||||
|
function concat(parts) {
|
||||||
|
const n = parts.reduce((a, p) => a + p.length, 0)
|
||||||
|
const out = new Uint8Array(n)
|
||||||
|
let o = 0
|
||||||
|
for (const p of parts) { out.set(p, o); o += p.length }
|
||||||
|
return out
|
||||||
|
}
|
||||||
|
|
||||||
|
// ---- tenc parsing ----------------------------------------------------------
|
||||||
|
export function stripInit() {}
|
||||||
|
export function initDrmWasm() {}
|
||||||
|
function tencOf(header) {
|
||||||
|
const moov = child(header, 0, header.length, "moov")
|
||||||
|
if (!moov) return null
|
||||||
|
const trak = child(header, moov.start + moov.hdr, moov.end, "trak")
|
||||||
|
if (!trak) return null
|
||||||
|
const mdia = child(header, trak.start + trak.hdr, trak.end, "mdia")
|
||||||
|
const minf = mdia && child(header, mdia.start + mdia.hdr, mdia.end, "minf")
|
||||||
|
const stbl = minf && child(header, minf.start + minf.hdr, minf.end, "stbl")
|
||||||
|
const stsd = stbl && child(header, stbl.start + stbl.hdr, stbl.end, "stsd")
|
||||||
|
if (!stsd) return null
|
||||||
|
for (const entry of parseBoxes(header, stsd.start + stsd.hdr + 8, stsd.end)) {
|
||||||
|
// the entry payload starts with raw sample-entry fields; the encryption
|
||||||
|
// info sits in frma/schm/schi (sometimes wrapped in sinf) — scan for a
|
||||||
|
// valid tenc box by its type bytes instead of walking a box tree
|
||||||
|
for (let p = entry.start + entry.hdr; p + 8 <= entry.end; p++) {
|
||||||
|
if (!(header[p + 4] === 0x74 && header[p + 5] === 0x65 && header[p + 6] === 0x6e && header[p + 7] === 0x63)) continue // "tenc"
|
||||||
|
const start = p
|
||||||
|
const size = ((header[start] << 24) | (header[start + 1] << 16) | (header[start + 2] << 8) | header[start + 3]) >>> 0
|
||||||
|
if (size < 20 || start + size > entry.end) continue
|
||||||
|
return { tenc: { type: "tenc", start, end: start + size, hdr: 8 }, sinf: null }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return null
|
||||||
|
}
|
||||||
|
export function tencMarker(header) {
|
||||||
|
const t = tencOf(header)
|
||||||
|
if (!t) return -1
|
||||||
|
return header[t.tenc.start + t.tenc.hdr + 7]
|
||||||
|
}
|
||||||
|
export function tencCryptPattern(header) {
|
||||||
|
const t = tencOf(header)
|
||||||
|
if (!t) return undefined
|
||||||
|
const ver = header[t.tenc.start + t.tenc.hdr]
|
||||||
|
if (ver !== 1) return undefined
|
||||||
|
const p = header[t.tenc.start + t.tenc.hdr + 24]
|
||||||
|
const crypt = p >> 4, skip = p & 15
|
||||||
|
return crypt || skip ? [skip, crypt] : undefined
|
||||||
|
}
|
||||||
|
export function tencConstantIv(header) {
|
||||||
|
const t = tencOf(header)
|
||||||
|
if (!t) return undefined
|
||||||
|
const ver = header[t.tenc.start + t.tenc.hdr]
|
||||||
|
if (ver !== 1) return undefined
|
||||||
|
const p = header[t.tenc.start + t.tenc.hdr + 24]
|
||||||
|
const size = header[t.tenc.start + t.tenc.hdr + 25]
|
||||||
|
if (!(p >> 4) || !size) return undefined
|
||||||
|
return header.slice(t.tenc.start + t.tenc.hdr + 26, t.tenc.start + t.tenc.hdr + 26 + size)
|
||||||
|
}
|
||||||
|
|
||||||
|
// ---- fragment decryption ---------------------------------------------------
|
||||||
|
const RENAME = new Set(["pssh", "senc", "saio", "saiz", "sbgp", "sgpd"])
|
||||||
|
|
||||||
|
function parseFragment(frag) {
|
||||||
|
const moof = child(frag, 0, Math.min(frag.length, 1 << 20), "moof")
|
||||||
|
if (!moof) throw new Error("no moof")
|
||||||
|
const traf = child(frag, moof.start + moof.hdr, moof.end, "traf")
|
||||||
|
if (!traf) throw new Error("no traf")
|
||||||
|
let dataOff = null, sizes = [], senc = null
|
||||||
|
for (const b of parseBoxes(frag, traf.start + traf.hdr, traf.end)) {
|
||||||
|
if (b.type === "trun") {
|
||||||
|
const flags = ((frag[b.start + b.hdr + 1] << 16) | (frag[b.start + b.hdr + 2] << 8) | frag[b.start + b.hdr + 3])
|
||||||
|
const count = ((frag[b.start + b.hdr + 4] << 24) | (frag[b.start + b.hdr + 5] << 16) | (frag[b.start + b.hdr + 6] << 8) | frag[b.start + b.hdr + 7]) >>> 0
|
||||||
|
let p = b.start + b.hdr + 8
|
||||||
|
if (flags & 0x1) { dataOff = ((frag[p] << 24) | (frag[p+1] << 16) | (frag[p+2] << 8) | frag[p+3]); p += 4 }
|
||||||
|
if (flags & 0x4) p += 4
|
||||||
|
for (let k = 0; k < count; k++) {
|
||||||
|
if (flags & 0x100) p += 4
|
||||||
|
if (flags & 0x200) { sizes.push(((frag[p] << 24) | (frag[p+1] << 16) | (frag[p+2] << 8) | frag[p+3]) >>> 0); p += 4 } else sizes.push(0)
|
||||||
|
if (flags & 0x400) p += 4
|
||||||
|
if (flags & 0x800) p += 4
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (b.type === "senc") senc = b
|
||||||
|
}
|
||||||
|
if (!senc) throw new Error("no senc")
|
||||||
|
const payload = frag.subarray(senc.start + senc.hdr, senc.end)
|
||||||
|
const sflags = ((payload[1] << 16) | (payload[2] << 8) | payload[3])
|
||||||
|
const count = ((payload[4] << 24) | (payload[5] << 16) | (payload[6] << 8) | payload[7]) >>> 0
|
||||||
|
let q = 8
|
||||||
|
const samples = []
|
||||||
|
for (let k = 0; k < count; k++) {
|
||||||
|
const iv = payload.slice(q, q + 8); q += 8
|
||||||
|
if (sflags & 0x2) {
|
||||||
|
const nsub = (payload[q] << 8) | payload[q + 1]; q += 2
|
||||||
|
const runs = []
|
||||||
|
for (let s = 0; s < nsub; s++) {
|
||||||
|
runs.push([(payload[q] << 8) | payload[q + 1], ((payload[q+2] << 24) | (payload[q+3] << 16) | (payload[q+4] << 8) | payload[q+5]) >>> 0])
|
||||||
|
q += 6
|
||||||
|
}
|
||||||
|
samples.push({ iv, runs })
|
||||||
|
} else {
|
||||||
|
samples.push({ iv, runs: [[0, sizes[k] || 0]] })
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// rename encryption boxes to free
|
||||||
|
for (const b of parseBoxes(frag, moof.start + moof.hdr, moof.end)) if (RENAME.has(b.type)) frag.set([102, 114, 101, 101], b.start + 4)
|
||||||
|
for (const b of parseBoxes(frag, traf.start + traf.hdr, traf.end)) if (RENAME.has(b.type)) frag.set([102, 114, 101, 101], b.start + 4)
|
||||||
|
return { samples, sizes, dataOff }
|
||||||
|
}
|
||||||
|
|
||||||
|
/** cenc (AES-CTR) — verified byte-identical */
|
||||||
|
export function decryptAndStripFragment(frag, key, marker) {
|
||||||
|
const { samples, sizes, dataOff } = parseFragment(frag)
|
||||||
|
const keys = makeKeys(key)
|
||||||
|
const ctr = new Uint8Array(16)
|
||||||
|
const ks = new Uint8Array(16)
|
||||||
|
let off = 0
|
||||||
|
for (let si = 0; si < samples.length; si++) {
|
||||||
|
const smp = samples[si]
|
||||||
|
let pos = 0
|
||||||
|
let counter = 0n
|
||||||
|
let kpos = 16
|
||||||
|
for (const [clear, prot] of smp.runs) {
|
||||||
|
pos += clear
|
||||||
|
for (let k = 0; k < prot; k++) {
|
||||||
|
if (kpos === 16) {
|
||||||
|
ctr.fill(0)
|
||||||
|
ctr.set(smp.iv, 0)
|
||||||
|
ctr.set([Number((counter >> 56n) & 255n), Number((counter >> 48n) & 255n), Number((counter >> 40n) & 255n), Number((counter >> 32n) & 255n), Number((counter >> 24n) & 255n), Number((counter >> 16n) & 255n), Number((counter >> 8n) & 255n), Number(counter & 255n)], 8)
|
||||||
|
encryptBlock(ks, 0, ctr, 0, keys)
|
||||||
|
counter++
|
||||||
|
kpos = 0
|
||||||
|
}
|
||||||
|
frag[dataOff + off + pos + k] ^= ks[kpos++]
|
||||||
|
}
|
||||||
|
pos += prot
|
||||||
|
}
|
||||||
|
off += sizes[si] || 0
|
||||||
|
}
|
||||||
|
return frag
|
||||||
|
}
|
||||||
|
|
||||||
|
/** cbcs (AES-CBC with pattern) */
|
||||||
|
export function decryptAndStripFragmentCbcs(frag, key, marker, skip, crypt, constantIv) {
|
||||||
|
const { samples, sizes, dataOff } = parseFragment(frag)
|
||||||
|
const keys = makeKeys(key)
|
||||||
|
let off = 0
|
||||||
|
for (let si = 0; si < samples.length; si++) {
|
||||||
|
const smp = samples[si]
|
||||||
|
let iv = new Uint8Array(16)
|
||||||
|
if (constantIv && constantIv.length) iv.set(constantIv)
|
||||||
|
else iv.set(smp.iv.subarray(0, 8), 0)
|
||||||
|
let pos = 0
|
||||||
|
for (const [clear, prot] of smp.runs) {
|
||||||
|
pos += clear
|
||||||
|
let rem = prot
|
||||||
|
while (rem > 0) {
|
||||||
|
const take = Math.min(16, rem)
|
||||||
|
const blk = frag.slice(dataOff + off + pos, dataOff + off + pos + 16)
|
||||||
|
const chain = blk.slice()
|
||||||
|
cbcDecrypt(blk, 0, 16, iv, keys)
|
||||||
|
frag.set(blk.subarray(0, take), dataOff + off + pos)
|
||||||
|
iv = chain
|
||||||
|
pos += take
|
||||||
|
rem -= take
|
||||||
|
}
|
||||||
|
}
|
||||||
|
off += sizes[si] || 0
|
||||||
|
}
|
||||||
|
return frag
|
||||||
|
}
|
||||||
|
|
||||||
|
// ---- progressive muxer (mirrors MuxPlanner) --------------------------------
|
||||||
|
const patchU32 = (b, at, v) => { b[at] = (v >>> 24) & 255; b[at+1] = (v >>> 16) & 255; b[at+2] = (v >>> 8) & 255; b[at+3] = v & 255 }
|
||||||
|
const readU32 = (b, o) => ((b[o] << 24) | (b[o+1] << 16) | (b[o+2] << 8) | b[o+3]) >>> 0
|
||||||
|
const u64 = (v) => [...u32(Math.floor(v / 2 ** 32)), ...u32(v >>> 0)]
|
||||||
|
const pad4 = (v) => v >>> 0
|
||||||
|
function fullbox(type, ver, ...parts) { return box(type, new Uint8Array([ver & 255, 0, 0, 0]), ...parts) }
|
||||||
|
|
||||||
|
function trackParts(header) {
|
||||||
|
const moov = child(header, 0, header.length, "moov")
|
||||||
|
const trak = child(header, moov.start + moov.hdr, moov.end, "trak")
|
||||||
|
const tkhd = child(header, trak.start + trak.hdr, trak.end, "tkhd")
|
||||||
|
const mdia = child(header, trak.start + trak.hdr, trak.end, "mdia")
|
||||||
|
const mdhd = child(header, mdia.start + mdia.hdr, mdia.end, "mdhd")
|
||||||
|
const hdlr = child(header, mdia.start + mdia.hdr, mdia.end, "hdlr")
|
||||||
|
const minf = child(header, mdia.start + mdia.hdr, mdia.end, "minf")
|
||||||
|
const stbl = child(header, minf.start + minf.hdr, minf.end, "stbl")
|
||||||
|
return {
|
||||||
|
moov,
|
||||||
|
tkhd: sub(header, tkhd),
|
||||||
|
mdhd: sub(header, mdhd),
|
||||||
|
hdlr: sub(header, hdlr),
|
||||||
|
vmhd: (() => { const b = child(header, minf.start + minf.hdr, minf.end, "vmhd"); return b && sub(header, b) })(),
|
||||||
|
smhd: (() => { const b = child(header, minf.start + minf.hdr, minf.end, "smhd"); return b && sub(header, b) })(),
|
||||||
|
dinf: sub(header, child(header, minf.start + minf.hdr, minf.end, "dinf")),
|
||||||
|
stsd: sub(header, child(header, stbl.start + stbl.hdr, stbl.end, "stsd")),
|
||||||
|
timescale: readU32(header, mdhd.start + mdhd.hdr + 12),
|
||||||
|
mvhd: null,
|
||||||
|
ftyp: null,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function moofSamples(moof) {
|
||||||
|
const traf = child(moof, 8, moof.length, "traf")
|
||||||
|
const trun = child(moof, traf.start + traf.hdr, traf.end, "trun")
|
||||||
|
const p = (trun.start + trun.hdr)
|
||||||
|
const flags = (moof[p+1] << 16) | (moof[p+2] << 8) | moof[p+3]
|
||||||
|
const count = readU32(moof, p + 4)
|
||||||
|
let q = p + 8
|
||||||
|
if (flags & 0x1) q += 4
|
||||||
|
let firstFlags = 0
|
||||||
|
if (flags & 0x4) { firstFlags = readU32(moof, q); q += 4 }
|
||||||
|
const samples = []
|
||||||
|
let sizeSum = 0
|
||||||
|
for (let k = 0; k < count; k++) {
|
||||||
|
const dur = flags & 0x100 ? readU32(moof, q) : 0
|
||||||
|
if (flags & 0x100) q += 4
|
||||||
|
const size = flags & 0x200 ? readU32(moof, q) : 0
|
||||||
|
if (flags & 0x200) q += 4
|
||||||
|
const sflags = flags & 0x400 ? readU32(moof, q) : (k === 0 ? firstFlags : 0)
|
||||||
|
if (flags & 0x400) q += 4
|
||||||
|
let comp = 0
|
||||||
|
if (flags & 0x800) { const raw = readU32(moof, q); comp = raw | 0; q += 4 }
|
||||||
|
samples.push({ dur, size, flags: sflags, comp, sync: k === 0 })
|
||||||
|
sizeSum += size
|
||||||
|
}
|
||||||
|
return { samples, sizeSum }
|
||||||
|
}
|
||||||
|
|
||||||
|
function rle(values) {
|
||||||
|
const out = []
|
||||||
|
let i = 0
|
||||||
|
while (i < values.length) {
|
||||||
|
let j = i
|
||||||
|
while (j + 1 < values.length && values[j + 1] === values[i]) j++
|
||||||
|
out.push([j - i + 1, values[i]])
|
||||||
|
i = j + 1
|
||||||
|
}
|
||||||
|
return out
|
||||||
|
}
|
||||||
|
const sttsOf = (samples) => { const r = rle(samples.map((s) => s.dur)); return fullbox("stts", 0, u32(r.length), ...r.flatMap(([c, d]) => [u32(c), u32(d)])) }
|
||||||
|
const cttsOf = (samples) => { const r = rle(samples.map((s) => s.comp)); return fullbox("ctts", 1, u32(r.length), ...r.flatMap(([c, d]) => [u32(c), u32(d)])) }
|
||||||
|
const stssOf = (samples) => {
|
||||||
|
const sync = []
|
||||||
|
samples.forEach((s, i) => { if (s.sync && !(s.flags & 0x10000)) sync.push(u32(i + 1)) })
|
||||||
|
return fullbox("stss", 0, u32(sync.length), ...sync)
|
||||||
|
}
|
||||||
|
const stscOf = (chunks) => {
|
||||||
|
const r = rle(chunks.map((c) => c[2]))
|
||||||
|
let chunkNo = 1
|
||||||
|
const parts = []
|
||||||
|
for (const [count, per] of r) { parts.push(u32(chunkNo), u32(per), u32(1)); chunkNo += count }
|
||||||
|
return fullbox("stsc", 0, u32(r.length), ...parts)
|
||||||
|
}
|
||||||
|
const stszOf = (samples) => fullbox("stsz", 0, u32(0), u32(samples.length), ...samples.map((s) => u32(s.size)))
|
||||||
|
const co64Of = (chunks) => fullbox("co64", 0, u32(chunks.length), ...chunks.map(() => new Uint8Array(8)))
|
||||||
|
|
||||||
|
export class MuxPlanner {
|
||||||
|
constructor(videoHeader, audioHeader) {
|
||||||
|
this.v = trackParts(videoHeader)
|
||||||
|
this.v.ftyp = sub(videoHeader, child(videoHeader, 0, videoHeader.length, "ftyp"))
|
||||||
|
this.v.mvhd = sub(videoHeader, child(videoHeader, this.v.moov.start + this.v.moov.hdr, this.v.moov.end, "mvhd"))
|
||||||
|
this.a = audioHeader ? trackParts(audioHeader) : null
|
||||||
|
this.vs = []
|
||||||
|
this.as = []
|
||||||
|
this.vchunks = []
|
||||||
|
this.achunks = []
|
||||||
|
}
|
||||||
|
pushVideoMoof(moof, offset) {
|
||||||
|
const s = moofSamples(moof)
|
||||||
|
this.vs.push(...s.samples)
|
||||||
|
this.vchunks.push([offset + moof.length + 8, s.sizeSum, s.samples.length])
|
||||||
|
}
|
||||||
|
pushAudioMoof(moof, offset) {
|
||||||
|
const s = moofSamples(moof)
|
||||||
|
this.as.push(...s.samples)
|
||||||
|
this.achunks.push([offset + moof.length + 8, s.sizeSum, s.samples.length])
|
||||||
|
}
|
||||||
|
finish() {
|
||||||
|
const vDur = this.vs.reduce((n, s) => n + s.dur, 0)
|
||||||
|
const aDur = this.as.reduce((n, s) => n + s.dur, 0)
|
||||||
|
const movieTs = this.v.timescale
|
||||||
|
const vFirstDur = this.vs.length ? this.vs[0].dur : 1
|
||||||
|
const vTrackDur = vDur + vFirstDur
|
||||||
|
const aTrackDur = this.a ? Math.round(aDur * movieTs / this.a.timescale) : 0
|
||||||
|
const movieDur = Math.max(vTrackDur, aTrackDur)
|
||||||
|
const trackCount = this.a ? 2 : 1
|
||||||
|
|
||||||
|
// --- layout: interleave chunks video/audio ---
|
||||||
|
const layout = []
|
||||||
|
const n = Math.max(this.vchunks.length, this.achunks.length)
|
||||||
|
for (let k = 0; k < n; k++) {
|
||||||
|
const vc = this.vchunks[k]
|
||||||
|
if (vc) layout.push(1, vc[0], vc[1])
|
||||||
|
const ac = this.achunks[k]
|
||||||
|
if (ac) layout.push(0, ac[0], ac[1])
|
||||||
|
}
|
||||||
|
|
||||||
|
// --- build header with placeholder co64 + mdat header (16B, 64-bit size) ---
|
||||||
|
const mdatPayload = layout.reduce((sum, val, i) => (i % 3 === 2 ? sum + val : sum), 0)
|
||||||
|
const vTkhd = this.v.tkhd.slice()
|
||||||
|
patchU32(vTkhd, 8 + 12, 1)
|
||||||
|
patchU32(vTkhd, 8 + 20, vTrackDur)
|
||||||
|
const mdhdV = this.v.mdhd.slice()
|
||||||
|
patchU32(mdhdV, 8 + 12, movieTs)
|
||||||
|
patchU32(mdhdV, 8 + 16, vDur)
|
||||||
|
const elstEntries = [u32(vFirstDur), u32(0xffffffff), u32(0x00010000), u32(vDur), u32(vFirstDur), u32(0x00010000)]
|
||||||
|
const edts = box("edts", fullbox("elst", 0, u32(2), ...elstEntries))
|
||||||
|
// sample entries must be plain avc1/mp4a — the source stsd may be the
|
||||||
|
// encrypted encv/enca variant, which players like AVFoundation refuse
|
||||||
|
const stsdV = this.v.stsd.slice()
|
||||||
|
if (stsdV[20] === 0x65 && stsdV[21] === 0x6e && stsdV[22] === 0x63 && stsdV[23] === 0x76) stsdV.set([97, 118, 99, 49], 20) // encv -> avc1
|
||||||
|
const co64V = co64Of(this.vchunks)
|
||||||
|
const stblV = box("stbl", stsdV, sttsOf(this.vs), cttsOf(this.vs), stssOf(this.vs), stscOf(this.vchunks), stszOf(this.vs), co64V)
|
||||||
|
const minfV = box("minf", this.v.vmhd, this.v.dinf, stblV)
|
||||||
|
const mdiaV = box("mdia", mdhdV, this.v.hdlr, minfV)
|
||||||
|
const trakV = box("trak", vTkhd, edts, mdiaV)
|
||||||
|
|
||||||
|
let trakA = null
|
||||||
|
let co64A = null
|
||||||
|
if (this.a) {
|
||||||
|
const aTkhd = this.a.tkhd.slice()
|
||||||
|
patchU32(aTkhd, 8 + 12, 2)
|
||||||
|
patchU32(aTkhd, 8 + 20, aTrackDur)
|
||||||
|
const stsdA = this.a.stsd.slice()
|
||||||
|
if (stsdA[20] === 0x65 && stsdA[21] === 0x6e && stsdA[22] === 0x63 && stsdA[23] === 0x61) stsdA.set([109, 112, 52, 97], 20) // enca -> mp4a
|
||||||
|
co64A = co64Of(this.achunks)
|
||||||
|
const stblA = box("stbl", stsdA, sttsOf(this.as), stscOf(this.achunks), stszOf(this.as), co64A)
|
||||||
|
const minfA = box("minf", this.a.smhd, this.a.dinf, stblA)
|
||||||
|
const mdiaA = box("mdia", this.a.mdhd, this.a.hdlr, minfA)
|
||||||
|
trakA = box("trak", aTkhd, mdiaA)
|
||||||
|
}
|
||||||
|
|
||||||
|
const mvhd = this.v.mvhd.slice()
|
||||||
|
patchU32(mvhd, 8 + 16, movieDur)
|
||||||
|
patchU32(mvhd, 8 + 96, trackCount + 1)
|
||||||
|
const moov = box("moov", mvhd, trakV, ...(trakA ? [trakA] : []))
|
||||||
|
const header = concat([this.v.ftyp, moov])
|
||||||
|
|
||||||
|
// patch real chunk offsets (header len + 16-byte ftyp?? no — mdat header 16)
|
||||||
|
const mdatStart = header.length + 16
|
||||||
|
// patch real chunk offsets into the finished header's co64 boxes
|
||||||
|
const mdatStart2 = header.length + 16
|
||||||
|
const co64s = []
|
||||||
|
const collect = (start2, end2) => {
|
||||||
|
for (const b of parseBoxes(header, start2, end2)) {
|
||||||
|
if (b.type === "co64") co64s.push(b)
|
||||||
|
if (["moov","trak","mdia","minf","stbl"].includes(b.type)) collect(b.start + b.hdr, b.end)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
collect(0, header.length)
|
||||||
|
const vo2 = [0, 0]
|
||||||
|
let cum2 = 0
|
||||||
|
let ci = 0
|
||||||
|
for (let k = 0; k < n; k++) {
|
||||||
|
const vc = this.vchunks[k]
|
||||||
|
if (vc) {
|
||||||
|
const b = co64s[0]
|
||||||
|
const off = mdatStart2 + cum2
|
||||||
|
patchU32(header, b.start + 16 + vo2[0], 0)
|
||||||
|
patchU32(header, b.start + 16 + vo2[0] + 4, off)
|
||||||
|
vo2[0] += 8
|
||||||
|
cum2 += vc[1]
|
||||||
|
}
|
||||||
|
const ac = this.achunks[k]
|
||||||
|
if (ac) {
|
||||||
|
const b = co64s[1]
|
||||||
|
if (b) {
|
||||||
|
const off = mdatStart2 + cum2
|
||||||
|
patchU32(header, b.start + 16 + vo2[1], 0)
|
||||||
|
patchU32(header, b.start + 16 + vo2[1] + 4, off)
|
||||||
|
vo2[1] += 8
|
||||||
|
}
|
||||||
|
cum2 += ac[1]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
ci = 0
|
||||||
|
// header byte sizes must be unchanged by patching — they are.
|
||||||
|
|
||||||
|
const mdatHeader = new Uint8Array(16)
|
||||||
|
mdatHeader.set(u32(1), 0)
|
||||||
|
mdatHeader.set([109, 100, 97, 116], 4) // mdat
|
||||||
|
const total = 16 + mdatPayload
|
||||||
|
mdatHeader.set(u64(total).slice(4), 8) // 64-bit size low half?? fixed below
|
||||||
|
mdatHeader.set([...u32(Math.floor(total / 2 ** 32)), ...u32(total >>> 0)], 8)
|
||||||
|
const full = concat([header, mdatHeader])
|
||||||
|
return new MuxResult(full, layout, mdatHeader)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
class MuxResult {
|
||||||
|
constructor(header, layout, mdatHeader) {
|
||||||
|
this._h = header
|
||||||
|
this._l = layout
|
||||||
|
this._m = mdatHeader
|
||||||
|
}
|
||||||
|
header() { return this._h }
|
||||||
|
layout() { return this._l }
|
||||||
|
mdatHeader() { return this._m }
|
||||||
|
}
|
||||||
100
ext/lib/paths.js
Normal file
100
ext/lib/paths.js
Normal file
@@ -0,0 +1,100 @@
|
|||||||
|
// Folder/filename scheme builder, shared by background + options preview.
|
||||||
|
// Folder and file naming schemes.
|
||||||
|
|
||||||
|
export const SINGLE_SCHEMES = {
|
||||||
|
one: { label: "One folder", desc: "Saves go straight into Downloads.", folders: [] },
|
||||||
|
creator: { label: "By creator", desc: "A folder for each creator.", folders: ["{creator}"] },
|
||||||
|
"creator-type": {
|
||||||
|
label: "By creator and type",
|
||||||
|
rec: true,
|
||||||
|
desc: "A folder per creator, with Videos, Photos and Audio inside.",
|
||||||
|
folders: ["{creator}", "{typeFolder}"],
|
||||||
|
},
|
||||||
|
"site-creator-type": {
|
||||||
|
label: "By site, creator and type",
|
||||||
|
desc: "Like By creator and type, with a folder for each site on top.",
|
||||||
|
folders: ["OnlyFans", "{creator}", "{typeFolder}"],
|
||||||
|
},
|
||||||
|
};
|
||||||
|
|
||||||
|
export const BULK_SCHEMES = {
|
||||||
|
"creator-section-type": {
|
||||||
|
label: "By creator, section and type",
|
||||||
|
rec: true,
|
||||||
|
desc: "A folder per creator, then Timeline, Messages, Paid… with Videos and Photos inside.",
|
||||||
|
folders: ["{creator}", "{section}", "{typeFolder}"],
|
||||||
|
},
|
||||||
|
same: { label: "Same as single downloads", desc: "Bulk downloads fill the folders your single downloads use.", same: true },
|
||||||
|
"creator-date-section": {
|
||||||
|
label: "By creator, date and section (classic)",
|
||||||
|
desc: "A folder for the day each run starts, split by section.",
|
||||||
|
folders: ["{creator}", "{date}", "{section}"],
|
||||||
|
},
|
||||||
|
one: { label: "One folder", desc: "Saves go straight into Downloads.", folders: [] },
|
||||||
|
};
|
||||||
|
|
||||||
|
const TYPE_FOLDERS = { video: "Videos", photo: "Photos", gif: "Photos", audio: "Audio" };
|
||||||
|
|
||||||
|
/** Build the full download path (relative to Downloads).
|
||||||
|
* opts: { scheme, bulk, creator, type, section, date(ts s|Date|str), timestamp, mediaId, postId, quality, ext, template } */
|
||||||
|
export function buildPath(opts) {
|
||||||
|
const scheme = opts.scheme ?? "creator-type";
|
||||||
|
const def = opts.bulk ? BULK_SCHEMES[scheme] ?? BULK_SCHEMES.same : SINGLE_SCHEMES[scheme] ?? SINGLE_SCHEMES["creator-type"];
|
||||||
|
const folders = def.same ? (SINGLE_SCHEMES[opts.singleScheme ?? "creator-type"] ?? SINGLE_SCHEMES["creator-type"]).folders : def.folders;
|
||||||
|
|
||||||
|
const type = opts.type ?? "video";
|
||||||
|
const typeFolder = TYPE_FOLDERS[type] ?? "Other";
|
||||||
|
const date = formatDate(opts.date);
|
||||||
|
const creator = sanitize(opts.creator ?? "unknown");
|
||||||
|
|
||||||
|
const parts = folders.map((f) =>
|
||||||
|
sanitize(
|
||||||
|
f
|
||||||
|
.replaceAll("{creator}", creator)
|
||||||
|
.replaceAll("{typeFolder}", typeFolder)
|
||||||
|
.replaceAll("{section}", sanitize(opts.section ?? "Timeline"))
|
||||||
|
.replaceAll("{date}", date)
|
||||||
|
)
|
||||||
|
);
|
||||||
|
|
||||||
|
const name = buildName(opts);
|
||||||
|
return [...parts, name].filter(Boolean).join("/");
|
||||||
|
}
|
||||||
|
|
||||||
|
export function buildName(opts) {
|
||||||
|
const type = opts.type ?? "video";
|
||||||
|
const template = opts.template ?? "{creator}_{type}_{date}_{timestamp}_{mediaId}_{quality}";
|
||||||
|
const out = template
|
||||||
|
.replaceAll("{creator}", sanitize(opts.creator ?? "unknown"))
|
||||||
|
.replaceAll("{type}", type)
|
||||||
|
.replaceAll("{date}", formatDate(opts.date))
|
||||||
|
.replaceAll("{timestamp}", String(opts.timestamp ?? Math.floor(Date.now() / 1000)))
|
||||||
|
.replaceAll("{mediaId}", String(opts.mediaId ?? ""))
|
||||||
|
.replaceAll("{postId}", String(opts.postId ?? ""))
|
||||||
|
.replaceAll("{quality}", opts.quality ?? "")
|
||||||
|
.replaceAll("{ext}", opts.ext ?? "mp4")
|
||||||
|
.replace(/_+(\.)/g, "$1")
|
||||||
|
.replace(/_{2,}/g, "_");
|
||||||
|
const out2 = sanitize(out);
|
||||||
|
// always end with a sensible extension
|
||||||
|
const ext = (opts.ext ?? "mp4").replace(/^\./, "");
|
||||||
|
return out2.toLowerCase().endsWith("." + ext.toLowerCase()) ? out2 : `${out2.replace(/_+$/, "")}.${ext}`;
|
||||||
|
}
|
||||||
|
|
||||||
|
function formatDate(d) {
|
||||||
|
if (!d) return "";
|
||||||
|
let date;
|
||||||
|
if (d instanceof Date) date = d;
|
||||||
|
else if (typeof d === "number") date = new Date(d * (d > 1e12 ? 1 : 1000));
|
||||||
|
else {
|
||||||
|
const parsed = Date.parse(d);
|
||||||
|
if (Number.isNaN(parsed)) return sanitize(String(d));
|
||||||
|
date = new Date(parsed);
|
||||||
|
}
|
||||||
|
const p = (n) => String(n).padStart(2, "0");
|
||||||
|
return `${date.getFullYear()}-${p(date.getMonth() + 1)}-${p(date.getDate())}`;
|
||||||
|
}
|
||||||
|
|
||||||
|
function sanitize(s) {
|
||||||
|
return String(s ?? "").replace(/[^\w.-]+/g, "_").replace(/^\.+/, "_");
|
||||||
|
}
|
||||||
104
ext/lib/pb.js
Normal file
104
ext/lib/pb.js
Normal file
@@ -0,0 +1,104 @@
|
|||||||
|
/** Minimal protobuf wire-format writer/reader (widevine messages) — Uint8Array only (browser-safe). */
|
||||||
|
|
||||||
|
export function varint(n) {
|
||||||
|
const out = [];
|
||||||
|
let v = BigInt(n);
|
||||||
|
while (v > 0x7fn) {
|
||||||
|
out.push(Number((v & 0x7fn) | 0x80n));
|
||||||
|
v >>= 7n;
|
||||||
|
}
|
||||||
|
out.push(Number(v));
|
||||||
|
return new Uint8Array(out);
|
||||||
|
}
|
||||||
|
|
||||||
|
export function tag(field, wire) {
|
||||||
|
return varint((field << 3) | wire);
|
||||||
|
}
|
||||||
|
|
||||||
|
export function pbVarint(field, value) {
|
||||||
|
return concat(tag(field, 0), varint(value));
|
||||||
|
}
|
||||||
|
|
||||||
|
export function pbBytes(field, buf) {
|
||||||
|
return concat(tag(field, 2), varint(buf.length), buf);
|
||||||
|
}
|
||||||
|
|
||||||
|
export function pbString(field, str) {
|
||||||
|
return pbBytes(field, new TextEncoder().encode(str));
|
||||||
|
}
|
||||||
|
|
||||||
|
/** Concatenate pre-encoded fields. */
|
||||||
|
export function pbMsg(...parts) {
|
||||||
|
return concat(...parts);
|
||||||
|
}
|
||||||
|
|
||||||
|
export function concat(...arrays) {
|
||||||
|
const len = arrays.reduce((n, a) => n + a.length, 0);
|
||||||
|
const out = new Uint8Array(len);
|
||||||
|
let o = 0;
|
||||||
|
for (const a of arrays) { out.set(a, o); o += a.length; }
|
||||||
|
return out;
|
||||||
|
}
|
||||||
|
|
||||||
|
export function tryParse(buf) {
|
||||||
|
const out = [];
|
||||||
|
let i = 0;
|
||||||
|
while (i < buf.length) {
|
||||||
|
let key = 0, shift = 0;
|
||||||
|
while (true) {
|
||||||
|
if (i >= buf.length) return null;
|
||||||
|
const b = buf[i++];
|
||||||
|
key |= (b & 0x7f) << shift;
|
||||||
|
if (!(b & 0x80)) break;
|
||||||
|
shift += 7;
|
||||||
|
if (shift > 35) return null;
|
||||||
|
}
|
||||||
|
const field = key >> 3, wire = key & 7;
|
||||||
|
if (field === 0) return null;
|
||||||
|
if (wire === 0) {
|
||||||
|
let v = 0n, s = 0n;
|
||||||
|
while (true) {
|
||||||
|
if (i >= buf.length) return null;
|
||||||
|
const b = buf[i++];
|
||||||
|
v |= BigInt(b & 0x7f) << s;
|
||||||
|
if (!(b & 0x80)) break;
|
||||||
|
s += 7n;
|
||||||
|
}
|
||||||
|
out.push([field, 0, v]);
|
||||||
|
} else if (wire === 1) {
|
||||||
|
if (i + 8 > buf.length) return null;
|
||||||
|
out.push([field, 1, buf.slice(i, i + 8)]);
|
||||||
|
i += 8;
|
||||||
|
} else if (wire === 2) {
|
||||||
|
let len = 0, sh = 0;
|
||||||
|
while (true) {
|
||||||
|
if (i >= buf.length) return null;
|
||||||
|
const b = buf[i++];
|
||||||
|
len |= (b & 0x7f) << sh;
|
||||||
|
if (!(b & 0x80)) break;
|
||||||
|
sh += 7;
|
||||||
|
if (sh > 30) return null;
|
||||||
|
}
|
||||||
|
if (i + len > buf.length) return null;
|
||||||
|
out.push([field, 2, buf.slice(i, i + len)]);
|
||||||
|
i += len;
|
||||||
|
} else if (wire === 5) {
|
||||||
|
if (i + 4 > buf.length) return null;
|
||||||
|
out.push([field, 5, buf.slice(i, i + 4)]);
|
||||||
|
i += 4;
|
||||||
|
} else return null;
|
||||||
|
}
|
||||||
|
return out;
|
||||||
|
}
|
||||||
|
|
||||||
|
/** Get field values: getAll(buf, field) → array of values. */
|
||||||
|
export function getAll(buf, field) {
|
||||||
|
const fields = tryParse(buf);
|
||||||
|
if (!fields) return [];
|
||||||
|
return fields.filter(([f]) => f === field).map(([, , v]) => v);
|
||||||
|
}
|
||||||
|
|
||||||
|
export function get(buf, field) {
|
||||||
|
const all = getAll(buf, field);
|
||||||
|
return all.length ? all[0] : undefined;
|
||||||
|
}
|
||||||
4
ext/lib/signer-module.js
Normal file
4
ext/lib/signer-module.js
Normal file
File diff suppressed because one or more lines are too long
222
ext/lib/signer.js
Normal file
222
ext/lib/signer.js
Normal file
@@ -0,0 +1,222 @@
|
|||||||
|
// Live OF request signer — port of ofsaver's ofrules.js for the offscreen
|
||||||
|
// document (eval allowed via relaxed CSP). In-memory cache per revision.
|
||||||
|
|
||||||
|
const BUNDLE_ROOT = "https://static2.onlyfans.com/static/prod/f";
|
||||||
|
const REV_ENDPOINT = "https://onlyfans.com/api2/v2/ip";
|
||||||
|
const RC4_ALPHABET =
|
||||||
|
"abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789+/=";
|
||||||
|
export const APP_TOKEN = "33d57ade8c02dbc5a333db99ff9ae26a";
|
||||||
|
|
||||||
|
// --- sync SHA-1 (hex) — the signer's dep is called synchronously ----------
|
||||||
|
export function sha1hex(text) {
|
||||||
|
const msg = new TextEncoder().encode(text);
|
||||||
|
const ml = msg.length;
|
||||||
|
const padded = new Uint8Array((((ml + 8) >> 6) + 1) << 6);
|
||||||
|
padded.set(msg);
|
||||||
|
padded[ml] = 0x80;
|
||||||
|
const bitLen = ml * 8;
|
||||||
|
const dv = new DataView(padded.buffer);
|
||||||
|
dv.setUint32(padded.length - 4, bitLen >>> 0);
|
||||||
|
dv.setUint32(padded.length - 8, Math.floor(bitLen / 2 ** 32));
|
||||||
|
let h0 = 0x67452301, h1 = 0xefcdab89, h2 = 0x98badcfe, h3 = 0x10325476, h4 = 0xc3d2e1f0;
|
||||||
|
const w = new Uint32Array(80);
|
||||||
|
const rol = (x, n) => (x << n) | (x >>> (32 - n));
|
||||||
|
for (let i = 0; i < padded.length; i += 64) {
|
||||||
|
for (let j = 0; j < 16; j++) w[j] = dv.getUint32(i + j * 4);
|
||||||
|
for (let j = 16; j < 80; j++) w[j] = rol(w[j - 3] ^ w[j - 8] ^ w[j - 14] ^ w[j - 16], 1);
|
||||||
|
let a = h0, b = h1, c = h2, d = h3, e = h4;
|
||||||
|
for (let j = 0; j < 80; j++) {
|
||||||
|
let f, k;
|
||||||
|
if (j < 20) { f = (b & c) | (~b & d); k = 0x5a827999; }
|
||||||
|
else if (j < 40) { f = b ^ c ^ d; k = 0x6ed9eba1; }
|
||||||
|
else if (j < 60) { f = (b & c) | (b & d) | (c & d); k = 0x8f1bbcdc; }
|
||||||
|
else { f = b ^ c ^ d; k = 0xca62c1d6; }
|
||||||
|
const t = (rol(a, 5) + f + e + k + w[j]) >>> 0;
|
||||||
|
e = d; d = c; c = rol(b, 30); b = a; a = t;
|
||||||
|
}
|
||||||
|
h0 = (h0 + a) >>> 0; h1 = (h1 + b) >>> 0; h2 = (h2 + c) >>> 0; h3 = (h3 + d) >>> 0; h4 = (h4 + e) >>> 0;
|
||||||
|
}
|
||||||
|
return [h0, h1, h2, h3, h4].map((x) => x.toString(16).padStart(8, "0")).join("");
|
||||||
|
}
|
||||||
|
|
||||||
|
export function pathGet(obj, path, fallback) {
|
||||||
|
if (obj == null) return fallback;
|
||||||
|
let cur = obj;
|
||||||
|
for (const key of String(path).split(".")) {
|
||||||
|
if (cur == null) return fallback;
|
||||||
|
cur = cur[key];
|
||||||
|
}
|
||||||
|
return cur === undefined ? fallback : cur;
|
||||||
|
}
|
||||||
|
|
||||||
|
export async function fetchRevision() {
|
||||||
|
const res = await fetch(REV_ENDPOINT, { method: "HEAD", signal: AbortSignal.timeout(10_000) });
|
||||||
|
const rev = res.headers.get("x-of-rev");
|
||||||
|
if (!rev) throw new Error("no x-of-rev header on /api2/v2/ip response");
|
||||||
|
return rev;
|
||||||
|
}
|
||||||
|
|
||||||
|
export function extractChunkRenameMap(appJs) {
|
||||||
|
const marker = '}[e]||e)+".js"';
|
||||||
|
const idx = appJs.indexOf(marker);
|
||||||
|
if (idx === -1) throw new Error("chunk map not found in app.js");
|
||||||
|
const start = appJs.lastIndexOf("({", idx) + 1;
|
||||||
|
const literal = appJs.slice(start, idx);
|
||||||
|
const map = {};
|
||||||
|
for (const m of literal.matchAll(/(\d+):"([^"]+)"/g)) map[m[1]] = m[2];
|
||||||
|
return map;
|
||||||
|
}
|
||||||
|
|
||||||
|
export function extractInitialChunkIds(appJs) {
|
||||||
|
const m = appJs.match(/\.O\(void 0,\[([\d,]+)\]/);
|
||||||
|
if (!m) throw new Error("initial chunk list not found in app.js");
|
||||||
|
return m[1].split(",").filter(Boolean);
|
||||||
|
}
|
||||||
|
|
||||||
|
export function extractModuleSource(chunkText, moduleId) {
|
||||||
|
const key = `${moduleId}:function(`;
|
||||||
|
const start = chunkText.indexOf(key);
|
||||||
|
if (start === -1) return null;
|
||||||
|
const fnStart = start + moduleId.length + 1;
|
||||||
|
const bodyStart = chunkText.indexOf("{", fnStart);
|
||||||
|
let depth = 0, inStr = null, esc = false;
|
||||||
|
for (let i = bodyStart; i < chunkText.length; i++) {
|
||||||
|
const ch = chunkText[i];
|
||||||
|
if (esc) { esc = false; continue; }
|
||||||
|
if (inStr) {
|
||||||
|
if (ch === "\\") esc = true;
|
||||||
|
else if (ch === inStr) inStr = null;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
if (ch === '"' || ch === "'" || ch === "`") { inStr = ch; continue; }
|
||||||
|
if (ch === "{") depth++;
|
||||||
|
else if (ch === "}") {
|
||||||
|
depth--;
|
||||||
|
if (depth === 0) return chunkText.slice(fnStart, i + 1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
function moduleIdBefore(chunkText, markerIndex) {
|
||||||
|
const re = /(\d+):function\(/g;
|
||||||
|
let last = null, m;
|
||||||
|
while ((m = re.exec(chunkText)) && m.index < markerIndex) last = m;
|
||||||
|
return last ? last[1] : null;
|
||||||
|
}
|
||||||
|
|
||||||
|
function makeRequire(table) {
|
||||||
|
const cache = {};
|
||||||
|
const req = (id) => {
|
||||||
|
if (cache[id]) return cache[id].exports;
|
||||||
|
const fn = table[id];
|
||||||
|
if (!fn) throw new Error("missing module " + id);
|
||||||
|
const mod = { exports: {} };
|
||||||
|
cache[id] = mod;
|
||||||
|
fn.call(mod.exports, mod, mod.exports, req);
|
||||||
|
return mod.exports;
|
||||||
|
};
|
||||||
|
req.d = (exports, definition) => {
|
||||||
|
for (const key in definition)
|
||||||
|
if (!Object.prototype.hasOwnProperty.call(exports, key) &&
|
||||||
|
Object.prototype.hasOwnProperty.call(definition, key))
|
||||||
|
Object.defineProperty(exports, key, { enumerable: true, get: definition[key] });
|
||||||
|
};
|
||||||
|
req.n = (module) => {
|
||||||
|
const getter = module && module.__esModule ? () => module.default : () => module;
|
||||||
|
req.d(getter, { a: getter });
|
||||||
|
return getter;
|
||||||
|
};
|
||||||
|
req.o = (obj, prop) => Object.prototype.hasOwnProperty.call(obj, prop);
|
||||||
|
req.r = (exports) => {
|
||||||
|
Object.defineProperty(exports, "__esModule", { value: true });
|
||||||
|
};
|
||||||
|
return req;
|
||||||
|
}
|
||||||
|
|
||||||
|
function makeUniversalDep(userIdHolder) {
|
||||||
|
const dep = function (a, b, c) {
|
||||||
|
if (b === undefined) return sha1hex(String(a));
|
||||||
|
return pathGet(a, b, c);
|
||||||
|
};
|
||||||
|
dep.A = {
|
||||||
|
get getters() { return { "auth/authUserId": userIdHolder.value }; },
|
||||||
|
};
|
||||||
|
return dep;
|
||||||
|
}
|
||||||
|
|
||||||
|
import signerFactoryDefault from "./signer-module.js";
|
||||||
|
|
||||||
|
async function registerSigner(table, signerModuleId, signerSource, userIdHolder) {
|
||||||
|
const t = { ...table };
|
||||||
|
const header = signerSource.slice(0, 800);
|
||||||
|
for (const m of header.matchAll(/([A-Za-z_$][\w$]*)=t\((\d+)\)/g)) {
|
||||||
|
const id = m[2];
|
||||||
|
t[id] = (module) => { module.exports = makeUniversalDep(userIdHolder); };
|
||||||
|
}
|
||||||
|
t[signerModuleId] = signerFactoryDefault;
|
||||||
|
return t;
|
||||||
|
}
|
||||||
|
|
||||||
|
const bundleCache = new Map(); // rev -> {appJs, chunks: Map}
|
||||||
|
async function cachedFetch(rev, name, url) {
|
||||||
|
let entry = bundleCache.get(rev);
|
||||||
|
if (!entry) { entry = { chunks: new Map() }; bundleCache.set(rev, entry); }
|
||||||
|
if (name === "app.js") {
|
||||||
|
if (!entry.appJs) entry.appJs = await (await fetch(url, { signal: AbortSignal.timeout(60_000) })).text();
|
||||||
|
return entry.appJs;
|
||||||
|
}
|
||||||
|
if (!entry.chunks.has(name)) {
|
||||||
|
entry.chunks.set(name, await (await fetch(url, { signal: AbortSignal.timeout(60_000) })).text());
|
||||||
|
}
|
||||||
|
return entry.chunks.get(name);
|
||||||
|
}
|
||||||
|
|
||||||
|
/** Build the live signer: { revision, appToken, sign(urlPath, userId) }. */
|
||||||
|
export async function loadLiveSigner(log = () => {}) {
|
||||||
|
if (typeof globalThis.window === "undefined") globalThis.window = globalThis;
|
||||||
|
const rev = await fetchRevision();
|
||||||
|
log(`bundle revision: ${rev}`);
|
||||||
|
|
||||||
|
const appJs = await cachedFetch(rev, "app.js", `${BUNDLE_ROOT}/${rev}/app.js`);
|
||||||
|
const renameMap = extractChunkRenameMap(appJs);
|
||||||
|
const initialIds = extractInitialChunkIds(appJs);
|
||||||
|
log(`initial chunks: ${initialIds.length}`);
|
||||||
|
|
||||||
|
const userIdHolder = { value: "0" };
|
||||||
|
for (const id of initialIds) {
|
||||||
|
const name = renameMap[id] ?? id;
|
||||||
|
let text;
|
||||||
|
try {
|
||||||
|
text = await cachedFetch(rev, `${name}.js`, `${BUNDLE_ROOT}/${rev}/${name}.js`);
|
||||||
|
} catch { continue; }
|
||||||
|
const markerIdx = text.indexOf(RC4_ALPHABET);
|
||||||
|
if (markerIdx === -1) continue;
|
||||||
|
const moduleId = moduleIdBefore(text, markerIdx);
|
||||||
|
if (!moduleId) continue;
|
||||||
|
const source = extractModuleSource(text, moduleId);
|
||||||
|
if (!source || !/\.A\s*=/.test(source)) continue;
|
||||||
|
try {
|
||||||
|
const table = await registerSigner({}, moduleId, source, userIdHolder);
|
||||||
|
const signer = makeRequire(table)(moduleId);
|
||||||
|
if (typeof signer.A !== "function") continue;
|
||||||
|
userIdHolder.value = "0";
|
||||||
|
const probe = signer.A({ url: "/api2/v2/users/me" });
|
||||||
|
if (!probe || typeof probe.sign !== "string" || probe.sign.split(":").length < 3 || !probe.time) continue;
|
||||||
|
log(`signer module ${moduleId} active from chunk ${name}.js`);
|
||||||
|
return {
|
||||||
|
mode: "bundle",
|
||||||
|
revision: rev,
|
||||||
|
appToken: APP_TOKEN,
|
||||||
|
sign(urlPath, userId) {
|
||||||
|
userIdHolder.value = String(userId ?? "0");
|
||||||
|
const out = signer.A({ url: urlPath });
|
||||||
|
return { sign: out.sign, time: String(out.time) };
|
||||||
|
},
|
||||||
|
};
|
||||||
|
} catch (err) {
|
||||||
|
log(`candidate chunk ${name}.js failed: ${err.message}`);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
throw new Error("signer module not found in any initial chunk");
|
||||||
|
}
|
||||||
220
ext/lib/wv.js
Normal file
220
ext/lib/wv.js
Normal file
@@ -0,0 +1,220 @@
|
|||||||
|
// Widevine L3 DRM core for the browser (WebCrypto port of ofsaver's src/drm).
|
||||||
|
// Same protocol as ofsaver: classic device blob, PSS-SHA1 challenge signature,
|
||||||
|
// CMAC key derivation, AES-CBC key unwrap, HMAC license verify.
|
||||||
|
import { CLIENT_BLOB_B64, PRIVATE_KEY_DER_B64 } from "./device.js";
|
||||||
|
import { pbMsg, pbBytes, pbVarint, pbString, tryParse, get, getAll } from "./pb.js";
|
||||||
|
|
||||||
|
// ---- crypto helpers ----------------------------------------------------
|
||||||
|
|
||||||
|
const b64ToBytes = (b64) => {
|
||||||
|
const bin = atob(b64);
|
||||||
|
const out = new Uint8Array(bin.length);
|
||||||
|
for (let i = 0; i < bin.length; i++) out[i] = bin.charCodeAt(i);
|
||||||
|
return out;
|
||||||
|
};
|
||||||
|
const bytesToB64 = (bytes) => {
|
||||||
|
let s = "";
|
||||||
|
for (const b of bytes) s += String.fromCharCode(b);
|
||||||
|
return btoa(s);
|
||||||
|
};
|
||||||
|
|
||||||
|
let signKeyPromise = null, decKeyPromise = null;
|
||||||
|
function rsaSignKey() {
|
||||||
|
if (!signKeyPromise) {
|
||||||
|
signKeyPromise = crypto.subtle.importKey(
|
||||||
|
"pkcs8", b64ToBytes(PRIVATE_KEY_DER_B64),
|
||||||
|
{ name: "RSA-PSS", hash: "SHA-1" }, false, ["sign"]
|
||||||
|
);
|
||||||
|
}
|
||||||
|
return signKeyPromise;
|
||||||
|
}
|
||||||
|
function rsaDecKey() {
|
||||||
|
if (!decKeyPromise) {
|
||||||
|
decKeyPromise = crypto.subtle.importKey(
|
||||||
|
"pkcs8", b64ToBytes(PRIVATE_KEY_DER_B64),
|
||||||
|
{ name: "RSA-OAEP", hash: "SHA-1" }, false, ["decrypt"]
|
||||||
|
);
|
||||||
|
}
|
||||||
|
return decKeyPromise;
|
||||||
|
}
|
||||||
|
|
||||||
|
/** Widevine device signature: RSA-PSS SHA-1, salt length = 20. */
|
||||||
|
export async function signDevice(data) {
|
||||||
|
const key = await rsaSignKey();
|
||||||
|
return new Uint8Array(await crypto.subtle.sign({ name: "RSA-PSS", saltLength: 20 }, key, data));
|
||||||
|
}
|
||||||
|
|
||||||
|
/** sessionKey = RSA-OAEP-SHA1 unwrap of SignedLicense.SessionKey (f4). */
|
||||||
|
async function unwrapSessionKey(wrapped) {
|
||||||
|
const key = await rsaDecKey();
|
||||||
|
const buf = await crypto.subtle.decrypt({ name: "RSA-OAEP" }, key, wrapped);
|
||||||
|
return new Uint8Array(buf);
|
||||||
|
}
|
||||||
|
|
||||||
|
/** AES single block encrypt via CBC with zero IV (== ECB for one block). */
|
||||||
|
async function aesEncBlock(keyBytes, block) {
|
||||||
|
const key = await crypto.subtle.importKey("raw", keyBytes, "AES-CBC", false, ["encrypt"]);
|
||||||
|
const buf = await crypto.subtle.encrypt(
|
||||||
|
{ name: "AES-CBC", iv: new Uint8Array(16) }, key, block
|
||||||
|
);
|
||||||
|
return new Uint8Array(buf.slice(0, 16));
|
||||||
|
}
|
||||||
|
|
||||||
|
/** AES-CMAC (NIST SP 800-38B) — faithful port of ofsaver's validated cmac.js. */
|
||||||
|
export async function aesCmac(keyBytes, data) {
|
||||||
|
const blockSize = 16;
|
||||||
|
const l = await aesEncBlock(keyBytes, new Uint8Array(16));
|
||||||
|
const RB = new Uint8Array(16);
|
||||||
|
RB[15] = 0x87; // Rb constant occupies the LAST byte of the block
|
||||||
|
let k1 = shiftLeft(l);
|
||||||
|
if (l[0] & 0x80) k1 = xor(k1, RB);
|
||||||
|
let k2 = shiftLeft(k1);
|
||||||
|
if (k1[0] & 0x80) k2 = xor(k2, RB);
|
||||||
|
|
||||||
|
const lastComplete = data.length > 0 && data.length % blockSize === 0;
|
||||||
|
// main loop processes only the complete blocks BEFORE the last block
|
||||||
|
const nonZeroLen = lastComplete ? data.length - blockSize : Math.floor(data.length / blockSize) * blockSize;
|
||||||
|
|
||||||
|
let x = new Uint8Array(16);
|
||||||
|
for (let i = 0; i < nonZeroLen; i += blockSize) {
|
||||||
|
// X_i = AES_K(X_{i-1} XOR M_i) — XOR happens before encryption
|
||||||
|
x = await aesEncBlock(keyBytes, xor(x, data.slice(i, i + blockSize)));
|
||||||
|
}
|
||||||
|
let last = data.slice(nonZeroLen);
|
||||||
|
if (last.length < blockSize || !lastComplete) {
|
||||||
|
const padded = new Uint8Array(16);
|
||||||
|
padded.set(last, 0);
|
||||||
|
padded[last.length] = 0x80;
|
||||||
|
last = xor(padded, k2);
|
||||||
|
} else {
|
||||||
|
last = xor(new Uint8Array(last), k1);
|
||||||
|
}
|
||||||
|
return aesEncBlock(keyBytes, xor(last, x));
|
||||||
|
}
|
||||||
|
|
||||||
|
function shiftLeft(b) {
|
||||||
|
const out = new Uint8Array(b.length);
|
||||||
|
let carry = 0;
|
||||||
|
for (let i = b.length - 1; i >= 0; i--) {
|
||||||
|
out[i] = ((b[i] << 1) | carry) & 0xff;
|
||||||
|
carry = b[i] >> 7;
|
||||||
|
}
|
||||||
|
return out;
|
||||||
|
}
|
||||||
|
|
||||||
|
function xor(a, b) {
|
||||||
|
const out = new Uint8Array(a.length);
|
||||||
|
for (let i = 0; i < a.length; i++) out[i] = a[i] ^ b[i];
|
||||||
|
return out;
|
||||||
|
}
|
||||||
|
|
||||||
|
/** key = AES-CBC-PKCS7(container.Key, Enc, container.Iv) */
|
||||||
|
async function aesCbcDecrypt(keyBytes, iv, data) {
|
||||||
|
const key = await crypto.subtle.importKey("raw", keyBytes, "AES-CBC", false, ["decrypt"]);
|
||||||
|
const buf = await crypto.subtle.decrypt({ name: "AES-CBC", iv }, key, data);
|
||||||
|
return new Uint8Array(buf);
|
||||||
|
}
|
||||||
|
|
||||||
|
async function hmacSha256(keyBytes, data) {
|
||||||
|
const key = await crypto.subtle.importKey("raw", keyBytes, { name: "HMAC", hash: "SHA-256" }, false, ["sign"]);
|
||||||
|
return new Uint8Array(await crypto.subtle.sign("HMAC", key, data));
|
||||||
|
}
|
||||||
|
|
||||||
|
// ---- challenge ---------------------------------------------------------
|
||||||
|
|
||||||
|
const CLIENT_INFO_B64 = null; // blob carries its own client_info
|
||||||
|
|
||||||
|
/** The classic blob IS the ClientIdentification (cert chain pre-signed by
|
||||||
|
* Google's L3 intermediate) — used verbatim, same as ofsaver. */
|
||||||
|
export function clientIdentification() {
|
||||||
|
return b64ToBytes(CLIENT_BLOB_B64);
|
||||||
|
}
|
||||||
|
|
||||||
|
/** ContentIdentification embedding the media's own widevine pssh payload. */
|
||||||
|
export function buildContentIdentification(psshPayload, requestId) {
|
||||||
|
return pbMsg(pbBytes(1, pbMsg(pbBytes(1, psshPayload), pbVarint(2, 1), pbString(3, requestId))));
|
||||||
|
}
|
||||||
|
|
||||||
|
/** SignedRequest for LICENSE_REQUEST (same layout as the verified ofsaver one). */
|
||||||
|
export async function buildChallenge(psshPayload) {
|
||||||
|
const requestId = [...crypto.getRandomValues(new Uint8Array(16))]
|
||||||
|
.map((b) => b.toString(16).padStart(2, "0")).join("").toUpperCase();
|
||||||
|
const licenseRequest = pbMsg(
|
||||||
|
pbBytes(1, clientIdentification()),
|
||||||
|
pbBytes(2, buildContentIdentification(psshPayload, requestId)),
|
||||||
|
pbVarint(3, 1), // NEW
|
||||||
|
pbVarint(4, Math.floor(Date.now() / 1000)),
|
||||||
|
pbVarint(6, 21),
|
||||||
|
pbVarint(7, new Uint32Array(crypto.getRandomValues(new Uint8Array(4)).buffer)[0]) // key_control_nonce
|
||||||
|
);
|
||||||
|
const sig = await signDevice(licenseRequest);
|
||||||
|
return pbMsg(pbVarint(1, 1), pbBytes(2, licenseRequest), pbBytes(3, sig));
|
||||||
|
}
|
||||||
|
|
||||||
|
// ---- license processing ------------------------------------------------
|
||||||
|
|
||||||
|
/** Full license processing (identical to ofsaver's verified processLicense). */
|
||||||
|
export async function processLicense(licenseBuf, challengeLicenseRequestBytes) {
|
||||||
|
const msg = new Uint8Array(get(licenseBuf, 2));
|
||||||
|
const sessionKeyWrapped = new Uint8Array(get(licenseBuf, 4));
|
||||||
|
const signature = new Uint8Array(get(licenseBuf, 3));
|
||||||
|
|
||||||
|
const sessionKey = await unwrapSessionKey(sessionKeyWrapped);
|
||||||
|
if (sessionKey.length !== 16) throw new Error(`session key ${sessionKey.length}B, expected 16`);
|
||||||
|
|
||||||
|
const encKeyBase = Uint8Array.from([
|
||||||
|
...new TextEncoder().encode("ENCRYPTION"), 0,
|
||||||
|
...challengeLicenseRequestBytes, 0, 0, 0, 0x80,
|
||||||
|
]);
|
||||||
|
const authKeyBase = Uint8Array.from([
|
||||||
|
...new TextEncoder().encode("AUTHENTICATION"), 0,
|
||||||
|
...challengeLicenseRequestBytes, 0, 0, 2, 0,
|
||||||
|
]);
|
||||||
|
const encKey = await aesCmac(sessionKey, Uint8Array.from([1, ...encKeyBase]));
|
||||||
|
const auth1 = Uint8Array.from([
|
||||||
|
...(await aesCmac(sessionKey, Uint8Array.from([1, ...authKeyBase]))),
|
||||||
|
...(await aesCmac(sessionKey, Uint8Array.from([2, ...authKeyBase]))),
|
||||||
|
]);
|
||||||
|
|
||||||
|
const hmac = await hmacSha256(auth1, msg);
|
||||||
|
const signatureOk = hmac.every((b, i) => b === signature[i]);
|
||||||
|
|
||||||
|
const keys = [];
|
||||||
|
for (const container of getAll(msg, 3)) {
|
||||||
|
const id = get(container, 1);
|
||||||
|
const iv = get(container, 2);
|
||||||
|
const wrapped = get(container, 3);
|
||||||
|
const type = Number(get(container, 4) ?? 0);
|
||||||
|
if (type === 1 /* SIGNING */ || !wrapped || !iv) continue;
|
||||||
|
const key = await aesCbcDecrypt(encKey, iv, wrapped);
|
||||||
|
keys.push({
|
||||||
|
kidHex: id ? [...new Uint8Array(id)].map((b) => b.toString(16).padStart(2, "0")).join("") : null,
|
||||||
|
keyHex: [...key].map((b) => b.toString(16).padStart(2, "0")).join(""),
|
||||||
|
type,
|
||||||
|
});
|
||||||
|
}
|
||||||
|
return { keys, sessionKeyHex: [...sessionKey].map((b) => b.toString(16).padStart(2, "0")).join(""), signatureOk };
|
||||||
|
}
|
||||||
|
|
||||||
|
// ---- MPD helpers -------------------------------------------------------
|
||||||
|
|
||||||
|
/** Extract the widevine PSSH payload from an MPD (systemId edef8ba9-…). */
|
||||||
|
export function widevinePsshFromMpd(mpdText) {
|
||||||
|
const re = /<cenc:pssh[^>]*>([^<]+)<\/cenc:pssh>/g;
|
||||||
|
let m;
|
||||||
|
while ((m = re.exec(mpdText))) {
|
||||||
|
const box = b64ToBytes(m[1]);
|
||||||
|
const hex = [...box.slice(12, 28)].map((b) => b.toString(16).padStart(2, "0")).join("");
|
||||||
|
if (hex.startsWith("edef8ba9")) {
|
||||||
|
const dataSize = (box[28] << 24) | (box[29] << 16) | (box[30] << 8) | box[31];
|
||||||
|
return box.slice(32, 32 + dataSize);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
/** KID from the MPD's cenc:default_KID. */
|
||||||
|
export function kidFromMpd(mpdText) {
|
||||||
|
const m = /cenc:default_KID="([0-9a-fA-F-]{36})"/.exec(mpdText);
|
||||||
|
return m ? m[1] : null;
|
||||||
|
}
|
||||||
50
ext/manifest.json
Normal file
50
ext/manifest.json
Normal file
@@ -0,0 +1,50 @@
|
|||||||
|
{
|
||||||
|
"manifest_version": 3,
|
||||||
|
"name": "ofsaver",
|
||||||
|
"description": "Personal OnlyFans downloader \u2014 DRM (widevine) + plain media",
|
||||||
|
"version": "0.5.14",
|
||||||
|
"minimum_chrome_version": "116",
|
||||||
|
"permissions": [
|
||||||
|
"offscreen",
|
||||||
|
"downloads",
|
||||||
|
"storage",
|
||||||
|
"cookies",
|
||||||
|
"scripting"
|
||||||
|
],
|
||||||
|
"host_permissions": [
|
||||||
|
"https://onlyfans.com/*",
|
||||||
|
"https://*.onlyfans.com/*"
|
||||||
|
],
|
||||||
|
"background": {
|
||||||
|
"service_worker": "background.js",
|
||||||
|
"type": "module"
|
||||||
|
},
|
||||||
|
"action": {
|
||||||
|
"default_title": "ofsaver"
|
||||||
|
},
|
||||||
|
"content_scripts": [
|
||||||
|
{
|
||||||
|
"matches": [
|
||||||
|
"https://onlyfans.com/*"
|
||||||
|
],
|
||||||
|
"js": [
|
||||||
|
"lib/main-hook.js"
|
||||||
|
],
|
||||||
|
"run_at": "document_start",
|
||||||
|
"world": "MAIN"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"matches": [
|
||||||
|
"https://onlyfans.com/*"
|
||||||
|
],
|
||||||
|
"js": [
|
||||||
|
"content.js"
|
||||||
|
],
|
||||||
|
"run_at": "document_idle"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"content_security_policy": {
|
||||||
|
"extension_pages": "script-src 'self' 'wasm-unsafe-eval'; object-src 'self'"
|
||||||
|
},
|
||||||
|
"options_page": "options.html"
|
||||||
|
}
|
||||||
7
ext/offscreen.html
Normal file
7
ext/offscreen.html
Normal file
@@ -0,0 +1,7 @@
|
|||||||
|
<!DOCTYPE html>
|
||||||
|
<html>
|
||||||
|
<head><meta charset="utf-8"></head>
|
||||||
|
<body>
|
||||||
|
<script type="module" src="offscreen.js"></script>
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
495
ext/offscreen.js
Normal file
495
ext/offscreen.js
Normal file
@@ -0,0 +1,495 @@
|
|||||||
|
// Offscreen document: hosts the live OF signer (needs eval) and runs the
|
||||||
|
// whole DRM pipeline. The SW relays messages here.
|
||||||
|
import { loadLiveSigner } from "./lib/signer.js";
|
||||||
|
import { buildPath } from "./lib/paths.js";
|
||||||
|
import {
|
||||||
|
holdsDir, streamIntoHold, holdFileUrl, removeHolds,
|
||||||
|
decryptTrackToOpfs, pushTrackMoofs, writeMuxedFile, drmCapture,
|
||||||
|
} from "./lib/holds.js";
|
||||||
|
|
||||||
|
function toUnixSeconds(d) {
|
||||||
|
if (d == null) return null;
|
||||||
|
if (typeof d === "number") return d > 1e12 ? Math.floor(d / 1000) : Math.floor(d);
|
||||||
|
const parsed = Date.parse(d);
|
||||||
|
return Number.isNaN(parsed) ? null : Math.floor(parsed / 1000);
|
||||||
|
}
|
||||||
|
import {
|
||||||
|
buildChallenge, processLicense, widevinePsshFromMpd, kidFromMpd,
|
||||||
|
} from "./lib/wv.js";
|
||||||
|
import { tryParse } from "./lib/pb.js";
|
||||||
|
|
||||||
|
const log = [];
|
||||||
|
const say = (m) => {
|
||||||
|
log.push(m);
|
||||||
|
if (log.length > 120) log.splice(0, log.length - 120); // cap: bundles log a lot
|
||||||
|
console.log("[ofsaver]", m);
|
||||||
|
};
|
||||||
|
|
||||||
|
const b64ToBytes = (b64) => Uint8Array.from(atob(b64), (c) => c.charCodeAt(0));
|
||||||
|
const bytesToB64 = (bytes) => {
|
||||||
|
let s = "";
|
||||||
|
for (const b of bytes) s += String.fromCharCode(b);
|
||||||
|
return btoa(s);
|
||||||
|
};
|
||||||
|
|
||||||
|
let signerPromise = null;
|
||||||
|
function getSigner() {
|
||||||
|
if (!signerPromise) {
|
||||||
|
signerPromise = loadLiveSigner(say).catch((err) => {
|
||||||
|
signerPromise = null;
|
||||||
|
throw err;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
return signerPromise;
|
||||||
|
}
|
||||||
|
|
||||||
|
/** The logged-in account id from the browser cookie jar. */
|
||||||
|
async function authUserId() {
|
||||||
|
try {
|
||||||
|
const c = await chrome.cookies.get({ url: "https://onlyfans.com", name: "auth_id" });
|
||||||
|
return c?.value ?? "0";
|
||||||
|
} catch { return "0"; }
|
||||||
|
}
|
||||||
|
|
||||||
|
/** Signed headers for an OF API call (same shape as ofsaver's OfApi). */
|
||||||
|
let cachedUserId = null;
|
||||||
|
function setUserId(id) { if (id) cachedUserId = String(id); }
|
||||||
|
|
||||||
|
let activeSigner = null;
|
||||||
|
async function signedHeaders(pathWithQuery, method = "GET", hasBody = false) {
|
||||||
|
const signer = await getSigner();
|
||||||
|
activeSigner = signer;
|
||||||
|
const userId = cachedUserId ?? "0";
|
||||||
|
const { sign, time } = signer.sign(pathWithQuery, userId);
|
||||||
|
const headers = {
|
||||||
|
accept: "application/json, text/plain, */*",
|
||||||
|
"app-token": signer.appToken,
|
||||||
|
"user-id": userId,
|
||||||
|
referer: "https://onlyfans.com/",
|
||||||
|
"user-agent": navigator.userAgent,
|
||||||
|
sign,
|
||||||
|
time,
|
||||||
|
"x-of-rev": signer.revision,
|
||||||
|
};
|
||||||
|
if (hasBody) headers["content-type"] = "application/json";
|
||||||
|
return headers;
|
||||||
|
}
|
||||||
|
|
||||||
|
const CANON = {
|
||||||
|
"CloudFront-Policy": "Policy",
|
||||||
|
"CloudFront-Signature": "Signature",
|
||||||
|
"CloudFront-Key-Pair-Id": "Key-Pair-Id",
|
||||||
|
};
|
||||||
|
|
||||||
|
function signedCdnUrl(rawUrl, sig) {
|
||||||
|
const url = new URL(rawUrl);
|
||||||
|
for (const [k, v] of Object.entries(sig ?? {})) {
|
||||||
|
const name = CANON[k] ?? k;
|
||||||
|
url.searchParams.delete(k);
|
||||||
|
url.searchParams.set(name, v);
|
||||||
|
}
|
||||||
|
return url.toString();
|
||||||
|
}
|
||||||
|
|
||||||
|
/** Plain-media download URL from a crawled media object. */
|
||||||
|
function plainDownload(mediaItem) {
|
||||||
|
const files = mediaItem.files ?? {};
|
||||||
|
const type = mediaItem.type;
|
||||||
|
if (type === "video" || type === "audio") {
|
||||||
|
const url = files.source?.url ?? files.full?.url ?? null;
|
||||||
|
return url ? { url, ext: "mp4" } : null;
|
||||||
|
}
|
||||||
|
if (type === "photo" || type === "gif") {
|
||||||
|
const url = files.full?.url ?? files.preview?.url ?? null;
|
||||||
|
return url ? { url, ext: type === "gif" ? "gif" : "jpg" } : null;
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
/** Creator bundle: resolve, crawl timeline, license DRM videos, list downloads. */
|
||||||
|
async function runBundle(who, max = 200) {
|
||||||
|
const t0 = Date.now();
|
||||||
|
const uPath = `/api2/v2/users/${encodeURIComponent(String(who).replace(/^@/, ""))}`;
|
||||||
|
let headers;
|
||||||
|
try { headers = await signedHeaders(uPath); }
|
||||||
|
catch (e) { headers = { referer: "https://onlyfans.com/" }; }
|
||||||
|
const uRes = await fetch(`https://onlyfans.com${uPath}`, { credentials: "include", headers });
|
||||||
|
if (!uRes.ok) throw new Error(`user HTTP ${uRes.status}`);
|
||||||
|
const user = await uRes.json();
|
||||||
|
say(`bundle: ${user.username} (${user.id})`);
|
||||||
|
|
||||||
|
const mediaItems = []; // {media, postId, responseType}
|
||||||
|
let cursor = "";
|
||||||
|
for (let page = 0; page < 40 && mediaItems.length < max; page++) {
|
||||||
|
let path = `/api2/v2/users/${user.id}/posts/medias?limit=50&order=publish_date_desc&skip_users=all&format=infinite&counters=1`;
|
||||||
|
if (cursor) path += `&beforePublishTime=${encodeURIComponent(cursor)}`;
|
||||||
|
let h;
|
||||||
|
try { h = await signedHeaders(path); } catch { h = { referer: "https://onlyfans.com/" }; }
|
||||||
|
const res = await fetch(`https://onlyfans.com${path}`, { credentials: "include", headers: h });
|
||||||
|
if (!res.ok) throw new Error(`timeline HTTP ${res.status}`);
|
||||||
|
const data = await res.json();
|
||||||
|
const list = Array.isArray(data) ? data : data?.list ?? [];
|
||||||
|
if (!list.length) break;
|
||||||
|
for (const post of list) {
|
||||||
|
for (const m of post.media ?? []) {
|
||||||
|
mediaItems.push({ media: m, postId: post.id, responseType: post.responseType });
|
||||||
|
}
|
||||||
|
}
|
||||||
|
say(` page ${page + 1}: +${list.length} posts (total media ${mediaItems.length})`);
|
||||||
|
if (data?.hasMore !== true) break;
|
||||||
|
cursor = data?.tailMarker ?? list[list.length - 1]?.postedAtPrecise ?? "";
|
||||||
|
if (!cursor) break;
|
||||||
|
await new Promise((r) => setTimeout(r, 400 + Math.floor(Math.random() * 400)));
|
||||||
|
}
|
||||||
|
|
||||||
|
const downloads = [];
|
||||||
|
const keys = [];
|
||||||
|
let licensed = 0;
|
||||||
|
for (const item of mediaItems.slice(0, max)) {
|
||||||
|
const m = item.media;
|
||||||
|
if (m.files?.drm?.manifest) {
|
||||||
|
try {
|
||||||
|
const r = await runDrm({
|
||||||
|
id: m.id,
|
||||||
|
postId: item.postId,
|
||||||
|
responseType: item.responseType === "message" ? "message" : "post",
|
||||||
|
drm: m.files.drm,
|
||||||
|
});
|
||||||
|
keys.push({ mediaId: m.id, kid: r.summary.kid, key: r.summary.key });
|
||||||
|
savedIds.push(m.id);
|
||||||
|
licensed++;
|
||||||
|
for (const rep of r.summary.reps) {
|
||||||
|
downloads.push({
|
||||||
|
url: rep.url,
|
||||||
|
filename: buildPath({
|
||||||
|
scheme: msg.naming?.bulkScheme ?? "creator-section-type",
|
||||||
|
bulk: true,
|
||||||
|
creator: user.username,
|
||||||
|
type: m.type,
|
||||||
|
section: "Timeline",
|
||||||
|
date: m.createdAt ?? item.post?.postedAt ?? null,
|
||||||
|
timestamp: toUnixSeconds(m.createdAt ?? item.post?.postedAt),
|
||||||
|
mediaId: m.id,
|
||||||
|
postId: item.postId,
|
||||||
|
quality: "source", // bundle takes the best rep = original
|
||||||
|
ext: "mp4",
|
||||||
|
template: msg.naming?.nameTemplate,
|
||||||
|
}),
|
||||||
|
});
|
||||||
|
}
|
||||||
|
await new Promise((r2) => setTimeout(r2, 300));
|
||||||
|
} catch (e) {
|
||||||
|
say(` media ${m.id}: ${e.message}`);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
const d = plainDownload(m);
|
||||||
|
if (d && m.canView !== false) {
|
||||||
|
savedIds.push(m.id);
|
||||||
|
downloads.push({
|
||||||
|
url: d.url,
|
||||||
|
filename: buildPath({
|
||||||
|
scheme: msg.naming?.bulkScheme ?? "creator-section-type",
|
||||||
|
bulk: true,
|
||||||
|
creator: user.username,
|
||||||
|
type: m.type,
|
||||||
|
section: "Timeline",
|
||||||
|
date: m.createdAt ?? item.post?.postedAt ?? null,
|
||||||
|
timestamp: toUnixSeconds(m.createdAt ?? item.post?.postedAt),
|
||||||
|
mediaId: m.id,
|
||||||
|
postId: item.postId,
|
||||||
|
ext: d.ext,
|
||||||
|
template: msg.naming?.nameTemplate,
|
||||||
|
}),
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
say(`bundle done: ${downloads.length} downloads, ${licensed} licensed (${Date.now() - t0}ms)`);
|
||||||
|
return { ok: true, summary: { count: downloads.length, downloads, keys, savedIds, user: user.username, ms: Date.now() - t0 } };
|
||||||
|
}
|
||||||
|
|
||||||
|
/** Phase 1: fetch MPD, build challenge + signed headers. */
|
||||||
|
async function prepareLicense(media) {
|
||||||
|
const { manifest, signature } = media.drm;
|
||||||
|
const mpdUrl = signedCdnUrl(manifest.dash, signature?.dash);
|
||||||
|
say(`MPD: ${mpdUrl.slice(0, 100)}`);
|
||||||
|
const mpdRes = await fetch(mpdUrl, {
|
||||||
|
credentials: "include",
|
||||||
|
headers: { referer: "https://onlyfans.com/", origin: "https://onlyfans.com" },
|
||||||
|
});
|
||||||
|
if (!mpdRes.ok) {
|
||||||
|
const body = (await mpdRes.text().catch(() => "")).replace(/\s+/g, " ").slice(0, 110);
|
||||||
|
throw new Error(`MPD HTTP ${mpdRes.status} ${mpdUrl.split("?")[0].slice(-40)} :: ${body}`);
|
||||||
|
}
|
||||||
|
const mpd = await mpdRes.text();
|
||||||
|
say(`MPD ${mpd.length}B`);
|
||||||
|
|
||||||
|
const psshPayload = widevinePsshFromMpd(mpd);
|
||||||
|
const kid = kidFromMpd(mpd);
|
||||||
|
if (!psshPayload) throw new Error("no widevine pssh in MPD");
|
||||||
|
say(`KID ${kid} · pssh ${psshPayload.length}B`);
|
||||||
|
|
||||||
|
const challenge = await buildChallenge(psshPayload);
|
||||||
|
const licenseRequest = new Uint8Array(tryParse(challenge).find(([f]) => f === 2)[2]);
|
||||||
|
|
||||||
|
const responseType = media.responseType === "message" ? "message" : "post";
|
||||||
|
const licensePath =
|
||||||
|
`/api2/v2/users/media/${media.id}/drm/${responseType}/${media.postId}?type=widevine`;
|
||||||
|
const headers = await signedHeaders(licensePath, "POST", true);
|
||||||
|
headers["content-type"] = "application/octet-stream";
|
||||||
|
// match the captured relay exactly: accept: application/json,
|
||||||
|
// x-bc header (fp cookie), no user-agent/referer (the page adds its own)
|
||||||
|
headers["accept"] = "application/json";
|
||||||
|
headers["x-bc"] = media.xBc ?? headers["x-bc"] ?? "";
|
||||||
|
delete headers["user-agent"];
|
||||||
|
|
||||||
|
say(`challenge ${challenge.length}B ready — relaying through page`);
|
||||||
|
return {
|
||||||
|
ok: true,
|
||||||
|
phase: "prepare",
|
||||||
|
diag: { uid: cachedUserId ?? "none", bcLen: String(media.xBc ?? "").length, rev: activeSigner?.revision ?? "?" },
|
||||||
|
mpd, kid, mpdUrl,
|
||||||
|
licensePath,
|
||||||
|
challengeB64: bytesToB64(challenge),
|
||||||
|
licenseRequestB64: bytesToB64(licenseRequest),
|
||||||
|
headers,
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
/** Phase 2: process the license the page fetched for us. */
|
||||||
|
async function finishLicense(msg) {
|
||||||
|
const licenseBuf = b64ToBytes(msg.licenseB64);
|
||||||
|
const licenseRequest = b64ToBytes(msg.licenseRequestB64);
|
||||||
|
const { keys, signatureOk, sessionKeyHex } = await processLicense(licenseBuf, licenseRequest);
|
||||||
|
say(`license HMAC ok: ${signatureOk}; keys: ${keys.length}`);
|
||||||
|
const contentKey = keys.find((k) => k.type === 2);
|
||||||
|
if (!contentKey) throw new Error("no content key in license");
|
||||||
|
|
||||||
|
const mpd = msg.mpd;
|
||||||
|
const mpdUrl = msg.mpdUrl;
|
||||||
|
const reps = [];
|
||||||
|
const sets = [...mpd.matchAll(/<AdaptationSet[\s\S]*?<\/AdaptationSet>/g)];
|
||||||
|
for (const set of sets) {
|
||||||
|
const kind = /video\/mp4/.test(set[0]) ? "video" : "audio";
|
||||||
|
let best = null;
|
||||||
|
for (const m of set[0].matchAll(/<Representation[^>]*bandwidth="(\d+)"[\s\S]*?<\/Representation>/g)) {
|
||||||
|
const bw = Number(m[1]);
|
||||||
|
if (!best || bw > best.bw) best = { bw, body: m[0] };
|
||||||
|
}
|
||||||
|
if (!best) continue;
|
||||||
|
const file = /<BaseURL>([^<]+)<\/BaseURL>/.exec(best.body)?.[1];
|
||||||
|
if (file) {
|
||||||
|
const dir = mpdUrl.slice(0, mpdUrl.lastIndexOf("/") + 1);
|
||||||
|
// the CloudFront signature lives in the MPD's query — carry it onto
|
||||||
|
// each representation file (they're under the same signed wildcard)
|
||||||
|
const query = mpdUrl.slice(mpdUrl.indexOf("?"));
|
||||||
|
const rHeight = /\sheight="(\d+)"/.exec(best.body)?.[1] ?? null;
|
||||||
|
const rWidth = /\swidth="(\d+)"/.exec(best.body)?.[1] ?? null;
|
||||||
|
reps.push({ kind, bandwidth: best.bw, height: rHeight ? Number(rHeight) : null, width: rWidth ? Number(rWidth) : null, url: dir + file + query });
|
||||||
|
}
|
||||||
|
}
|
||||||
|
say(`reps: ${reps.map((r) => r.kind).join("+")}`);
|
||||||
|
return {
|
||||||
|
ok: true,
|
||||||
|
summary: {
|
||||||
|
kid: contentKey.kidHex,
|
||||||
|
key: contentKey.keyHex,
|
||||||
|
sessionKeyHex,
|
||||||
|
signatureOk,
|
||||||
|
mpdUrl,
|
||||||
|
reps,
|
||||||
|
},
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
chrome.runtime.onMessage.addListener((msg, _sender, sendResponse) => {
|
||||||
|
if (msg.op === "lastLog") {
|
||||||
|
// synchronous probe: names the stage an item hung on (or proves the doc's
|
||||||
|
// event loop is blocked, when even this never answers)
|
||||||
|
sendResponse({ ok: true, line: log[log.length - 1] ?? "" });
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (msg.op === "prepareLicense") {
|
||||||
|
setUserId(msg.userId);
|
||||||
|
prepareLicense(msg.media)
|
||||||
|
.then((r) => sendResponse({ ...r, log }))
|
||||||
|
.catch((err) => sendResponse({ ok: false, error: String(err.message ?? err), log }));
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
if (msg.op === "finishLicense") {
|
||||||
|
finishLicense(msg)
|
||||||
|
.then((r) => sendResponse({ ...r, log }))
|
||||||
|
.catch((err) => sendResponse({ ok: false, error: String(err.message ?? err), log }));
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
if (msg.op === "fetchAndHold") {
|
||||||
|
// fetch files in the offscreen (extension origin + host permissions work
|
||||||
|
// here), streaming each straight into OPFS so even multi-GB files never
|
||||||
|
// sit in RAM. Returns blob URLs (disk-backed) + hold ids.
|
||||||
|
(async () => {
|
||||||
|
try {
|
||||||
|
const dir = await holdsDir();
|
||||||
|
const held = [];
|
||||||
|
const mimeFor = (fn) => {
|
||||||
|
const ext2 = (fn.split(".").pop() ?? "").toLowerCase();
|
||||||
|
return { jpg: "image/jpeg", jpeg: "image/jpeg", png: "image/png", gif: "image/gif", mp4: "video/mp4", webm: "video/webm" }[ext2] ?? "application/octet-stream";
|
||||||
|
};
|
||||||
|
let total = 0, got = 0, last = 0;
|
||||||
|
const report = () => {
|
||||||
|
if (!msg.tabId || !total) return;
|
||||||
|
const now = Date.now();
|
||||||
|
if (now - last < 250 && got < total) return;
|
||||||
|
last = now;
|
||||||
|
chrome.runtime.sendMessage({ op: "dlProgress", tabId: msg.tabId, id: msg.dlId, pct: Math.min(80, Math.round((got / total) * 80)) }).catch(() => {});
|
||||||
|
};
|
||||||
|
for (const f of msg.files ?? []) {
|
||||||
|
const res = await fetch(f.url, { credentials: "include", headers: { referer: "https://onlyfans.com/" } });
|
||||||
|
if (!res.ok) { held.push({ filename: f.filename, ok: false, error: "HTTP " + res.status }); continue; }
|
||||||
|
total += Number(res.headers.get("content-length") || 0);
|
||||||
|
const { id, size } = await streamIntoHold(dir, res, (n) => { got += n; report(); });
|
||||||
|
held.push({ id, filename: f.filename, ok: true, size, blobUrl: await holdFileUrl(dir, id, mimeFor(f.filename)) });
|
||||||
|
}
|
||||||
|
sendResponse({ ok: true, held });
|
||||||
|
} catch (e) {
|
||||||
|
sendResponse({ ok: false, error: String(e.message ?? e) });
|
||||||
|
}
|
||||||
|
})();
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
if (msg.op === "refreshDrm") {
|
||||||
|
// DRM manifest signatures are short-lived — re-fetch the owning post
|
||||||
|
// with a signed request and return the media's fresh drm object
|
||||||
|
setUserId(msg.userId);
|
||||||
|
(async () => {
|
||||||
|
try {
|
||||||
|
const path = `/api2/v2/post/${msg.postId}?userId=${cachedUserId ?? "0"}`;
|
||||||
|
const headers = await signedHeaders(path);
|
||||||
|
const res = await fetch(`https://onlyfans.com${path}`, { credentials: "include", headers });
|
||||||
|
if (!res.ok) { sendResponse({ ok: false, error: "HTTP " + res.status }); return; }
|
||||||
|
const data = await res.json();
|
||||||
|
let fresh = null;
|
||||||
|
const walk = (x) => {
|
||||||
|
if (!x || typeof x !== "object" || fresh) return;
|
||||||
|
if (Array.isArray(x)) { for (const v of x) walk(v); return; }
|
||||||
|
if (String(x.id) === String(msg.mediaId) && x.files?.drm) { fresh = x; return; }
|
||||||
|
for (const k of Object.keys(x)) walk(x[k]);
|
||||||
|
};
|
||||||
|
walk(data);
|
||||||
|
sendResponse({ ok: true, media: fresh });
|
||||||
|
} catch (e) {
|
||||||
|
sendResponse({ ok: false, error: String(e.message ?? e) });
|
||||||
|
}
|
||||||
|
})();
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
if (msg.op === "getCapture") {
|
||||||
|
const jsonB64 = globalThis.__ofsaverCapB64 ?? null;
|
||||||
|
globalThis.__ofsaverCapB64 = null;
|
||||||
|
sendResponse({ ok: true, jsonB64 });
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (msg.op === "revokeUrls") {
|
||||||
|
for (const u of msg.urls ?? []) { try { URL.revokeObjectURL(u); } catch {} }
|
||||||
|
sendResponse({ ok: true });
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (msg.op === "dropHeld") {
|
||||||
|
// remove held/decrypted/muxed files from OPFS once a download finished
|
||||||
|
(async () => {
|
||||||
|
try {
|
||||||
|
await removeHolds(await holdsDir(), msg.ids ?? []);
|
||||||
|
sendResponse({ ok: true });
|
||||||
|
} catch { sendResponse({ ok: true }); } // best effort
|
||||||
|
})();
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
if (msg.op === "decryptAndMux") {
|
||||||
|
// Stream the DRM flow: tracks stream from OPFS holds, decrypt fragment
|
||||||
|
// by fragment into OPFS, and the muxed mp4 is assembled on disk — RAM
|
||||||
|
// stays flat no matter the file size.
|
||||||
|
(async () => {
|
||||||
|
let dir = null;
|
||||||
|
const decVideo = "d_" + String(msg.videoId ?? "").replace(/^h_/, "");
|
||||||
|
const decAudio = msg.audioId ? "d_" + String(msg.audioId).replace(/^h_/, "") : null;
|
||||||
|
const finalName = "m_" + Math.random().toString(36).slice(2);
|
||||||
|
try {
|
||||||
|
const { initDrmWasm, decryptAndStripFragment, decryptAndStripFragmentCbcs,
|
||||||
|
stripInit, tencMarker, tencConstantIv, tencCryptPattern, MuxPlanner } =
|
||||||
|
await import(chrome.runtime.getURL("lib/owndrm.js"));
|
||||||
|
await initDrmWasm();
|
||||||
|
const keyBytes = b64ToBytes(msg.keyB64);
|
||||||
|
dir = await holdsDir();
|
||||||
|
const fns = { stripInit, tencMarker, tencCryptPattern, tencConstantIv, decryptAndStripFragment, decryptAndStripFragmentCbcs };
|
||||||
|
let last = 0;
|
||||||
|
const report = (pct) => {
|
||||||
|
if (!msg.tabId) return;
|
||||||
|
const now = Date.now();
|
||||||
|
if (now - last < 250 && pct < 99) return;
|
||||||
|
last = now;
|
||||||
|
chrome.runtime.sendMessage({ op: "dlProgress", tabId: msg.tabId, id: msg.dlId, pct }).catch(() => {});
|
||||||
|
};
|
||||||
|
const { header: vHeader } = await decryptTrackToOpfs(dir, msg.videoId, decVideo, keyBytes, fns, "video", (done, tot) => report(80 + Math.round((done / tot) * 12)));
|
||||||
|
let aHeader = null;
|
||||||
|
if (msg.audioId) aHeader = (await decryptTrackToOpfs(dir, msg.audioId, decAudio, keyBytes, fns, "audio", (done, tot) => report(92 + Math.round((done / tot) * 6)))).header;
|
||||||
|
say(`decrypted tracks: video ok${msg.audioId ? ", audio ok" : ""}`);
|
||||||
|
const planner = new MuxPlanner(vHeader, aHeader ?? undefined);
|
||||||
|
await pushTrackMoofs(dir, decVideo, planner, true);
|
||||||
|
if (msg.audioId) await pushTrackMoofs(dir, decAudio, planner, false);
|
||||||
|
const muxed = planner.finish();
|
||||||
|
const vFile = await (await dir.getFileHandle(decVideo)).getFile();
|
||||||
|
const aFile = decAudio ? await (await dir.getFileHandle(decAudio)).getFile() : null;
|
||||||
|
report(99);
|
||||||
|
const out = await writeMuxedFile(dir, finalName, muxed, vFile, aFile);
|
||||||
|
report(100);
|
||||||
|
say(`muxed final: ${out.size}B`);
|
||||||
|
await removeHolds(dir, [decVideo, ...(decAudio ? [decAudio] : [])]);
|
||||||
|
let capB64 = null;
|
||||||
|
if (!drmCapture.sent && drmCapture.frags.length) {
|
||||||
|
drmCapture.headers.mux = drmCapture.mux ? drmCapture.mux.header : null;
|
||||||
|
drmCapture.layout = drmCapture.mux ? drmCapture.mux.layout : null;
|
||||||
|
capB64 = btoa(JSON.stringify(drmCapture));
|
||||||
|
drmCapture.sent = true;
|
||||||
|
}
|
||||||
|
if (capB64) globalThis.__ofsaverCapB64 = capB64;
|
||||||
|
sendResponse({ ok: true, blobUrl: out.blobUrl, size: out.size, files: [finalName], capB64 });
|
||||||
|
} catch (e) {
|
||||||
|
if (dir) await removeHolds(dir, [decVideo, decAudio, finalName].filter(Boolean));
|
||||||
|
sendResponse({ ok: false, error: String(e.message ?? e), log });
|
||||||
|
}
|
||||||
|
})();
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
if (msg.op === "fetchPostMedia") {
|
||||||
|
// signed GET of a post's full media list (bundle backfill)
|
||||||
|
(async () => {
|
||||||
|
try {
|
||||||
|
const { postId, creatorId, username } = msg;
|
||||||
|
let id = creatorId ?? null;
|
||||||
|
if (!id && username) {
|
||||||
|
const uPath = `/api2/v2/users/${encodeURIComponent(username)}`;
|
||||||
|
let h;
|
||||||
|
try { h = await signedHeaders(uPath); } catch { h = { referer: "https://onlyfans.com/" }; }
|
||||||
|
const uRes = await fetch(`https://onlyfans.com${uPath}`, { credentials: "include", headers: h });
|
||||||
|
if (uRes.ok) id = (await uRes.json())?.id ?? null;
|
||||||
|
}
|
||||||
|
if (!id) { sendResponse({ ok: false, error: "no creator id" }); return; }
|
||||||
|
const path = `/api2/v2/post/${postId}?userId=${id}`;
|
||||||
|
let h2;
|
||||||
|
try { h2 = await signedHeaders(path); } catch { h2 = { referer: "https://onlyfans.com/" }; }
|
||||||
|
const res = await fetch(`https://onlyfans.com${path}`, { credentials: "include", headers: h2 });
|
||||||
|
if (!res.ok) { sendResponse({ ok: false, error: "post HTTP " + res.status }); return; }
|
||||||
|
sendResponse({ ok: true, data: await res.json() });
|
||||||
|
} catch (e) {
|
||||||
|
sendResponse({ ok: false, error: String(e.message ?? e) });
|
||||||
|
}
|
||||||
|
})();
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
if (msg.op === "bundle") {
|
||||||
|
setUserId(msg.userId);
|
||||||
|
runBundle(msg.who, msg.max)
|
||||||
|
.then((r) => sendResponse({ ...r, log }))
|
||||||
|
.catch((err) => sendResponse({ ok: false, error: String(err.message ?? err), log }));
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
});
|
||||||
218
ext/options.html
Normal file
218
ext/options.html
Normal file
@@ -0,0 +1,218 @@
|
|||||||
|
<!DOCTYPE html>
|
||||||
|
<html lang="en">
|
||||||
|
<head>
|
||||||
|
<meta charset="utf-8">
|
||||||
|
<title>ofsaver settings</title>
|
||||||
|
<style>
|
||||||
|
:root {
|
||||||
|
color-scheme: light dark;
|
||||||
|
--bg: #fafafa;
|
||||||
|
--surface: #ffffff;
|
||||||
|
--sunken: #f4f4f5;
|
||||||
|
--text: #18181b;
|
||||||
|
--text-2: #52525b;
|
||||||
|
--text-3: #71717a;
|
||||||
|
--line: rgba(24, 24, 27, .09);
|
||||||
|
--line-strong: rgba(24, 24, 27, .16);
|
||||||
|
--accent: #d63a3f;
|
||||||
|
--accent-hover: #c2333a;
|
||||||
|
--accent-ink: #c2333a;
|
||||||
|
--ok: #2f7d52;
|
||||||
|
--ring: rgba(214, 58, 63, .35);
|
||||||
|
--mono: ui-monospace, "SF Mono", Menlo, monospace;
|
||||||
|
--ease: cubic-bezier(.2, 0, 0, 1);
|
||||||
|
}
|
||||||
|
@media (prefers-color-scheme: dark) {
|
||||||
|
:root {
|
||||||
|
--bg: #141416;
|
||||||
|
--surface: #1c1c1f;
|
||||||
|
--sunken: #19191c;
|
||||||
|
--text: #ededef;
|
||||||
|
--text-2: #a1a1aa;
|
||||||
|
--text-3: #7c7c85;
|
||||||
|
--line: rgba(237, 237, 239, .08);
|
||||||
|
--line-strong: rgba(237, 237, 239, .16);
|
||||||
|
--accent-ink: #f0686c;
|
||||||
|
--ok: #5fb585;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
* { box-sizing: border-box; }
|
||||||
|
body {
|
||||||
|
margin: 0;
|
||||||
|
padding: 48px 24px 96px;
|
||||||
|
background: var(--bg);
|
||||||
|
color: var(--text);
|
||||||
|
font: 14px/1.5 -apple-system, system-ui, sans-serif;
|
||||||
|
-webkit-font-smoothing: antialiased;
|
||||||
|
}
|
||||||
|
.wrap { max-width: 760px; margin: 0 auto; }
|
||||||
|
svg.i { width: 16px; height: 16px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.5; stroke-linecap: round; stroke-linejoin: round; }
|
||||||
|
|
||||||
|
header { margin-bottom: 40px; }
|
||||||
|
.brand { font: 500 13px var(--mono); color: var(--text-3); margin-bottom: 8px; }
|
||||||
|
h1 { font-size: 24px; line-height: 32px; font-weight: 500; margin: 0 0 4px; letter-spacing: -.01em; }
|
||||||
|
.sub { color: var(--text-2); margin: 0; }
|
||||||
|
|
||||||
|
section { padding: 32px 0; border-top: 1px solid var(--line); }
|
||||||
|
h2 { font-size: 15px; font-weight: 500; margin: 0; }
|
||||||
|
.section-sub { color: var(--text-2); font-size: 13px; margin: 4px 0 16px; }
|
||||||
|
|
||||||
|
.cards { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
|
||||||
|
.card {
|
||||||
|
position: relative;
|
||||||
|
display: grid;
|
||||||
|
grid-template-columns: 16px 1fr;
|
||||||
|
column-gap: 12px;
|
||||||
|
padding: 16px;
|
||||||
|
background: var(--surface);
|
||||||
|
border: 1px solid var(--line);
|
||||||
|
border-radius: 12px;
|
||||||
|
cursor: pointer;
|
||||||
|
text-align: left;
|
||||||
|
font: inherit;
|
||||||
|
color: inherit;
|
||||||
|
transition: border-color .15s var(--ease), background-color .15s var(--ease);
|
||||||
|
}
|
||||||
|
.card:hover { border-color: var(--line-strong); }
|
||||||
|
.card:focus-visible { outline: 2px solid var(--ring); outline-offset: 2px; }
|
||||||
|
.card.selected { border-color: var(--accent); box-shadow: inset 0 0 0 1px var(--accent); }
|
||||||
|
.radio {
|
||||||
|
width: 16px; height: 16px; margin-top: 2px;
|
||||||
|
border-radius: 8px;
|
||||||
|
border: 1px solid var(--line-strong);
|
||||||
|
transition: border-color .15s var(--ease), border-width .15s var(--ease);
|
||||||
|
}
|
||||||
|
.card.selected .radio { border: 5px solid var(--accent); }
|
||||||
|
.card .t { font-size: 14px; font-weight: 500; display: flex; align-items: baseline; gap: 8px; }
|
||||||
|
.card .rec { font-size: 12px; font-weight: 400; color: var(--text-3); }
|
||||||
|
.card .d { grid-column: 2; font-size: 13px; color: var(--text-2); margin-top: 2px; }
|
||||||
|
.card .path {
|
||||||
|
grid-column: 2;
|
||||||
|
margin-top: 12px;
|
||||||
|
font: 12px/16px var(--mono);
|
||||||
|
color: var(--text-3);
|
||||||
|
white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
|
||||||
|
}
|
||||||
|
.card .path .sep { opacity: .5; padding: 0 2px; }
|
||||||
|
|
||||||
|
.preview {
|
||||||
|
margin-top: 12px;
|
||||||
|
padding: 12px 16px;
|
||||||
|
background: var(--sunken);
|
||||||
|
border: 1px solid var(--line);
|
||||||
|
border-radius: 12px;
|
||||||
|
}
|
||||||
|
.preview .label { font-size: 12px; color: var(--text-3); margin-bottom: 8px; }
|
||||||
|
.crumbs { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 2px; font: 12px/20px var(--mono); color: var(--text-2); }
|
||||||
|
.crumb { display: inline-flex; align-items: center; gap: 6px; min-width: 0; }
|
||||||
|
.crumb svg.i { width: 14px; height: 14px; color: var(--text-3); }
|
||||||
|
.crumb.file { color: var(--text); word-break: break-all; }
|
||||||
|
.crumbs .sep { color: var(--text-3); opacity: .6; padding: 0 4px; }
|
||||||
|
|
||||||
|
input[type="text"] {
|
||||||
|
width: 100%;
|
||||||
|
height: 40px;
|
||||||
|
padding: 0 12px;
|
||||||
|
background: var(--surface);
|
||||||
|
color: var(--text);
|
||||||
|
border: 1px solid var(--line-strong);
|
||||||
|
border-radius: 8px;
|
||||||
|
font: 13px var(--mono);
|
||||||
|
transition: border-color .15s var(--ease), box-shadow .15s var(--ease);
|
||||||
|
}
|
||||||
|
input[type="text"]:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--ring); }
|
||||||
|
|
||||||
|
.tokens { display: flex; flex-wrap: wrap; align-items: center; gap: 4px; margin-top: 12px; }
|
||||||
|
.tokens .label { font-size: 12px; color: var(--text-3); margin-right: 4px; }
|
||||||
|
.tokens button {
|
||||||
|
height: 24px;
|
||||||
|
padding: 0 8px;
|
||||||
|
border: 1px solid var(--line);
|
||||||
|
border-radius: 6px;
|
||||||
|
background: var(--surface);
|
||||||
|
color: var(--text-2);
|
||||||
|
font: 12px var(--mono);
|
||||||
|
cursor: pointer;
|
||||||
|
transition: border-color .15s var(--ease), color .15s var(--ease);
|
||||||
|
}
|
||||||
|
.tokens button:hover { border-color: var(--line-strong); color: var(--text); }
|
||||||
|
.tokens button:focus-visible { outline: 2px solid var(--ring); outline-offset: 1px; }
|
||||||
|
|
||||||
|
.actions { display: flex; align-items: center; gap: 12px; padding-top: 32px; border-top: 1px solid var(--line); }
|
||||||
|
button.save {
|
||||||
|
height: 36px;
|
||||||
|
padding: 0 16px;
|
||||||
|
background: var(--accent);
|
||||||
|
color: #fff;
|
||||||
|
border: 0;
|
||||||
|
border-radius: 8px;
|
||||||
|
font: 500 14px -apple-system, system-ui, sans-serif;
|
||||||
|
cursor: pointer;
|
||||||
|
transition: background-color .15s var(--ease), transform .1s var(--ease);
|
||||||
|
}
|
||||||
|
button.save:hover { background: var(--accent-hover); }
|
||||||
|
button.save:active { transform: scale(.98); }
|
||||||
|
button.save:focus-visible { outline: 2px solid var(--ring); outline-offset: 2px; }
|
||||||
|
.toast {
|
||||||
|
display: inline-flex; align-items: center; gap: 6px;
|
||||||
|
font-size: 13px; color: var(--ok);
|
||||||
|
opacity: 0;
|
||||||
|
transition: opacity .2s var(--ease);
|
||||||
|
}
|
||||||
|
|
||||||
|
@media (max-width: 600px) {
|
||||||
|
body { padding: 32px 16px 64px; }
|
||||||
|
.cards { grid-template-columns: 1fr; }
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<div class="wrap">
|
||||||
|
<header>
|
||||||
|
<div class="brand">ofsaver</div>
|
||||||
|
<h1>Settings</h1>
|
||||||
|
<p class="sub">Choose the folders and names for what you save. Changes apply to the next download.</p>
|
||||||
|
</header>
|
||||||
|
|
||||||
|
<section>
|
||||||
|
<h2>Single downloads</h2>
|
||||||
|
<p class="section-sub">The Download button on posts and messages</p>
|
||||||
|
<div class="cards" id="singleCards" role="radiogroup" aria-label="Single download folders"></div>
|
||||||
|
<div class="preview" id="singlePreview"></div>
|
||||||
|
</section>
|
||||||
|
|
||||||
|
<section>
|
||||||
|
<h2>Bulk downloads</h2>
|
||||||
|
<p class="section-sub">Whole profile downloads</p>
|
||||||
|
<div class="cards" id="bulkCards" role="radiogroup" aria-label="Bulk download folders"></div>
|
||||||
|
<div class="preview" id="bulkPreview"></div>
|
||||||
|
</section>
|
||||||
|
|
||||||
|
<section>
|
||||||
|
<h2>File name</h2>
|
||||||
|
<p class="section-sub">Build the name from tokens. Click one to insert it.</p>
|
||||||
|
<input type="text" id="nameTemplate" spellcheck="false" aria-label="File name pattern">
|
||||||
|
<div class="tokens" id="tokens">
|
||||||
|
<span class="label">Tokens</span>
|
||||||
|
<button type="button" data-t="{creator}">creator</button>
|
||||||
|
<button type="button" data-t="{type}">type</button>
|
||||||
|
<button type="button" data-t="{date}">date</button>
|
||||||
|
<button type="button" data-t="{timestamp}">timestamp</button>
|
||||||
|
<button type="button" data-t="{mediaId}">mediaId</button>
|
||||||
|
<button type="button" data-t="{postId}">postId</button>
|
||||||
|
<button type="button" data-t="{quality}">quality</button>
|
||||||
|
<button type="button" data-t="{ext}">ext</button>
|
||||||
|
</div>
|
||||||
|
</section>
|
||||||
|
|
||||||
|
<div class="actions">
|
||||||
|
<button class="save" id="save">Save settings</button>
|
||||||
|
<span class="toast" id="toast" role="status">
|
||||||
|
<svg class="i" viewBox="0 0 24 24"><path d="M20 6 9 17l-5-5"/></svg>Saved
|
||||||
|
</span>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<script type="module" src="options.js"></script>
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
107
ext/options.js
Normal file
107
ext/options.js
Normal file
@@ -0,0 +1,107 @@
|
|||||||
|
// Options page: folder scheme cards + filename template with live preview.
|
||||||
|
import { SINGLE_SCHEMES, BULK_SCHEMES, buildPath } from "./lib/paths.js";
|
||||||
|
|
||||||
|
const $ = (id) => document.getElementById(id);
|
||||||
|
|
||||||
|
const DEFAULTS = {
|
||||||
|
singleScheme: "creator-type",
|
||||||
|
bulkScheme: "creator-section-type",
|
||||||
|
nameTemplate: "{creator}_{type}_{date}_{timestamp}_{mediaId}_{quality}",
|
||||||
|
};
|
||||||
|
|
||||||
|
let settings = { ...DEFAULTS };
|
||||||
|
|
||||||
|
async function load() {
|
||||||
|
const stored = await chrome.storage.local.get(Object.keys(DEFAULTS));
|
||||||
|
settings = { ...DEFAULTS, ...stored };
|
||||||
|
$("nameTemplate").value = settings.nameTemplate;
|
||||||
|
renderCards();
|
||||||
|
renderPreviews();
|
||||||
|
}
|
||||||
|
|
||||||
|
async function save() {
|
||||||
|
settings.nameTemplate = $("nameTemplate").value.trim() || DEFAULTS.nameTemplate;
|
||||||
|
await chrome.storage.local.set(settings);
|
||||||
|
const t = $("toast");
|
||||||
|
t.style.opacity = 1;
|
||||||
|
clearTimeout(save.timer);
|
||||||
|
save.timer = setTimeout(() => (t.style.opacity = 0), 1600);
|
||||||
|
}
|
||||||
|
|
||||||
|
const esc = (v) => String(v).replace(/[&<>"]/g, (c) => ({ "&": "&", "<": "<", ">": ">", '"': """ })[c]);
|
||||||
|
|
||||||
|
const ICON_FOLDER = `<svg class="i" viewBox="0 0 24 24"><path d="M20 20a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.69-.9L9.6 3.9A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2Z"/></svg>`;
|
||||||
|
const ICON_FILE = `<svg class="i" viewBox="0 0 24 24"><path d="M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z"/><path d="M14 2v4a2 2 0 0 0 2 2h4"/></svg>`;
|
||||||
|
|
||||||
|
function cardHtml(key, def, selected) {
|
||||||
|
const folders = def.folders
|
||||||
|
? def.folders.map((f) => f.replaceAll("{creator}", "alice").replaceAll("{typeFolder}", "Videos").replaceAll("{section}", "Timeline").replaceAll("{date}", "2026-12-05"))
|
||||||
|
: ["same folders as single downloads"];
|
||||||
|
const path = ["Downloads", ...folders].map(esc).join(`<span class="sep">/</span>`);
|
||||||
|
return `<button type="button" role="radio" aria-checked="${selected}" class="card ${selected ? "selected" : ""}" data-key="${key}">
|
||||||
|
<span class="radio"></span>
|
||||||
|
<span class="t">${esc(def.label)}${def.rec ? `<span class="rec">Recommended</span>` : ""}</span>
|
||||||
|
<span class="d">${esc(def.desc)}</span>
|
||||||
|
<span class="path">${path}</span>
|
||||||
|
</button>`;
|
||||||
|
}
|
||||||
|
|
||||||
|
function renderCards() {
|
||||||
|
$("singleCards").innerHTML = Object.entries(SINGLE_SCHEMES)
|
||||||
|
.map(([k, def]) => cardHtml(k, def, settings.singleScheme === k))
|
||||||
|
.join("");
|
||||||
|
$("bulkCards").innerHTML = Object.entries(BULK_SCHEMES)
|
||||||
|
.map(([k, def]) => cardHtml(k, def, settings.bulkScheme === k))
|
||||||
|
.join("");
|
||||||
|
for (const el of $("singleCards").querySelectorAll(".card")) {
|
||||||
|
el.addEventListener("click", () => {
|
||||||
|
settings.singleScheme = el.dataset.key;
|
||||||
|
renderCards();
|
||||||
|
renderPreviews();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
for (const el of $("bulkCards").querySelectorAll(".card")) {
|
||||||
|
el.addEventListener("click", () => {
|
||||||
|
settings.bulkScheme = el.dataset.key;
|
||||||
|
renderCards();
|
||||||
|
renderPreviews();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
const SAMPLE = {
|
||||||
|
creator: "alice", type: "video", date: 1736000000, timestamp: 1796427457,
|
||||||
|
mediaId: "4812154655", postId: "2937318423", quality: "1080p", ext: "mp4",
|
||||||
|
};
|
||||||
|
|
||||||
|
function crumbsHtml(path) {
|
||||||
|
const parts = ["Downloads", ...String(path).split("/").filter(Boolean)];
|
||||||
|
return parts
|
||||||
|
.map((p, i) => {
|
||||||
|
const last = i === parts.length - 1;
|
||||||
|
return `<span class="crumb${last ? " file" : ""}">${last ? ICON_FILE : ICON_FOLDER}${esc(p)}</span>`;
|
||||||
|
})
|
||||||
|
.join(`<span class="sep">/</span>`);
|
||||||
|
}
|
||||||
|
|
||||||
|
function renderPreviews() {
|
||||||
|
const one = buildPath({ ...SAMPLE, scheme: settings.singleScheme, bulk: false, template: $("nameTemplate").value });
|
||||||
|
const bulk = buildPath({ ...SAMPLE, scheme: settings.bulkScheme, bulk: true, singleScheme: settings.singleScheme, section: "Timeline", template: $("nameTemplate").value });
|
||||||
|
$("singlePreview").innerHTML = `<div class="label">Next download</div><div class="crumbs">${crumbsHtml(one)}</div>`;
|
||||||
|
$("bulkPreview").innerHTML = `<div class="label">Next bulk download</div><div class="crumbs">${crumbsHtml(bulk)}</div>`;
|
||||||
|
}
|
||||||
|
|
||||||
|
for (const b of $("tokens").querySelectorAll("button[data-t]")) {
|
||||||
|
b.addEventListener("click", () => {
|
||||||
|
const input = $("nameTemplate");
|
||||||
|
const start = input.selectionStart ?? input.value.length;
|
||||||
|
const end = input.selectionEnd ?? start;
|
||||||
|
input.setRangeText(b.dataset.t, start, end, "end");
|
||||||
|
input.focus();
|
||||||
|
renderPreviews();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
$("nameTemplate").addEventListener("input", renderPreviews);
|
||||||
|
$("save").addEventListener("click", save);
|
||||||
|
load();
|
||||||
19
index.html
Normal file
19
index.html
Normal file
@@ -0,0 +1,19 @@
|
|||||||
|
<!DOCTYPE html>
|
||||||
|
<html lang="en">
|
||||||
|
<head>
|
||||||
|
<meta charset="UTF-8" />
|
||||||
|
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||||
|
<title>ofsaver — OnlyFans downloader for Chrome</title>
|
||||||
|
<meta name="description" content="A personal OnlyFans downloader that lives in your browser. Download photos, videos and audio straight from posts and messages — including DRM-protected media, decrypted locally. No servers, no accounts." />
|
||||||
|
<link rel="icon" type="image/png" href="/favicon.png" />
|
||||||
|
<link rel="apple-touch-icon" href="/apple-touch-icon.png" />
|
||||||
|
<meta property="og:image" content="/og.png" />
|
||||||
|
<link rel="preconnect" href="https://fonts.googleapis.com" />
|
||||||
|
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin />
|
||||||
|
<link href="https://fonts.googleapis.com/css2?family=Geist:wght@400;500;600&family=Geist+Mono:wght@400;500&display=swap" rel="stylesheet" />
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<div id="root"></div>
|
||||||
|
<script type="module" src="/src/main.jsx"></script>
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
38
nginx.conf
Normal file
38
nginx.conf
Normal file
@@ -0,0 +1,38 @@
|
|||||||
|
server {
|
||||||
|
listen 8080;
|
||||||
|
server_name _;
|
||||||
|
root /usr/share/nginx/html;
|
||||||
|
index index.html;
|
||||||
|
|
||||||
|
server_tokens off;
|
||||||
|
add_header X-Content-Type-Options "nosniff" always;
|
||||||
|
add_header X-Frame-Options "SAMEORIGIN" always;
|
||||||
|
add_header Referrer-Policy "strict-origin-when-cross-origin" always;
|
||||||
|
|
||||||
|
gzip on;
|
||||||
|
gzip_comp_level 6;
|
||||||
|
gzip_min_length 1024;
|
||||||
|
gzip_types text/plain text/css application/javascript application/json image/svg+xml;
|
||||||
|
|
||||||
|
# Hashed build output never changes under the same name: cache it for a year.
|
||||||
|
location /_app/ {
|
||||||
|
try_files $uri =404;
|
||||||
|
add_header Cache-Control "public, max-age=31536000, immutable";
|
||||||
|
add_header X-Content-Type-Options "nosniff" always;
|
||||||
|
}
|
||||||
|
|
||||||
|
location = /healthz {
|
||||||
|
access_log off;
|
||||||
|
default_type text/plain;
|
||||||
|
return 200 "ok\n";
|
||||||
|
}
|
||||||
|
|
||||||
|
# The page itself is always revalidated so a deploy shows up at once.
|
||||||
|
location / {
|
||||||
|
try_files $uri $uri/ /index.html;
|
||||||
|
add_header Cache-Control "no-cache";
|
||||||
|
add_header X-Content-Type-Options "nosniff" always;
|
||||||
|
add_header X-Frame-Options "SAMEORIGIN" always;
|
||||||
|
add_header Referrer-Policy "strict-origin-when-cross-origin" always;
|
||||||
|
}
|
||||||
|
}
|
||||||
927
package-lock.json
generated
Normal file
927
package-lock.json
generated
Normal file
@@ -0,0 +1,927 @@
|
|||||||
|
{
|
||||||
|
"name": "ofsaver",
|
||||||
|
"version": "1.0.0",
|
||||||
|
"lockfileVersion": 3,
|
||||||
|
"requires": true,
|
||||||
|
"packages": {
|
||||||
|
"": {
|
||||||
|
"name": "ofsaver",
|
||||||
|
"version": "1.0.0",
|
||||||
|
"dependencies": {
|
||||||
|
"react": "^19.3.1",
|
||||||
|
"react-dom": "^19.3.1"
|
||||||
|
},
|
||||||
|
"devDependencies": {
|
||||||
|
"@vitejs/plugin-react": "^6.3.1",
|
||||||
|
"vite": "^8.4.1"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/@oxc-project/types": {
|
||||||
|
"version": "0.160.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/@oxc-project/types/-/types-0.160.0.tgz",
|
||||||
|
"integrity": "sha512-gw4k9syEmnckbOgw2A2FU1TBDdX9hfwV9jEn/uio65pguPzwWiXQS3OIJDMEhv9m06tj9XiEe6RoD0YA+LgreA==",
|
||||||
|
"dev": true,
|
||||||
|
"license": "MIT",
|
||||||
|
"funding": {
|
||||||
|
"url": "https://github.com/sponsors/oxc-project"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/@rolldown/binding-android-arm-eabi": {
|
||||||
|
"version": "1.3.4",
|
||||||
|
"resolved": "https://registry.npmjs.org/@rolldown/binding-android-arm-eabi/-/binding-android-arm-eabi-1.3.4.tgz",
|
||||||
|
"integrity": "sha512-xCW8CkL/ualx/SbYqeG9iK87lJCZGDQ0soE+kaORJ0Bd+pHALyE4qK7BStmEAyYWLEzZ3/biSIpA6/7GDFvzIg==",
|
||||||
|
"cpu": [
|
||||||
|
"arm"
|
||||||
|
],
|
||||||
|
"dev": true,
|
||||||
|
"license": "MIT",
|
||||||
|
"optional": true,
|
||||||
|
"os": [
|
||||||
|
"android"
|
||||||
|
],
|
||||||
|
"engines": {
|
||||||
|
"node": "^20.19.0 || >=22.12.0"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/@rolldown/binding-android-arm64": {
|
||||||
|
"version": "1.3.4",
|
||||||
|
"resolved": "https://registry.npmjs.org/@rolldown/binding-android-arm64/-/binding-android-arm64-1.3.4.tgz",
|
||||||
|
"integrity": "sha512-5lifIO+b/prcM9sx/bkPN4w6UEToEfQ3gjhx0+0neuL+dkYskI792CfAq03T51jc8JFcaYXs2hi3l8RjiH/VWQ==",
|
||||||
|
"cpu": [
|
||||||
|
"arm64"
|
||||||
|
],
|
||||||
|
"dev": true,
|
||||||
|
"license": "MIT",
|
||||||
|
"optional": true,
|
||||||
|
"os": [
|
||||||
|
"android"
|
||||||
|
],
|
||||||
|
"engines": {
|
||||||
|
"node": "^20.19.0 || >=22.12.0"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/@rolldown/binding-darwin-arm64": {
|
||||||
|
"version": "1.3.4",
|
||||||
|
"resolved": "https://registry.npmjs.org/@rolldown/binding-darwin-arm64/-/binding-darwin-arm64-1.3.4.tgz",
|
||||||
|
"integrity": "sha512-RCgxTI4AJQxhVF//BI3ImQOsXTHrF4Eg+f99jBy8WoETA2kSEGFxpnrVmW0leQq/2aBR4R5AC6csmy3rc66e3Q==",
|
||||||
|
"cpu": [
|
||||||
|
"arm64"
|
||||||
|
],
|
||||||
|
"dev": true,
|
||||||
|
"license": "MIT",
|
||||||
|
"optional": true,
|
||||||
|
"os": [
|
||||||
|
"darwin"
|
||||||
|
],
|
||||||
|
"engines": {
|
||||||
|
"node": "^20.19.0 || >=22.12.0"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/@rolldown/binding-darwin-x64": {
|
||||||
|
"version": "1.3.4",
|
||||||
|
"resolved": "https://registry.npmjs.org/@rolldown/binding-darwin-x64/-/binding-darwin-x64-1.3.4.tgz",
|
||||||
|
"integrity": "sha512-zNPJVVPUaDEj+L0lImoK3rFv2b+Z5gNijI6DWu/fcD3/1TfmRXKb9ZyxbSN+2AhlctqjbNzUvCsMa+EBhnEM4Q==",
|
||||||
|
"cpu": [
|
||||||
|
"x64"
|
||||||
|
],
|
||||||
|
"dev": true,
|
||||||
|
"license": "MIT",
|
||||||
|
"optional": true,
|
||||||
|
"os": [
|
||||||
|
"darwin"
|
||||||
|
],
|
||||||
|
"engines": {
|
||||||
|
"node": "^20.19.0 || >=22.12.0"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/@rolldown/binding-freebsd-x64": {
|
||||||
|
"version": "1.3.4",
|
||||||
|
"resolved": "https://registry.npmjs.org/@rolldown/binding-freebsd-x64/-/binding-freebsd-x64-1.3.4.tgz",
|
||||||
|
"integrity": "sha512-upP6g7ZIRy5by1RDQ/EphHIdJ5xK0eUD7sUgfZFWJ49s4XdbYsIvIlAPtrFpayR70Hhf9J22lb4Pm8/9FhrZmg==",
|
||||||
|
"cpu": [
|
||||||
|
"x64"
|
||||||
|
],
|
||||||
|
"dev": true,
|
||||||
|
"license": "MIT",
|
||||||
|
"optional": true,
|
||||||
|
"os": [
|
||||||
|
"freebsd"
|
||||||
|
],
|
||||||
|
"engines": {
|
||||||
|
"node": "^20.19.0 || >=22.12.0"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/@rolldown/binding-linux-arm-gnueabihf": {
|
||||||
|
"version": "1.3.4",
|
||||||
|
"resolved": "https://registry.npmjs.org/@rolldown/binding-linux-arm-gnueabihf/-/binding-linux-arm-gnueabihf-1.3.4.tgz",
|
||||||
|
"integrity": "sha512-SAX5C5+poMLCxu8dkPF6h5yst40rkzs+9Y3cbPn2OFSydmHjAEprrGi64zGgnYyPIVZfdGUFqJ2fJbfbnHI+mA==",
|
||||||
|
"cpu": [
|
||||||
|
"arm"
|
||||||
|
],
|
||||||
|
"dev": true,
|
||||||
|
"license": "MIT",
|
||||||
|
"optional": true,
|
||||||
|
"os": [
|
||||||
|
"linux"
|
||||||
|
],
|
||||||
|
"engines": {
|
||||||
|
"node": "^20.19.0 || >=22.12.0"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/@rolldown/binding-linux-arm64-gnu": {
|
||||||
|
"version": "1.3.4",
|
||||||
|
"resolved": "https://registry.npmjs.org/@rolldown/binding-linux-arm64-gnu/-/binding-linux-arm64-gnu-1.3.4.tgz",
|
||||||
|
"integrity": "sha512-nwHqdlRZS6GWBef3dG5/pMY6RNTBBUjj7s0Da+m6xsFpe7jx6IC46SLZcCu8f46JOfCovZmwnrz51EzGE+7Fyw==",
|
||||||
|
"cpu": [
|
||||||
|
"arm64"
|
||||||
|
],
|
||||||
|
"dev": true,
|
||||||
|
"libc": [
|
||||||
|
"glibc"
|
||||||
|
],
|
||||||
|
"license": "MIT",
|
||||||
|
"optional": true,
|
||||||
|
"os": [
|
||||||
|
"linux"
|
||||||
|
],
|
||||||
|
"engines": {
|
||||||
|
"node": "^20.19.0 || >=22.12.0"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/@rolldown/binding-linux-arm64-musl": {
|
||||||
|
"version": "1.3.4",
|
||||||
|
"resolved": "https://registry.npmjs.org/@rolldown/binding-linux-arm64-musl/-/binding-linux-arm64-musl-1.3.4.tgz",
|
||||||
|
"integrity": "sha512-Gr78X2ur/AgLCkmZgHffk/FerIX8S5zb/eII4bCcvJo0ANzeXhTShahdNbpnY6bpiszIAgIfiuKS9ziziWsamw==",
|
||||||
|
"cpu": [
|
||||||
|
"arm64"
|
||||||
|
],
|
||||||
|
"dev": true,
|
||||||
|
"libc": [
|
||||||
|
"musl"
|
||||||
|
],
|
||||||
|
"license": "MIT",
|
||||||
|
"optional": true,
|
||||||
|
"os": [
|
||||||
|
"linux"
|
||||||
|
],
|
||||||
|
"engines": {
|
||||||
|
"node": "^20.19.0 || >=22.12.0"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/@rolldown/binding-linux-ppc64-gnu": {
|
||||||
|
"version": "1.3.4",
|
||||||
|
"resolved": "https://registry.npmjs.org/@rolldown/binding-linux-ppc64-gnu/-/binding-linux-ppc64-gnu-1.3.4.tgz",
|
||||||
|
"integrity": "sha512-o9Wcn8nWrsQasaBRYM4d//FwhlBsTJYWkPVlhlt6FwzpwEoovY4IopRZjk5Fq3+ntRuSDORJjF/nA8sFeF2q6w==",
|
||||||
|
"cpu": [
|
||||||
|
"ppc64"
|
||||||
|
],
|
||||||
|
"dev": true,
|
||||||
|
"libc": [
|
||||||
|
"glibc"
|
||||||
|
],
|
||||||
|
"license": "MIT",
|
||||||
|
"optional": true,
|
||||||
|
"os": [
|
||||||
|
"linux"
|
||||||
|
],
|
||||||
|
"engines": {
|
||||||
|
"node": "^20.19.0 || >=22.12.0"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/@rolldown/binding-linux-s390x-gnu": {
|
||||||
|
"version": "1.3.4",
|
||||||
|
"resolved": "https://registry.npmjs.org/@rolldown/binding-linux-s390x-gnu/-/binding-linux-s390x-gnu-1.3.4.tgz",
|
||||||
|
"integrity": "sha512-UDWu4jkVcx2kiBKm3Ec//4lVCbeTWj8gmJ9SyLWCdLWtTlyq7fQVeVV/14nXvRtSLErvJ2+yA/Ux5taS31Y17Q==",
|
||||||
|
"cpu": [
|
||||||
|
"s390x"
|
||||||
|
],
|
||||||
|
"dev": true,
|
||||||
|
"libc": [
|
||||||
|
"glibc"
|
||||||
|
],
|
||||||
|
"license": "MIT",
|
||||||
|
"optional": true,
|
||||||
|
"os": [
|
||||||
|
"linux"
|
||||||
|
],
|
||||||
|
"engines": {
|
||||||
|
"node": "^20.19.0 || >=22.12.0"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/@rolldown/binding-linux-x64-gnu": {
|
||||||
|
"version": "1.3.4",
|
||||||
|
"resolved": "https://registry.npmjs.org/@rolldown/binding-linux-x64-gnu/-/binding-linux-x64-gnu-1.3.4.tgz",
|
||||||
|
"integrity": "sha512-W9mGtTa0w4fWh8RLMNPyaEhhcuqUfO07Q4I1bBc4PDMNg7gQSw0yPQNQ3D0qwbkXwxbyL4YrIzc8n6k1vuFExQ==",
|
||||||
|
"cpu": [
|
||||||
|
"x64"
|
||||||
|
],
|
||||||
|
"dev": true,
|
||||||
|
"libc": [
|
||||||
|
"glibc"
|
||||||
|
],
|
||||||
|
"license": "MIT",
|
||||||
|
"optional": true,
|
||||||
|
"os": [
|
||||||
|
"linux"
|
||||||
|
],
|
||||||
|
"engines": {
|
||||||
|
"node": "^20.19.0 || >=22.12.0"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/@rolldown/binding-linux-x64-musl": {
|
||||||
|
"version": "1.3.4",
|
||||||
|
"resolved": "https://registry.npmjs.org/@rolldown/binding-linux-x64-musl/-/binding-linux-x64-musl-1.3.4.tgz",
|
||||||
|
"integrity": "sha512-8B+ofyQZ7/aCmkqnyMonPr5zKLqMVNczhRGFNtdIuItiwNn8iQWJawMq2E58r7bxD1XEbtRRsULY/eCWwZQ01Q==",
|
||||||
|
"cpu": [
|
||||||
|
"x64"
|
||||||
|
],
|
||||||
|
"dev": true,
|
||||||
|
"libc": [
|
||||||
|
"musl"
|
||||||
|
],
|
||||||
|
"license": "MIT",
|
||||||
|
"optional": true,
|
||||||
|
"os": [
|
||||||
|
"linux"
|
||||||
|
],
|
||||||
|
"engines": {
|
||||||
|
"node": "^20.19.0 || >=22.12.0"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/@rolldown/binding-openharmony-arm64": {
|
||||||
|
"version": "1.3.4",
|
||||||
|
"resolved": "https://registry.npmjs.org/@rolldown/binding-openharmony-arm64/-/binding-openharmony-arm64-1.3.4.tgz",
|
||||||
|
"integrity": "sha512-TlD0FSZaC7o2B4NCe9V5N11ugTnhzTM9ksj4sgRLvrKosDzjEkvlsTX3ehkw4ZlPv8AADimZZTvJGEa16pfXug==",
|
||||||
|
"cpu": [
|
||||||
|
"arm64"
|
||||||
|
],
|
||||||
|
"dev": true,
|
||||||
|
"license": "MIT",
|
||||||
|
"optional": true,
|
||||||
|
"os": [
|
||||||
|
"openharmony"
|
||||||
|
],
|
||||||
|
"engines": {
|
||||||
|
"node": "^20.19.0 || >=22.12.0"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/@rolldown/binding-wasm32-wasi": {
|
||||||
|
"version": "1.3.4",
|
||||||
|
"resolved": "https://registry.npmjs.org/@rolldown/binding-wasm32-wasi/-/binding-wasm32-wasi-1.3.4.tgz",
|
||||||
|
"integrity": "sha512-jwO8P3o53ygo7b5061B7BeaJ1BGv3BKZ6jroFdw/01qWry7Z+qNBlDvulzbTle5s/A0Fc1FRgsTxrke9DvsSbA==",
|
||||||
|
"cpu": [
|
||||||
|
"wasm32"
|
||||||
|
],
|
||||||
|
"dev": true,
|
||||||
|
"license": "MIT",
|
||||||
|
"optional": true,
|
||||||
|
"dependencies": {
|
||||||
|
"@oxc-project/types": "0.160.0"
|
||||||
|
},
|
||||||
|
"engines": {
|
||||||
|
"node": "^20.19.0 || ^22.13.0 || >=23.5.0"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/@rolldown/binding-win32-arm64-msvc": {
|
||||||
|
"version": "1.3.4",
|
||||||
|
"resolved": "https://registry.npmjs.org/@rolldown/binding-win32-arm64-msvc/-/binding-win32-arm64-msvc-1.3.4.tgz",
|
||||||
|
"integrity": "sha512-8adGMrNtrdzi2WD1ozhYapER59gD8Q/DV6SCKJlyG2HqULPdeQUBvMa33lTsiEYwIqTZUaIU2MmvPp5f1wbtXA==",
|
||||||
|
"cpu": [
|
||||||
|
"arm64"
|
||||||
|
],
|
||||||
|
"dev": true,
|
||||||
|
"license": "MIT",
|
||||||
|
"optional": true,
|
||||||
|
"os": [
|
||||||
|
"win32"
|
||||||
|
],
|
||||||
|
"engines": {
|
||||||
|
"node": "^20.19.0 || >=22.12.0"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/@rolldown/binding-win32-x64-msvc": {
|
||||||
|
"version": "1.3.4",
|
||||||
|
"resolved": "https://registry.npmjs.org/@rolldown/binding-win32-x64-msvc/-/binding-win32-x64-msvc-1.3.4.tgz",
|
||||||
|
"integrity": "sha512-rIMjtESdXJCIoOiUTroQ1Y1rjVDZkuUVRUxs3APX2vNv175D7TDWvzdELiIhzGq9cUNUFat+co+PTmPHPqSREg==",
|
||||||
|
"cpu": [
|
||||||
|
"x64"
|
||||||
|
],
|
||||||
|
"dev": true,
|
||||||
|
"license": "MIT",
|
||||||
|
"optional": true,
|
||||||
|
"os": [
|
||||||
|
"win32"
|
||||||
|
],
|
||||||
|
"engines": {
|
||||||
|
"node": "^20.19.0 || >=22.12.0"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/@rolldown/pluginutils": {
|
||||||
|
"version": "1.1.1",
|
||||||
|
"resolved": "https://registry.npmjs.org/@rolldown/pluginutils/-/pluginutils-1.1.1.tgz",
|
||||||
|
"integrity": "sha512-glFIJDvLNDtJhT9qrMFWLPbvS+skxgt4L0K8Ei2YtnhPysAJnsI7nyxSJxKj4ADeKX0OLjC4ntRkwpLOoS3rwA==",
|
||||||
|
"dev": true,
|
||||||
|
"license": "MIT"
|
||||||
|
},
|
||||||
|
"node_modules/@vitejs/plugin-react": {
|
||||||
|
"version": "6.3.1",
|
||||||
|
"resolved": "https://registry.npmjs.org/@vitejs/plugin-react/-/plugin-react-6.3.1.tgz",
|
||||||
|
"integrity": "sha512-kYc/mQZ8hnpFXNJXdrbm6kUbLya+V+Q5o3V2j06tR+4lVSyY9Pgx0eBw+eYTVseNUiMY2hr/3PM/EHVOYNKuHw==",
|
||||||
|
"dev": true,
|
||||||
|
"license": "MIT",
|
||||||
|
"dependencies": {
|
||||||
|
"@rolldown/pluginutils": "^1.1.1"
|
||||||
|
},
|
||||||
|
"engines": {
|
||||||
|
"node": "^20.19.0 || >=22.12.0"
|
||||||
|
},
|
||||||
|
"peerDependencies": {
|
||||||
|
"@rolldown/plugin-babel": "^0.1.7 || ^0.2.0 || ^0.3.0",
|
||||||
|
"babel-plugin-react-compiler": "^1.0.0",
|
||||||
|
"oxc-transform-react": ">=0.152.0 <0.157.0",
|
||||||
|
"vite": "^8.0.0"
|
||||||
|
},
|
||||||
|
"peerDependenciesMeta": {
|
||||||
|
"@rolldown/plugin-babel": {
|
||||||
|
"optional": true
|
||||||
|
},
|
||||||
|
"babel-plugin-react-compiler": {
|
||||||
|
"optional": true
|
||||||
|
},
|
||||||
|
"oxc-transform-react": {
|
||||||
|
"optional": true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/detect-libc": {
|
||||||
|
"version": "2.1.2",
|
||||||
|
"resolved": "https://registry.npmjs.org/detect-libc/-/detect-libc-2.1.2.tgz",
|
||||||
|
"integrity": "sha512-Btj2BOOO83o3WyH59e8MgXsxEQVcarkUOpEYrubB0urwnN10yQ364rsiByU11nZlqWYZm05i/of7io4mzihBtQ==",
|
||||||
|
"dev": true,
|
||||||
|
"license": "Apache-2.0",
|
||||||
|
"engines": {
|
||||||
|
"node": ">=8"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/fdir": {
|
||||||
|
"version": "6.5.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/fdir/-/fdir-6.5.0.tgz",
|
||||||
|
"integrity": "sha512-tIbYtZbucOs0BRGqPJkshJUYdL+SDH7dVM8gjy+ERp3WAUjLEFJE+02kanyHtwjWOnwrKYBiwAmM0p4kLJAnXg==",
|
||||||
|
"dev": true,
|
||||||
|
"license": "MIT",
|
||||||
|
"engines": {
|
||||||
|
"node": ">=12.0.0"
|
||||||
|
},
|
||||||
|
"peerDependencies": {
|
||||||
|
"picomatch": "^3 || ^4"
|
||||||
|
},
|
||||||
|
"peerDependenciesMeta": {
|
||||||
|
"picomatch": {
|
||||||
|
"optional": true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/fsevents": {
|
||||||
|
"version": "2.3.3",
|
||||||
|
"resolved": "https://registry.npmjs.org/fsevents/-/fsevents-2.3.3.tgz",
|
||||||
|
"integrity": "sha512-5xoDfX+fL7faATnagmWPpbFtwh/R77WmMMqqHGS65C3vvB0YHrgF+B1YmZ3441tMj5n63k0212XNoJwzlhffQw==",
|
||||||
|
"dev": true,
|
||||||
|
"hasInstallScript": true,
|
||||||
|
"license": "MIT",
|
||||||
|
"optional": true,
|
||||||
|
"os": [
|
||||||
|
"darwin"
|
||||||
|
],
|
||||||
|
"engines": {
|
||||||
|
"node": "^8.16.0 || ^10.6.0 || >=11.0.0"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/lightningcss": {
|
||||||
|
"version": "1.33.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/lightningcss/-/lightningcss-1.33.0.tgz",
|
||||||
|
"integrity": "sha512-WkUDrojuJs0xkgGf2udWxa3yGBRxPtxUkB79i6aCZLRgc7PM8fZe9TosfPDcvEpQZbuFASnHYmRLBLUbmLOIIA==",
|
||||||
|
"dev": true,
|
||||||
|
"license": "MPL-2.0",
|
||||||
|
"dependencies": {
|
||||||
|
"detect-libc": "^2.0.3"
|
||||||
|
},
|
||||||
|
"engines": {
|
||||||
|
"node": ">= 12.0.0"
|
||||||
|
},
|
||||||
|
"funding": {
|
||||||
|
"type": "opencollective",
|
||||||
|
"url": "https://opencollective.com/parcel"
|
||||||
|
},
|
||||||
|
"optionalDependencies": {
|
||||||
|
"lightningcss-android-arm64": "1.33.0",
|
||||||
|
"lightningcss-darwin-arm64": "1.33.0",
|
||||||
|
"lightningcss-darwin-x64": "1.33.0",
|
||||||
|
"lightningcss-freebsd-x64": "1.33.0",
|
||||||
|
"lightningcss-linux-arm-gnueabihf": "1.33.0",
|
||||||
|
"lightningcss-linux-arm64-gnu": "1.33.0",
|
||||||
|
"lightningcss-linux-arm64-musl": "1.33.0",
|
||||||
|
"lightningcss-linux-x64-gnu": "1.33.0",
|
||||||
|
"lightningcss-linux-x64-musl": "1.33.0",
|
||||||
|
"lightningcss-win32-arm64-msvc": "1.33.0",
|
||||||
|
"lightningcss-win32-x64-msvc": "1.33.0"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/lightningcss-android-arm64": {
|
||||||
|
"version": "1.33.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/lightningcss-android-arm64/-/lightningcss-android-arm64-1.33.0.tgz",
|
||||||
|
"integrity": "sha512-gEpRTalKdosp4Bb8qWtc2iOgE5SeIHlpS1up9bFq2wAyYhl1UdTObYiHe98zEM9SQvSoqQZ1IQD0JNpg3Ml5pg==",
|
||||||
|
"cpu": [
|
||||||
|
"arm64"
|
||||||
|
],
|
||||||
|
"dev": true,
|
||||||
|
"license": "MPL-2.0",
|
||||||
|
"optional": true,
|
||||||
|
"os": [
|
||||||
|
"android"
|
||||||
|
],
|
||||||
|
"engines": {
|
||||||
|
"node": ">= 12.0.0"
|
||||||
|
},
|
||||||
|
"funding": {
|
||||||
|
"type": "opencollective",
|
||||||
|
"url": "https://opencollective.com/parcel"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/lightningcss-darwin-arm64": {
|
||||||
|
"version": "1.33.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/lightningcss-darwin-arm64/-/lightningcss-darwin-arm64-1.33.0.tgz",
|
||||||
|
"integrity": "sha512-Sciaz8eenNTKn9b3t7+xr0ipTp9YxKQY4npwQ3mrRuL0BAVHBLyZxofhaKBAVtzmtRZ/zTyo0/to4B1uWG/Djg==",
|
||||||
|
"cpu": [
|
||||||
|
"arm64"
|
||||||
|
],
|
||||||
|
"dev": true,
|
||||||
|
"license": "MPL-2.0",
|
||||||
|
"optional": true,
|
||||||
|
"os": [
|
||||||
|
"darwin"
|
||||||
|
],
|
||||||
|
"engines": {
|
||||||
|
"node": ">= 12.0.0"
|
||||||
|
},
|
||||||
|
"funding": {
|
||||||
|
"type": "opencollective",
|
||||||
|
"url": "https://opencollective.com/parcel"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/lightningcss-darwin-x64": {
|
||||||
|
"version": "1.33.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/lightningcss-darwin-x64/-/lightningcss-darwin-x64-1.33.0.tgz",
|
||||||
|
"integrity": "sha512-Z5UPAxzrjlWNNyGy6i65cJzzvgJ5D3T6wMvs+gWpY9d7qRhANrxqAp6LhxIgZhWEw18RfJTGcRxjuLIBr+m8XQ==",
|
||||||
|
"cpu": [
|
||||||
|
"x64"
|
||||||
|
],
|
||||||
|
"dev": true,
|
||||||
|
"license": "MPL-2.0",
|
||||||
|
"optional": true,
|
||||||
|
"os": [
|
||||||
|
"darwin"
|
||||||
|
],
|
||||||
|
"engines": {
|
||||||
|
"node": ">= 12.0.0"
|
||||||
|
},
|
||||||
|
"funding": {
|
||||||
|
"type": "opencollective",
|
||||||
|
"url": "https://opencollective.com/parcel"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/lightningcss-freebsd-x64": {
|
||||||
|
"version": "1.33.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/lightningcss-freebsd-x64/-/lightningcss-freebsd-x64-1.33.0.tgz",
|
||||||
|
"integrity": "sha512-QQM/Ti/hQajJwCY+RiWuCZ9sdtI/XQk7nDK5vC8kkdwixezOlDgvDx7+RT+QjK6FcFT4MpsuoBnHIo/O3StRRg==",
|
||||||
|
"cpu": [
|
||||||
|
"x64"
|
||||||
|
],
|
||||||
|
"dev": true,
|
||||||
|
"license": "MPL-2.0",
|
||||||
|
"optional": true,
|
||||||
|
"os": [
|
||||||
|
"freebsd"
|
||||||
|
],
|
||||||
|
"engines": {
|
||||||
|
"node": ">= 12.0.0"
|
||||||
|
},
|
||||||
|
"funding": {
|
||||||
|
"type": "opencollective",
|
||||||
|
"url": "https://opencollective.com/parcel"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/lightningcss-linux-arm-gnueabihf": {
|
||||||
|
"version": "1.33.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/lightningcss-linux-arm-gnueabihf/-/lightningcss-linux-arm-gnueabihf-1.33.0.tgz",
|
||||||
|
"integrity": "sha512-N7FVBe6iS24MlM6R/4RBTxGhQheZGs7tiQ9U32UtF75NzP5Q7xWPRqLBCKxlRQRk3rY1jCIPLzx7WzOhuUIRLQ==",
|
||||||
|
"cpu": [
|
||||||
|
"arm"
|
||||||
|
],
|
||||||
|
"dev": true,
|
||||||
|
"license": "MPL-2.0",
|
||||||
|
"optional": true,
|
||||||
|
"os": [
|
||||||
|
"linux"
|
||||||
|
],
|
||||||
|
"engines": {
|
||||||
|
"node": ">= 12.0.0"
|
||||||
|
},
|
||||||
|
"funding": {
|
||||||
|
"type": "opencollective",
|
||||||
|
"url": "https://opencollective.com/parcel"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/lightningcss-linux-arm64-gnu": {
|
||||||
|
"version": "1.33.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/lightningcss-linux-arm64-gnu/-/lightningcss-linux-arm64-gnu-1.33.0.tgz",
|
||||||
|
"integrity": "sha512-j2v/itmy4HlNxlc6voKXYgBqNi0Ng2LShg4z7GufpEgs05P+2suBVyi9I6YHq5uoVFx9ETin3eCEhLVyXGQnKg==",
|
||||||
|
"cpu": [
|
||||||
|
"arm64"
|
||||||
|
],
|
||||||
|
"dev": true,
|
||||||
|
"libc": [
|
||||||
|
"glibc"
|
||||||
|
],
|
||||||
|
"license": "MPL-2.0",
|
||||||
|
"optional": true,
|
||||||
|
"os": [
|
||||||
|
"linux"
|
||||||
|
],
|
||||||
|
"engines": {
|
||||||
|
"node": ">= 12.0.0"
|
||||||
|
},
|
||||||
|
"funding": {
|
||||||
|
"type": "opencollective",
|
||||||
|
"url": "https://opencollective.com/parcel"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/lightningcss-linux-arm64-musl": {
|
||||||
|
"version": "1.33.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/lightningcss-linux-arm64-musl/-/lightningcss-linux-arm64-musl-1.33.0.tgz",
|
||||||
|
"integrity": "sha512-yiO5ROMuYQgXbC60yjZU5CYSFZGKXL0HFATXt9mHJn1+zW55oCtMI9NfcVhYLMFDL7gV7oBPon/EmMMGg2OvtQ==",
|
||||||
|
"cpu": [
|
||||||
|
"arm64"
|
||||||
|
],
|
||||||
|
"dev": true,
|
||||||
|
"libc": [
|
||||||
|
"musl"
|
||||||
|
],
|
||||||
|
"license": "MPL-2.0",
|
||||||
|
"optional": true,
|
||||||
|
"os": [
|
||||||
|
"linux"
|
||||||
|
],
|
||||||
|
"engines": {
|
||||||
|
"node": ">= 12.0.0"
|
||||||
|
},
|
||||||
|
"funding": {
|
||||||
|
"type": "opencollective",
|
||||||
|
"url": "https://opencollective.com/parcel"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/lightningcss-linux-x64-gnu": {
|
||||||
|
"version": "1.33.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/lightningcss-linux-x64-gnu/-/lightningcss-linux-x64-gnu-1.33.0.tgz",
|
||||||
|
"integrity": "sha512-ar+Ju7LmcN0Jo4FpL4hpFybwNG9/3A/Br5KW2n2jyODg3MEZXaDYADdemoNS+BDNfMgKvylJLj4S5tyRActuAg==",
|
||||||
|
"cpu": [
|
||||||
|
"x64"
|
||||||
|
],
|
||||||
|
"dev": true,
|
||||||
|
"libc": [
|
||||||
|
"glibc"
|
||||||
|
],
|
||||||
|
"license": "MPL-2.0",
|
||||||
|
"optional": true,
|
||||||
|
"os": [
|
||||||
|
"linux"
|
||||||
|
],
|
||||||
|
"engines": {
|
||||||
|
"node": ">= 12.0.0"
|
||||||
|
},
|
||||||
|
"funding": {
|
||||||
|
"type": "opencollective",
|
||||||
|
"url": "https://opencollective.com/parcel"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/lightningcss-linux-x64-musl": {
|
||||||
|
"version": "1.33.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/lightningcss-linux-x64-musl/-/lightningcss-linux-x64-musl-1.33.0.tgz",
|
||||||
|
"integrity": "sha512-RYiYbkokw0trfKqqzfF55lginwEPrD3OJDfTuJzFs1MK6iFnDenaz1fqLLtX4ITG3OktJQXOeTaw1awrBAlZPw==",
|
||||||
|
"cpu": [
|
||||||
|
"x64"
|
||||||
|
],
|
||||||
|
"dev": true,
|
||||||
|
"libc": [
|
||||||
|
"musl"
|
||||||
|
],
|
||||||
|
"license": "MPL-2.0",
|
||||||
|
"optional": true,
|
||||||
|
"os": [
|
||||||
|
"linux"
|
||||||
|
],
|
||||||
|
"engines": {
|
||||||
|
"node": ">= 12.0.0"
|
||||||
|
},
|
||||||
|
"funding": {
|
||||||
|
"type": "opencollective",
|
||||||
|
"url": "https://opencollective.com/parcel"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/lightningcss-win32-arm64-msvc": {
|
||||||
|
"version": "1.33.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/lightningcss-win32-arm64-msvc/-/lightningcss-win32-arm64-msvc-1.33.0.tgz",
|
||||||
|
"integrity": "sha512-1K+MPfLSFVpphzpdbfkhlWk6wBrTObBzS2T6db10PNOZgR9GoVsAWzwNyuhUYYbTp23j+4RrncfujZ4uAzXvwA==",
|
||||||
|
"cpu": [
|
||||||
|
"arm64"
|
||||||
|
],
|
||||||
|
"dev": true,
|
||||||
|
"license": "MPL-2.0",
|
||||||
|
"optional": true,
|
||||||
|
"os": [
|
||||||
|
"win32"
|
||||||
|
],
|
||||||
|
"engines": {
|
||||||
|
"node": ">= 12.0.0"
|
||||||
|
},
|
||||||
|
"funding": {
|
||||||
|
"type": "opencollective",
|
||||||
|
"url": "https://opencollective.com/parcel"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/lightningcss-win32-x64-msvc": {
|
||||||
|
"version": "1.33.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/lightningcss-win32-x64-msvc/-/lightningcss-win32-x64-msvc-1.33.0.tgz",
|
||||||
|
"integrity": "sha512-OlEICDx/Xl0FqSp4bry8zFnCvGpig3Gl4gCquvYwHuqJKEC1+n9NgDniFvqHGmMv1ZkqDJrDqKKSykTDX+ehuA==",
|
||||||
|
"cpu": [
|
||||||
|
"x64"
|
||||||
|
],
|
||||||
|
"dev": true,
|
||||||
|
"license": "MPL-2.0",
|
||||||
|
"optional": true,
|
||||||
|
"os": [
|
||||||
|
"win32"
|
||||||
|
],
|
||||||
|
"engines": {
|
||||||
|
"node": ">= 12.0.0"
|
||||||
|
},
|
||||||
|
"funding": {
|
||||||
|
"type": "opencollective",
|
||||||
|
"url": "https://opencollective.com/parcel"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/nanoid": {
|
||||||
|
"version": "3.3.20",
|
||||||
|
"resolved": "https://registry.npmjs.org/nanoid/-/nanoid-3.3.20.tgz",
|
||||||
|
"integrity": "sha512-uKdg2G3GNCKQn9byYOpxbGqrT2fGO5KRt5J/8b3pok8rT6qxGWF6hxMyJiEYtAf+FVyYuD9hRaDqX5uPFYJ4ZQ==",
|
||||||
|
"dev": true,
|
||||||
|
"funding": [
|
||||||
|
{
|
||||||
|
"type": "github",
|
||||||
|
"url": "https://github.com/sponsors/ai"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"license": "MIT",
|
||||||
|
"bin": {
|
||||||
|
"nanoid": "bin/nanoid.cjs"
|
||||||
|
},
|
||||||
|
"engines": {
|
||||||
|
"node": "^10 || ^12 || ^13.7 || ^14 || >=15.0.1"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/napi-windows-process-start-time": {
|
||||||
|
"version": "0.1.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/napi-windows-process-start-time/-/napi-windows-process-start-time-0.1.0.tgz",
|
||||||
|
"integrity": "sha512-zHxhzKsIFu3elch3eFw69WEUGc79DFhbc3nD/WEOzWL/pFFLZRW13EHnuO0c+0YjncE5uCaS9ICHxOBXkb6vPw==",
|
||||||
|
"cpu": [
|
||||||
|
"x64",
|
||||||
|
"arm64"
|
||||||
|
],
|
||||||
|
"dev": true,
|
||||||
|
"license": "MIT",
|
||||||
|
"optional": true,
|
||||||
|
"os": [
|
||||||
|
"win32"
|
||||||
|
],
|
||||||
|
"engines": {
|
||||||
|
"node": ">=20"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/picocolors": {
|
||||||
|
"version": "1.1.1",
|
||||||
|
"resolved": "https://registry.npmjs.org/picocolors/-/picocolors-1.1.1.tgz",
|
||||||
|
"integrity": "sha512-xceH2snhtb5M9liqDsmEw56le376mTZkEX/jEb/RxNFyegNul7eNslCXP9FDj/Lcu0X8KEyMceP2ntpaHrDEVA==",
|
||||||
|
"dev": true,
|
||||||
|
"license": "ISC"
|
||||||
|
},
|
||||||
|
"node_modules/picomatch": {
|
||||||
|
"version": "4.0.7",
|
||||||
|
"resolved": "https://registry.npmjs.org/picomatch/-/picomatch-4.0.7.tgz",
|
||||||
|
"integrity": "sha512-qcJu88Q2IWqJsDD529JKMdwGm/dvInW4HvQnRwiH9JtihJvzGOscDtHE3x1pBKeUOTysQ8kVmLnJ2kJu7yhcGA==",
|
||||||
|
"dev": true,
|
||||||
|
"license": "MIT",
|
||||||
|
"engines": {
|
||||||
|
"node": ">=12"
|
||||||
|
},
|
||||||
|
"funding": {
|
||||||
|
"url": "https://github.com/sponsors/jonschlinkert"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/postcss": {
|
||||||
|
"version": "8.5.34",
|
||||||
|
"resolved": "https://registry.npmjs.org/postcss/-/postcss-8.5.34.tgz",
|
||||||
|
"integrity": "sha512-P1Qzj0XXZjMda74C7qiVnBG90UKNbyNUAOeQRBW8X63RsIMV57gevRqjnkELdwtZ/S2/uQFksJhmwuN8xShLPw==",
|
||||||
|
"dev": true,
|
||||||
|
"funding": [
|
||||||
|
{
|
||||||
|
"type": "opencollective",
|
||||||
|
"url": "https://opencollective.com/postcss/"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "tidelift",
|
||||||
|
"url": "https://tidelift.com/funding/github/npm/postcss"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "github",
|
||||||
|
"url": "https://github.com/sponsors/ai"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"license": "MIT",
|
||||||
|
"dependencies": {
|
||||||
|
"nanoid": "^3.3.20",
|
||||||
|
"picocolors": "^1.1.1",
|
||||||
|
"source-map-js": "^1.2.4"
|
||||||
|
},
|
||||||
|
"engines": {
|
||||||
|
"node": "^10 || ^12 || >=14"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/react": {
|
||||||
|
"version": "19.3.1",
|
||||||
|
"resolved": "https://registry.npmjs.org/react/-/react-19.3.1.tgz",
|
||||||
|
"integrity": "sha512-QNhWdt7nrgVWWQG58QuGsAR3jv3Hbe4mb4vz7w2csnHavciZJgda1CPNaldF6eVxv90ud3jUXpKlHL69gO38yw==",
|
||||||
|
"license": "MIT",
|
||||||
|
"engines": {
|
||||||
|
"node": ">=0.10.0"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/react-dom": {
|
||||||
|
"version": "19.3.1",
|
||||||
|
"resolved": "https://registry.npmjs.org/react-dom/-/react-dom-19.3.1.tgz",
|
||||||
|
"integrity": "sha512-Y0bARz53lhEC1NMCASs0/j+faB/zqt3R8hpvg1e8+61ZVJ4UL0UdC4cBbXfZMcIuhrfgeILTLe+ZeBCavQPtKQ==",
|
||||||
|
"license": "MIT",
|
||||||
|
"dependencies": {
|
||||||
|
"scheduler": "^0.28.0"
|
||||||
|
},
|
||||||
|
"peerDependencies": {
|
||||||
|
"react": "^19.3.1"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/rolldown": {
|
||||||
|
"version": "1.3.4",
|
||||||
|
"resolved": "https://registry.npmjs.org/rolldown/-/rolldown-1.3.4.tgz",
|
||||||
|
"integrity": "sha512-p2rq4bfBmF0M6yaR8+A89fbkBQynZI2fxUW4G07eq9kpctAkpo7q5BZ4X4Mo4XZ7HHROu33cX9PeopUFN6u+2Q==",
|
||||||
|
"dev": true,
|
||||||
|
"license": "MIT",
|
||||||
|
"dependencies": {
|
||||||
|
"@oxc-project/types": "=0.160.0",
|
||||||
|
"@rolldown/pluginutils": "^1.0.0"
|
||||||
|
},
|
||||||
|
"bin": {
|
||||||
|
"rolldown": "bin/cli.mjs"
|
||||||
|
},
|
||||||
|
"engines": {
|
||||||
|
"node": "^20.19.0 || >=22.12.0"
|
||||||
|
},
|
||||||
|
"optionalDependencies": {
|
||||||
|
"@rolldown/binding-android-arm-eabi": "1.3.4",
|
||||||
|
"@rolldown/binding-android-arm64": "1.3.4",
|
||||||
|
"@rolldown/binding-darwin-arm64": "1.3.4",
|
||||||
|
"@rolldown/binding-darwin-x64": "1.3.4",
|
||||||
|
"@rolldown/binding-freebsd-x64": "1.3.4",
|
||||||
|
"@rolldown/binding-linux-arm-gnueabihf": "1.3.4",
|
||||||
|
"@rolldown/binding-linux-arm64-gnu": "1.3.4",
|
||||||
|
"@rolldown/binding-linux-arm64-musl": "1.3.4",
|
||||||
|
"@rolldown/binding-linux-ppc64-gnu": "1.3.4",
|
||||||
|
"@rolldown/binding-linux-s390x-gnu": "1.3.4",
|
||||||
|
"@rolldown/binding-linux-x64-gnu": "1.3.4",
|
||||||
|
"@rolldown/binding-linux-x64-musl": "1.3.4",
|
||||||
|
"@rolldown/binding-openharmony-arm64": "1.3.4",
|
||||||
|
"@rolldown/binding-wasm32-wasi": "1.3.4",
|
||||||
|
"@rolldown/binding-win32-arm64-msvc": "1.3.4",
|
||||||
|
"@rolldown/binding-win32-x64-msvc": "1.3.4"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/scheduler": {
|
||||||
|
"version": "0.28.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/scheduler/-/scheduler-0.28.0.tgz",
|
||||||
|
"integrity": "sha512-juorfCmIkIw8tT+p5BXSm6PJjQF/ycEYmKyzURCIt/RaZIhL+PulbQ9Yu2z1HdOJDdqDTlxA1+xKBmHXJsczAw==",
|
||||||
|
"license": "MIT"
|
||||||
|
},
|
||||||
|
"node_modules/source-map-js": {
|
||||||
|
"version": "1.3.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/source-map-js/-/source-map-js-1.3.0.tgz",
|
||||||
|
"integrity": "sha512-pdUVfIWcK0kCgK831ibqkZDcL7I9zljjOu0TQFnA+fiQ6y1CYqYB7RkTOHHO45FGMg5P/Mvk/+4ToQ7gAYAL5Q==",
|
||||||
|
"dev": true,
|
||||||
|
"license": "BSD-3-Clause",
|
||||||
|
"engines": {
|
||||||
|
"node": ">=6.0.0"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/tinyglobby": {
|
||||||
|
"version": "0.2.17",
|
||||||
|
"resolved": "https://registry.npmjs.org/tinyglobby/-/tinyglobby-0.2.17.tgz",
|
||||||
|
"integrity": "sha512-wXR/dYpcqKmfWpEdZjiKJOwCNFndD0DMnrW/cYjVGttEkBfVgcLFHoNrlj47mjOVic9yyNu65alsgF4NQyTa2g==",
|
||||||
|
"dev": true,
|
||||||
|
"license": "MIT",
|
||||||
|
"dependencies": {
|
||||||
|
"fdir": "^6.5.0",
|
||||||
|
"picomatch": "^4.0.4"
|
||||||
|
},
|
||||||
|
"engines": {
|
||||||
|
"node": ">=12.0.0"
|
||||||
|
},
|
||||||
|
"funding": {
|
||||||
|
"url": "https://github.com/sponsors/SuperchupuDev"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/vite": {
|
||||||
|
"version": "8.4.1",
|
||||||
|
"resolved": "https://registry.npmjs.org/vite/-/vite-8.4.1.tgz",
|
||||||
|
"integrity": "sha512-2bl8n3+GkKBKQQR8CZC+t+3NvjWCBNh9S0Dbfu7hr7+Jjeg71jcZk7uKF6mo8GZXjIws+Nl6jhvAfHUO320VuQ==",
|
||||||
|
"dev": true,
|
||||||
|
"license": "MIT",
|
||||||
|
"dependencies": {
|
||||||
|
"lightningcss": "^1.33.0",
|
||||||
|
"picomatch": "^4.0.7",
|
||||||
|
"postcss": "^8.5.34",
|
||||||
|
"rolldown": "~1.3.4",
|
||||||
|
"tinyglobby": "^0.2.17"
|
||||||
|
},
|
||||||
|
"bin": {
|
||||||
|
"vite": "bin/vite.js"
|
||||||
|
},
|
||||||
|
"engines": {
|
||||||
|
"node": "^20.19.0 || >=22.12.0"
|
||||||
|
},
|
||||||
|
"funding": {
|
||||||
|
"url": "https://github.com/vitejs/vite?sponsor=1"
|
||||||
|
},
|
||||||
|
"optionalDependencies": {
|
||||||
|
"fsevents": "~2.3.3",
|
||||||
|
"napi-windows-process-start-time": "^0.1.0"
|
||||||
|
},
|
||||||
|
"peerDependencies": {
|
||||||
|
"@types/node": "^20.19.0 || >=22.12.0",
|
||||||
|
"@vitejs/devtools": "^0.7.1 || ^0.8.0",
|
||||||
|
"esbuild": "^0.27.0 || ^0.28.0",
|
||||||
|
"jiti": ">=1.21.0",
|
||||||
|
"less": "^4.0.0",
|
||||||
|
"sass": "^1.70.0",
|
||||||
|
"sass-embedded": "^1.70.0",
|
||||||
|
"stylus": ">=0.54.8",
|
||||||
|
"sugarss": "^5.0.0",
|
||||||
|
"terser": "^5.16.0",
|
||||||
|
"tsx": "^4.8.1",
|
||||||
|
"yaml": "^2.4.2"
|
||||||
|
},
|
||||||
|
"peerDependenciesMeta": {
|
||||||
|
"@types/node": {
|
||||||
|
"optional": true
|
||||||
|
},
|
||||||
|
"@vitejs/devtools": {
|
||||||
|
"optional": true
|
||||||
|
},
|
||||||
|
"esbuild": {
|
||||||
|
"optional": true
|
||||||
|
},
|
||||||
|
"jiti": {
|
||||||
|
"optional": true
|
||||||
|
},
|
||||||
|
"less": {
|
||||||
|
"optional": true
|
||||||
|
},
|
||||||
|
"sass": {
|
||||||
|
"optional": true
|
||||||
|
},
|
||||||
|
"sass-embedded": {
|
||||||
|
"optional": true
|
||||||
|
},
|
||||||
|
"stylus": {
|
||||||
|
"optional": true
|
||||||
|
},
|
||||||
|
"sugarss": {
|
||||||
|
"optional": true
|
||||||
|
},
|
||||||
|
"terser": {
|
||||||
|
"optional": true
|
||||||
|
},
|
||||||
|
"tsx": {
|
||||||
|
"optional": true
|
||||||
|
},
|
||||||
|
"yaml": {
|
||||||
|
"optional": true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
19
package.json
Normal file
19
package.json
Normal file
@@ -0,0 +1,19 @@
|
|||||||
|
{
|
||||||
|
"name": "ofsaver",
|
||||||
|
"private": true,
|
||||||
|
"version": "1.0.0",
|
||||||
|
"type": "module",
|
||||||
|
"scripts": {
|
||||||
|
"dev": "vite",
|
||||||
|
"build": "vite build",
|
||||||
|
"preview": "vite preview"
|
||||||
|
},
|
||||||
|
"dependencies": {
|
||||||
|
"react": "^19.3.1",
|
||||||
|
"react-dom": "^19.3.1"
|
||||||
|
},
|
||||||
|
"devDependencies": {
|
||||||
|
"@vitejs/plugin-react": "^6.3.1",
|
||||||
|
"vite": "^8.4.1"
|
||||||
|
}
|
||||||
|
}
|
||||||
BIN
public/apple-touch-icon.png
Normal file
BIN
public/apple-touch-icon.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 4.6 KiB |
8
public/assets/app-icon.svg
Normal file
8
public/assets/app-icon.svg
Normal file
@@ -0,0 +1,8 @@
|
|||||||
|
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 256 256">
|
||||||
|
<rect width="256" height="256" rx="60" fill="#0a1824"/>
|
||||||
|
<g transform="translate(32 32) scale(8)">
|
||||||
|
<path d="M8.75 10.75V7.75a3.25 3.25 0 0 1 6.4-.8" fill="none" stroke="#ffffff" stroke-width="1.8" stroke-linecap="round"/>
|
||||||
|
<rect x="5.25" y="10.75" width="13.5" height="9.75" rx="2.6" fill="none" stroke="#ffffff" stroke-width="1.8"/>
|
||||||
|
<circle cx="12" cy="15.6" r="1.6" fill="#02aff2"/>
|
||||||
|
</g>
|
||||||
|
</svg>
|
||||||
|
After Width: | Height: | Size: 476 B |
5
public/assets/logo-light.svg
Normal file
5
public/assets/logo-light.svg
Normal file
@@ -0,0 +1,5 @@
|
|||||||
|
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24">
|
||||||
|
<path d="M8.75 10.75V7.75a3.25 3.25 0 0 1 6.4-.8" fill="none" stroke="#ffffff" stroke-width="1.8" stroke-linecap="round"/>
|
||||||
|
<rect x="5.25" y="10.75" width="13.5" height="9.75" rx="2.6" fill="none" stroke="#ffffff" stroke-width="1.8"/>
|
||||||
|
<circle cx="12" cy="15.6" r="1.6" fill="#02aff2"/>
|
||||||
|
</svg>
|
||||||
|
After Width: | Height: | Size: 359 B |
5
public/assets/logo.svg
Normal file
5
public/assets/logo.svg
Normal file
@@ -0,0 +1,5 @@
|
|||||||
|
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24">
|
||||||
|
<path d="M8.75 10.75V7.75a3.25 3.25 0 0 1 6.4-.8" fill="none" stroke="#0b1620" stroke-width="1.8" stroke-linecap="round"/>
|
||||||
|
<rect x="5.25" y="10.75" width="13.5" height="9.75" rx="2.6" fill="none" stroke="#0b1620" stroke-width="1.8"/>
|
||||||
|
<circle cx="12" cy="15.6" r="1.6" fill="#02aff2"/>
|
||||||
|
</svg>
|
||||||
|
After Width: | Height: | Size: 359 B |
BIN
public/favicon.png
Normal file
BIN
public/favicon.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 945 B |
BIN
public/ofsaver-extension.zip
Normal file
BIN
public/ofsaver-extension.zip
Normal file
Binary file not shown.
BIN
public/og.png
Normal file
BIN
public/og.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 14 KiB |
26
src/App.jsx
Normal file
26
src/App.jsx
Normal file
@@ -0,0 +1,26 @@
|
|||||||
|
import { Nav, Hero, Platforms, FactBand, Compare, Mobile, Showcase, Features, Safety, Pricing, Reviews, Faq, Cta, Footer } from './components/Sections.jsx'
|
||||||
|
import { Install } from './components/Install.jsx'
|
||||||
|
|
||||||
|
export default function App() {
|
||||||
|
return (
|
||||||
|
<>
|
||||||
|
<Nav />
|
||||||
|
<main>
|
||||||
|
<Hero />
|
||||||
|
<Platforms />
|
||||||
|
<FactBand />
|
||||||
|
<Compare />
|
||||||
|
<Showcase />
|
||||||
|
<Features />
|
||||||
|
<Mobile />
|
||||||
|
<Safety />
|
||||||
|
<Pricing />
|
||||||
|
<Install />
|
||||||
|
<Reviews />
|
||||||
|
<Faq />
|
||||||
|
<Cta />
|
||||||
|
</main>
|
||||||
|
<Footer />
|
||||||
|
</>
|
||||||
|
)
|
||||||
|
}
|
||||||
63
src/components/Hairline.jsx
Normal file
63
src/components/Hairline.jsx
Normal file
@@ -0,0 +1,63 @@
|
|||||||
|
import { useEffect, useRef } from 'react'
|
||||||
|
import kernelSrc from '../hairline/kernel.js?raw'
|
||||||
|
|
||||||
|
/* ------------------------------------------------------------------------
|
||||||
|
* Mounts a Hairline figure the way the package's bench does. The kernel and
|
||||||
|
* the figure stay byte for byte what the hairline tools build and check, so
|
||||||
|
* they are loaded as text and run here rather than edited into modules.
|
||||||
|
* --------------------------------------------------------------------- */
|
||||||
|
|
||||||
|
let HL = null
|
||||||
|
let injected = false
|
||||||
|
const kernel = () => (HL ??= new Function(`${kernelSrc}\nreturn HL;`)())
|
||||||
|
|
||||||
|
function load(src) {
|
||||||
|
let figure = null
|
||||||
|
new Function('HL', 'hairline', src)(kernel(), (f) => { figure = f })
|
||||||
|
return figure
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* `value` is the figure's own number (its slider), defaulting to the middle
|
||||||
|
* of its range. `zone` is a selector for an ancestor whose pointer moves are passed on to
|
||||||
|
* the figure, so it can answer a pointer that is still on its way.
|
||||||
|
*/
|
||||||
|
export function HairlineFigure({ src, zone, value, className = '' }) {
|
||||||
|
const stageRef = useRef(null)
|
||||||
|
const readRef = useRef(null)
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
const stage = stageRef.current
|
||||||
|
const fig = load(src)
|
||||||
|
const hl = kernel()
|
||||||
|
if (!injected) { hl.inject(document); injected = true }
|
||||||
|
stage.setAttribute('data-hairline', fig.name)
|
||||||
|
stage.setAttribute('aria-label', fig.means)
|
||||||
|
const svg = hl.mk('svg', { viewBox: '0 0 400 320', 'aria-hidden': 'true' }, stage)
|
||||||
|
const read = { set textContent(v) { if (readRef.current) readRef.current.textContent = v ?? '' } }
|
||||||
|
const handle = fig.mount({ stage, svg, read }, value ?? fig.range[1])
|
||||||
|
|
||||||
|
const area = zone ? stage.closest(zone) : null
|
||||||
|
const pass = (type) => (e) => {
|
||||||
|
if (!e.isTrusted || stage.contains(e.target)) return
|
||||||
|
stage.dispatchEvent(new PointerEvent(type, { pointerType: e.pointerType, pointerId: e.pointerId, clientX: e.clientX, clientY: e.clientY }))
|
||||||
|
}
|
||||||
|
const onMove = pass('pointermove'), onLeave = pass('pointerleave')
|
||||||
|
area?.addEventListener('pointermove', onMove)
|
||||||
|
area?.addEventListener('pointerleave', onLeave)
|
||||||
|
|
||||||
|
return () => {
|
||||||
|
area?.removeEventListener('pointermove', onMove)
|
||||||
|
area?.removeEventListener('pointerleave', onLeave)
|
||||||
|
handle.destroy()
|
||||||
|
svg.remove()
|
||||||
|
}
|
||||||
|
}, [src, zone, value])
|
||||||
|
|
||||||
|
return (
|
||||||
|
<div className={`hairline ${className}`}>
|
||||||
|
<div ref={stageRef} className="hairline__stage" role="img" />
|
||||||
|
<span ref={readRef} className="hairline__read mono" aria-hidden="true" />
|
||||||
|
</div>
|
||||||
|
)
|
||||||
|
}
|
||||||
94
src/components/Icons.jsx
Normal file
94
src/components/Icons.jsx
Normal file
@@ -0,0 +1,94 @@
|
|||||||
|
// Line icons in the lucide style: 24 grid, 1.5 stroke, currentColor.
|
||||||
|
function Line({ size = 16, children, ...rest }) {
|
||||||
|
return (
|
||||||
|
<svg
|
||||||
|
width={size}
|
||||||
|
height={size}
|
||||||
|
viewBox="0 0 24 24"
|
||||||
|
fill="none"
|
||||||
|
stroke="currentColor"
|
||||||
|
strokeWidth="1.5"
|
||||||
|
strokeLinecap="round"
|
||||||
|
strokeLinejoin="round"
|
||||||
|
aria-hidden="true"
|
||||||
|
{...rest}
|
||||||
|
>
|
||||||
|
{children}
|
||||||
|
</svg>
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
export const DownloadIcon = (p) => (
|
||||||
|
<Line {...p}><path d="M12 15V3" /><path d="m7 10 5 5 5-5" /><path d="M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4" /></Line>
|
||||||
|
)
|
||||||
|
|
||||||
|
export const LockIcon = (p) => (
|
||||||
|
<Line {...p}><rect x="3" y="11" width="18" height="11" rx="2" /><path d="M7 11V7a5 5 0 0 1 10 0v4" /></Line>
|
||||||
|
)
|
||||||
|
|
||||||
|
export const LayersIcon = (p) => (
|
||||||
|
<Line {...p}>
|
||||||
|
<path d="m12.83 2.18a2 2 0 0 0-1.66 0L2.6 6.08a1 1 0 0 0 0 1.83l8.58 3.91a2 2 0 0 0 1.66 0l8.58-3.9a1 1 0 0 0 0-1.83z" />
|
||||||
|
<path d="m2 12 9.17 4.17a2 2 0 0 0 1.66 0L22 12" />
|
||||||
|
<path d="m2 17 9.17 4.17a2 2 0 0 0 1.66 0L22 17" />
|
||||||
|
</Line>
|
||||||
|
)
|
||||||
|
|
||||||
|
export const CheckIcon = (p) => (
|
||||||
|
<Line {...p}><path d="M20 6 9 17l-5-5" /></Line>
|
||||||
|
)
|
||||||
|
|
||||||
|
export const HeartIcon = (p) => (
|
||||||
|
<Line {...p}><path d="M19 14c1.49-1.46 3-3.21 3-5.5A5.5 5.5 0 0 0 16.5 3c-1.76 0-3 .5-4.5 2-1.5-1.5-2.74-2-4.5-2A5.5 5.5 0 0 0 2 8.5c0 2.3 1.5 4.05 3 5.5l7 7Z" /></Line>
|
||||||
|
)
|
||||||
|
|
||||||
|
export const MessageIcon = (p) => (
|
||||||
|
<Line {...p}><path d="M7.9 20A9 9 0 1 0 4 16.1L2 22Z" /></Line>
|
||||||
|
)
|
||||||
|
|
||||||
|
export const ChevronDownIcon = (p) => (
|
||||||
|
<Line {...p}><path d="m6 9 6 6 6-6" /></Line>
|
||||||
|
)
|
||||||
|
|
||||||
|
export const FolderIcon = (p) => (
|
||||||
|
<Line {...p}><path d="M20 20a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.69-.9L9.6 3.9A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2Z" /></Line>
|
||||||
|
)
|
||||||
|
|
||||||
|
export const FileIcon = (p) => (
|
||||||
|
<Line {...p}><path d="M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z" /><path d="M14 2v4a2 2 0 0 0 2 2h4" /></Line>
|
||||||
|
)
|
||||||
|
|
||||||
|
export const XIcon = (p) => (
|
||||||
|
<Line {...p}><path d="M18 6 6 18" /><path d="m6 6 12 12" /></Line>
|
||||||
|
)
|
||||||
|
|
||||||
|
export const GlobeIcon = (p) => (
|
||||||
|
<Line {...p}><circle cx="12" cy="12" r="10" /><path d="M12 2a14.5 14.5 0 0 0 0 20 14.5 14.5 0 0 0 0-20" /><path d="M2 12h20" /></Line>
|
||||||
|
)
|
||||||
|
|
||||||
|
export const CpuIcon = (p) => (
|
||||||
|
<Line {...p}><rect x="4" y="4" width="16" height="16" rx="2" /><rect x="9" y="9" width="6" height="6" rx="1" /><path d="M15 2v2M15 20v2M2 15h2M2 9h2M20 15h2M20 9h2M9 2v2M9 20v2" /></Line>
|
||||||
|
)
|
||||||
|
|
||||||
|
export const DriveIcon = (p) => (
|
||||||
|
<Line {...p}><path d="M22 12H2" /><path d="M5.45 5.11 2 12v6a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2v-6l-3.45-6.89A2 2 0 0 0 16.76 4H7.24a2 2 0 0 0-1.79 1.11z" /><path d="M6 16h.01M10 16h.01" /></Line>
|
||||||
|
)
|
||||||
|
|
||||||
|
export const ServerIcon = (p) => (
|
||||||
|
<Line {...p}><rect x="2" y="2" width="20" height="8" rx="2" /><rect x="2" y="14" width="20" height="8" rx="2" /><path d="M6 6h.01M6 18h.01" /></Line>
|
||||||
|
)
|
||||||
|
|
||||||
|
export const PuzzleIcon = (p) => (
|
||||||
|
<Line {...p}><path d="M15.39 4.39a1 1 0 0 0 1.68-.47 2.5 2.5 0 1 1 3.01 3.01 1 1 0 0 0-.47 1.68l1.69 1.69a2.4 2.4 0 0 1 0 3.4l-1.61 1.61a.98.98 0 0 1-.84.28c-.47-.07-.8-.48-.97-.92a2.5 2.5 0 1 0-3.21 3.21c.44.17.85.5.92.97a.98.98 0 0 1-.28.84l-1.61 1.61a2.4 2.4 0 0 1-3.4 0L8.3 19.61a1 1 0 0 0-1.68.47 2.5 2.5 0 1 1-3.01-3.01 1 1 0 0 0 .47-1.68L2.39 13.7a2.4 2.4 0 0 1 0-3.4l1.61-1.61a.98.98 0 0 1 .84-.28c.47.07.8.48.97.92a2.5 2.5 0 1 0 3.21-3.21c-.44-.17-.85-.5-.92-.97a.98.98 0 0 1 .28-.84l1.61-1.61a2.4 2.4 0 0 1 3.4 0z" /></Line>
|
||||||
|
)
|
||||||
|
|
||||||
|
export const PhoneIcon = (p) => (
|
||||||
|
<Line {...p}><rect x="6" y="2" width="12" height="20" rx="2.5" /><path d="M11 18h2" /></Line>
|
||||||
|
)
|
||||||
|
|
||||||
|
export const PlusMinus = ({ open }) => (
|
||||||
|
<svg width="16" height="16" viewBox="0 0 16 16" stroke="currentColor" strokeWidth="1.5" strokeLinecap="round" aria-hidden="true">
|
||||||
|
<path d="M2.5 8h11" />
|
||||||
|
<path d="M8 2.5v11" className={`pm-v ${open ? 'is-open' : ''}`} />
|
||||||
|
</svg>
|
||||||
|
)
|
||||||
150
src/components/Install.jsx
Normal file
150
src/components/Install.jsx
Normal file
@@ -0,0 +1,150 @@
|
|||||||
|
import { Reveal, AddToChrome, SectionHeading } from './Shared.jsx'
|
||||||
|
import { useLoop, Cursor } from './Scenes.jsx'
|
||||||
|
import { CheckIcon, DownloadIcon, FolderIcon, PuzzleIcon } from './Icons.jsx'
|
||||||
|
|
||||||
|
/* ------------------------------------------------------------------------
|
||||||
|
* Install: three steps, each with a small looping illustration built in
|
||||||
|
* code. Reduced motion holds each scene on its finished frame.
|
||||||
|
* --------------------------------------------------------------------- */
|
||||||
|
|
||||||
|
const ZipIcon = ({ size = 16 }) => (
|
||||||
|
<svg width={size} height={size} viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="1.5" strokeLinecap="round" strokeLinejoin="round" aria-hidden="true">
|
||||||
|
<path d="M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z" />
|
||||||
|
<path d="M14 2v6h6" />
|
||||||
|
<path d="M10 6h1M10 9h1M10 12h1M10 15h1" />
|
||||||
|
</svg>
|
||||||
|
)
|
||||||
|
|
||||||
|
function Window({ url, children }) {
|
||||||
|
return (
|
||||||
|
<div className="iw">
|
||||||
|
<div className="iw__bar"><i /><i /><i /><span className="mono">{url}</span></div>
|
||||||
|
<div className="iw__body">{children}</div>
|
||||||
|
</div>
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
/* 1. Download the zip, then unzip it into an ofsaver folder */
|
||||||
|
const DL_STEPS = [['idle', 700], ['saving', 1600], ['zip', 1000], ['unzipped', 2600]]
|
||||||
|
|
||||||
|
function DownloadScene() {
|
||||||
|
const [ref, phase] = useLoop(DL_STEPS, 'unzipped')
|
||||||
|
const at = DL_STEPS.findIndex(([n]) => n === phase)
|
||||||
|
const done = at >= 2
|
||||||
|
return (
|
||||||
|
<div ref={ref} className="scene">
|
||||||
|
<Window url="ofsaver.app">
|
||||||
|
<div className={`dl__btn ${phase === 'idle' ? '' : 'is-pressed'}`}>
|
||||||
|
<DownloadIcon size={14} /> Add to Chrome <span className="kpill__meta">Free</span>
|
||||||
|
</div>
|
||||||
|
<div className={`dl__shelf ${at >= 1 ? 'is-in' : ''}`}>
|
||||||
|
<div className="dl__row">
|
||||||
|
<span className="dl__icon"><ZipIcon /></span>
|
||||||
|
<span className="dl__name">
|
||||||
|
<strong>ofsaver-extension.zip</strong>
|
||||||
|
<span className="mono">{done ? 'Done · 1.4 MB' : 'Downloading…'}</span>
|
||||||
|
</span>
|
||||||
|
<span className={`dl__track ${phase === 'saving' ? 'is-running' : ''} ${done ? 'is-full' : ''}`}><span /></span>
|
||||||
|
</div>
|
||||||
|
<div className={`dl__row dl__row--folder ${phase === 'unzipped' ? 'is-in' : ''}`}>
|
||||||
|
<span className="dl__icon dl__icon--folder"><FolderIcon /></span>
|
||||||
|
<span className="dl__name">
|
||||||
|
<strong>ofsaver</strong>
|
||||||
|
<span className="mono">Unzipped, keep this folder</span>
|
||||||
|
</span>
|
||||||
|
<CheckIcon size={16} className="dl__ok" />
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</Window>
|
||||||
|
</div>
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
/* 2. Turn on Developer mode in chrome://extensions */
|
||||||
|
const DEV_STEPS = [['idle', 900], ['aim', 700], ['press', 300], ['on', 2800]]
|
||||||
|
|
||||||
|
function DevModeScene() {
|
||||||
|
const [ref, phase] = useLoop(DEV_STEPS, 'on')
|
||||||
|
const on = phase === 'on'
|
||||||
|
return (
|
||||||
|
<div ref={ref} className="scene">
|
||||||
|
<Window url="chrome://extensions">
|
||||||
|
<div className="ext__head">
|
||||||
|
<span className="ext__title"><PuzzleIcon size={16} /> Extensions</span>
|
||||||
|
<span className="ext__dev">
|
||||||
|
Developer mode
|
||||||
|
<span className={`toggle ${on ? 'is-on' : ''}`}><span /></span>
|
||||||
|
</span>
|
||||||
|
</div>
|
||||||
|
<div className={`ext__tools ${on ? 'is-in' : ''}`}>
|
||||||
|
<span className="ext__tool">Load unpacked</span>
|
||||||
|
<span className="ext__tool">Pack extension</span>
|
||||||
|
<span className="ext__tool">Update</span>
|
||||||
|
</div>
|
||||||
|
<div className="ext__ghost"><span /><span /></div>
|
||||||
|
<Cursor className={`dev__cursor is-${phase}`} />
|
||||||
|
</Window>
|
||||||
|
</div>
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
/* 3. Drag the ofsaver folder onto the page */
|
||||||
|
const DROP_STEPS = [['idle', 800], ['lift', 500], ['drag', 1100], ['drop', 500], ['installed', 2800]]
|
||||||
|
|
||||||
|
function DropScene() {
|
||||||
|
const [ref, phase] = useLoop(DROP_STEPS, 'installed')
|
||||||
|
const installed = phase === 'installed'
|
||||||
|
return (
|
||||||
|
<div ref={ref} className="scene">
|
||||||
|
<Window url="chrome://extensions">
|
||||||
|
<div className={`drop__zone ${phase === 'drag' || phase === 'drop' ? 'is-hot' : ''} ${installed ? 'is-gone' : ''}`}>
|
||||||
|
<span>Drop to install</span>
|
||||||
|
</div>
|
||||||
|
<div className={`ext__card ${installed ? 'is-in' : ''}`}>
|
||||||
|
<img src="/assets/app-icon.svg" alt="" width="32" height="32" />
|
||||||
|
<span className="ext__card-name">
|
||||||
|
<strong>ofsaver <span className="mono">1.0.0</span></strong>
|
||||||
|
<span>Saves posts and messages</span>
|
||||||
|
</span>
|
||||||
|
<span className="toggle is-on"><span /></span>
|
||||||
|
</div>
|
||||||
|
<div className={`drag__chip is-${phase}`} aria-hidden="true">
|
||||||
|
<FolderIcon size={16} /> ofsaver
|
||||||
|
<Cursor className="drag__cursor" />
|
||||||
|
</div>
|
||||||
|
</Window>
|
||||||
|
</div>
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
const STEPS = [
|
||||||
|
{ title: 'Download and unzip', body: 'Click Add to Chrome to get ofsaver-extension.zip, then unzip it. Keep the ofsaver folder somewhere it will stay.', Scene: DownloadScene },
|
||||||
|
{ title: 'Turn on Developer mode', body: 'Open chrome://extensions and flip the Developer mode switch in the top right corner.', Scene: DevModeScene },
|
||||||
|
{ title: 'Drag the folder in', body: 'Drop the ofsaver folder onto the extensions page. That is it, the Download pill shows up on your next visit.', Scene: DropScene },
|
||||||
|
]
|
||||||
|
|
||||||
|
export function Install() {
|
||||||
|
return (
|
||||||
|
<section className="install container" id="install">
|
||||||
|
<SectionHeading eyebrow="Install" muted="Three steps" strong="about a minute" />
|
||||||
|
<ol className="install__grid">
|
||||||
|
{STEPS.map(({ title, body, Scene }, i) => (
|
||||||
|
<Reveal as="li" key={title} delay={i * 60} className="install__step">
|
||||||
|
<div className="install__media"><Scene /></div>
|
||||||
|
<div className="install__copy">
|
||||||
|
<span className="install__n mono">0{i + 1}</span>
|
||||||
|
<h3>{title}</h3>
|
||||||
|
<p>{body}</p>
|
||||||
|
</div>
|
||||||
|
</Reveal>
|
||||||
|
))}
|
||||||
|
</ol>
|
||||||
|
<Reveal className="install__foot">
|
||||||
|
<AddToChrome />
|
||||||
|
<p className="install__note">
|
||||||
|
Works in Chrome, Brave and Arc. If dropping does nothing, click <strong>Load unpacked</strong> and pick the ofsaver folder.
|
||||||
|
</p>
|
||||||
|
</Reveal>
|
||||||
|
</section>
|
||||||
|
)
|
||||||
|
}
|
||||||
319
src/components/Scenes.jsx
Normal file
319
src/components/Scenes.jsx
Normal file
@@ -0,0 +1,319 @@
|
|||||||
|
import { useEffect, useRef, useState } from 'react'
|
||||||
|
import { DownloadIcon, CheckIcon, LockIcon, FolderIcon, FileIcon, HeartIcon, MessageIcon } from './Icons.jsx'
|
||||||
|
|
||||||
|
/* ------------------------------------------------------------------------
|
||||||
|
* Product scenes: small loops of ofsaver's real UI, built in code. Each runs
|
||||||
|
* only while on screen, and holds one representative still frame for people
|
||||||
|
* who prefer reduced motion.
|
||||||
|
* --------------------------------------------------------------------- */
|
||||||
|
|
||||||
|
const reduced = () => matchMedia('(prefers-reduced-motion: reduce)').matches
|
||||||
|
|
||||||
|
/** Cycles through [name, ms] steps while the element is visible. */
|
||||||
|
export function useLoop(steps, still) {
|
||||||
|
const ref = useRef(null)
|
||||||
|
const [i, setI] = useState(-1)
|
||||||
|
const [visible, setVisible] = useState(false)
|
||||||
|
useEffect(() => {
|
||||||
|
const io = new IntersectionObserver(([e]) => setVisible(e.isIntersecting), { threshold: 0.35 })
|
||||||
|
io.observe(ref.current)
|
||||||
|
return () => io.disconnect()
|
||||||
|
}, [])
|
||||||
|
useEffect(() => {
|
||||||
|
if (!visible || reduced()) return
|
||||||
|
let k = 0, t
|
||||||
|
const next = () => {
|
||||||
|
setI(k)
|
||||||
|
t = setTimeout(next, steps[k][1])
|
||||||
|
k = (k + 1) % steps.length
|
||||||
|
}
|
||||||
|
t = setTimeout(next, 300)
|
||||||
|
return () => clearTimeout(t)
|
||||||
|
}, [visible])
|
||||||
|
const name = i < 0 ? still : steps[i][0]
|
||||||
|
return [ref, name]
|
||||||
|
}
|
||||||
|
|
||||||
|
/** Counts from 0 to `to` over `ms` while `on`; snaps to `to` when not animating. */
|
||||||
|
function useCount(to, ms, on, rest = to) {
|
||||||
|
const [v, setV] = useState(rest)
|
||||||
|
useEffect(() => {
|
||||||
|
if (!on) { setV(rest); return }
|
||||||
|
let raf
|
||||||
|
const t0 = performance.now()
|
||||||
|
const tick = (now) => {
|
||||||
|
const k = Math.min(1, (now - t0) / ms)
|
||||||
|
setV(Math.round(to * (1 - Math.pow(1 - k, 2))))
|
||||||
|
if (k < 1) raf = requestAnimationFrame(tick)
|
||||||
|
}
|
||||||
|
setV(0)
|
||||||
|
raf = requestAnimationFrame(tick)
|
||||||
|
return () => cancelAnimationFrame(raf)
|
||||||
|
}, [on, to, ms, rest])
|
||||||
|
return v
|
||||||
|
}
|
||||||
|
|
||||||
|
export const Cursor = ({ className = '', style }) => (
|
||||||
|
<svg style={style} className={`cursor ${className}`} width="18" height="18" viewBox="0 0 24 24" aria-hidden="true">
|
||||||
|
<path d="M4 2.5 19.5 11l-6.6 1.9L9.6 19.5z" fill="#0b1620" stroke="#fff" strokeWidth="1.5" strokeLinejoin="round" />
|
||||||
|
</svg>
|
||||||
|
)
|
||||||
|
|
||||||
|
const Ring = ({ pct }) => (
|
||||||
|
<svg className="ring" width="16" height="16" viewBox="0 0 16 16" aria-hidden="true">
|
||||||
|
<circle cx="8" cy="8" r="6" pathLength="100" className="ring__track" />
|
||||||
|
<circle cx="8" cy="8" r="6" pathLength="100" className="ring__fill" style={{ strokeDashoffset: 100 - pct }} />
|
||||||
|
</svg>
|
||||||
|
)
|
||||||
|
|
||||||
|
const TipIcon = (p) => (
|
||||||
|
<svg width={p.size || 18} height={p.size || 18} viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="1.5" strokeLinecap="round" aria-hidden="true">
|
||||||
|
<circle cx="12" cy="12" r="9" /><path d="M15 9.5c-.5-1-1.6-1.5-3-1.5-1.7 0-3 .8-3 2s1.3 1.7 3 2 3 .9 3 2.1-1.3 1.9-3 1.9c-1.4 0-2.6-.6-3-1.6M12 6.5v1.5m0 8v1.5" />
|
||||||
|
</svg>
|
||||||
|
)
|
||||||
|
|
||||||
|
/* Warm stand-ins for photos: each is a soft light falling on a coloured ground. */
|
||||||
|
const SHOTS = [
|
||||||
|
['#e8c3a5', '#9c6a52'], ['#cdd5d0', '#71857e'], ['#e6d5bd', '#b08c66'], ['#d9c4cb', '#8f7480'],
|
||||||
|
['#c9b6a6', '#6b5446'], ['#dfe0d6', '#9a9c84'], ['#e9cfb8', '#c08a67'], ['#c8ccd6', '#727a8f'],
|
||||||
|
['#d7bfa9', '#86624f'], ['#e3d9cf', '#a3907c'], ['#cfc2b3', '#7c6a5a'], ['#e5c8c0', '#a8736a'],
|
||||||
|
]
|
||||||
|
const shot = (k) => ({ background: `radial-gradient(120% 90% at 70% 20%, ${SHOTS[k % 12][0]}, ${SHOTS[k % 12][1]})` })
|
||||||
|
|
||||||
|
/* ======================= Feature: right in the toolbar ==================== */
|
||||||
|
const TOOLBAR = [['idle', 1100], ['aim', 700], ['press', 250], ['saving', 2100], ['saved', 2300]]
|
||||||
|
|
||||||
|
export function ToolbarScene() {
|
||||||
|
const [ref, phase] = useLoop(TOOLBAR, 'saved')
|
||||||
|
const pct = useCount(100, 1900, phase === 'saving', 100)
|
||||||
|
const saved = phase === 'saved'
|
||||||
|
const busy = phase === 'saving'
|
||||||
|
return (
|
||||||
|
<div ref={ref} className="scene tb" aria-label="A post's action bar with ofsaver's Download pill saving a video">
|
||||||
|
<div className="tb__post">
|
||||||
|
<div className="tb__media" style={shot(0)}><span className="mono tb__dur">04:12</span></div>
|
||||||
|
<div className="tb__bar">
|
||||||
|
<span className="tb__icons"><HeartIcon size={18} /><MessageIcon size={18} /><TipIcon /></span>
|
||||||
|
<span className={`kpill ${saved ? 'kpill--saved' : ''} ${phase === 'press' ? 'is-pressed' : ''}`}>
|
||||||
|
{saved ? <CheckIcon size={15} /> : busy ? <Ring pct={pct} /> : <DownloadIcon size={15} />}
|
||||||
|
<span className="kpill__label">{saved ? 'Saved' : busy ? `Saving ${pct}%` : 'Download'}</span>
|
||||||
|
<span className="mono kpill__meta">{saved ? 'rooftop.mp4' : '412 MB'}</span>
|
||||||
|
</span>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<Cursor className={`tb__cursor is-${phase}`} />
|
||||||
|
</div>
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
/* ========================= Feature: pick your quality ===================== */
|
||||||
|
const QUALITIES = [
|
||||||
|
{ name: 'Source', res: '1080p', mb: 412 },
|
||||||
|
{ name: '720p', res: '720p', mb: 188 },
|
||||||
|
{ name: 'Preview', res: '480p', mb: 64 },
|
||||||
|
]
|
||||||
|
const QUALITY = [['q0', 1600], ['q1', 1600], ['q2', 1600], ['q1', 1200]]
|
||||||
|
|
||||||
|
export function QualityScene() {
|
||||||
|
const [ref, phase] = useLoop(QUALITY, 'q1')
|
||||||
|
const at = Number(phase.slice(1))
|
||||||
|
return (
|
||||||
|
<div ref={ref} className="scene qs" aria-label="The quality menu, with each option's file size drawn to scale">
|
||||||
|
<div className="qs__menu">
|
||||||
|
<div className="qs__label">Quality <span className="mono">rooftop · 04:12</span></div>
|
||||||
|
{QUALITIES.map((q, i) => (
|
||||||
|
<div key={q.name} className={`qs__row ${i === at ? 'is-active' : ''}`}>
|
||||||
|
<span className="qs__name">{q.name}</span>
|
||||||
|
<span className="qs__track"><span style={{ transform: `scaleX(${q.mb / 412})` }} /></span>
|
||||||
|
<span className="mono qs__size">{q.mb} MB</span>
|
||||||
|
</div>
|
||||||
|
))}
|
||||||
|
<div className="qs__out mono">
|
||||||
|
<FileIcon size={14} />
|
||||||
|
<span key={at} className="qs__file">rooftop_{QUALITIES[at].res}.mp4</span>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<Cursor className="qs__cursor" style={{ transform: `translateY(${at * 44}px)` }} />
|
||||||
|
</div>
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
/* ======================= Feature: whole profiles in one go ================ */
|
||||||
|
const GRID = Array.from({ length: 12 }, (_, k) => ({
|
||||||
|
k, video: [1, 4, 6, 11].includes(k), locked: [4, 9].includes(k), order: (k % 4) + Math.floor(k / 4),
|
||||||
|
}))
|
||||||
|
const PROFILE = [['idle', 1200], ['press', 300], ['saving', 2600], ['done', 2400]]
|
||||||
|
|
||||||
|
export function ProfileScene() {
|
||||||
|
const [ref, phase] = useLoop(PROFILE, 'done')
|
||||||
|
const saving = phase === 'saving'
|
||||||
|
const n = useCount(12, 2300, saving, phase === 'done' ? 12 : 0)
|
||||||
|
const doneCount = phase === 'done' ? 12 : n
|
||||||
|
return (
|
||||||
|
<div ref={ref} className="scene pf" aria-label="A creator's media grid being saved tile by tile">
|
||||||
|
<div className="pf__head">
|
||||||
|
<span className="pf__avatar" />
|
||||||
|
<span className="pf__who"><strong>Mira Lane</strong><span className="mono">1,284 posts</span></span>
|
||||||
|
<span className={`kbtn ${phase === 'press' ? 'is-pressed' : ''} ${phase === 'done' ? 'kbtn--done' : ''}`}>
|
||||||
|
{phase === 'done' ? <CheckIcon size={14} /> : <DownloadIcon size={14} />}
|
||||||
|
<span className="mono">{phase === 'idle' || phase === 'press' ? 'Download all' : phase === 'done' ? '12 saved' : `${doneCount} of 12`}</span>
|
||||||
|
</span>
|
||||||
|
</div>
|
||||||
|
<div className="pf__grid">
|
||||||
|
{GRID.map((t) => {
|
||||||
|
const isSaved = phase === 'done' || (saving && t.order < (doneCount / 12) * 7)
|
||||||
|
return (
|
||||||
|
<div key={t.k} className={`pf__tile ${isSaved ? 'is-saved' : ''}`} style={shot(t.k + 3)}>
|
||||||
|
{t.video && <span className="mono pf__dur">{['0:48', '12:04', '3:31', '1:19'][[1, 4, 6, 11].indexOf(t.k)]}</span>}
|
||||||
|
{t.locked && <span className="pf__lock"><LockIcon size={12} /></span>}
|
||||||
|
<span className="pf__check"><CheckIcon size={12} /></span>
|
||||||
|
</div>
|
||||||
|
)
|
||||||
|
})}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
/* ====================== Feature: saved, and it stays marked =============== */
|
||||||
|
const TOKENS = [
|
||||||
|
{ t: '{creator}', v: 'Mira Lane' }, { sep: '/' },
|
||||||
|
{ t: '{type}', v: 'Videos' }, { sep: '/' },
|
||||||
|
{ t: '{date}', v: '2026-11-29' }, { sep: '_' },
|
||||||
|
{ t: '{name}', v: 'rooftop.mp4' },
|
||||||
|
]
|
||||||
|
const NAMING = [['tokens', 1200], ['r1', 450], ['r2', 450], ['r3', 450], ['r4', 700], ['file', 2600]]
|
||||||
|
const FILES = [
|
||||||
|
['2026-11-14_studio-tour.mp4', '286 MB'],
|
||||||
|
['2026-10-30_q-and-a.mp4', '1.2 GB'],
|
||||||
|
['2026-10-12_morning.mp4', '94 MB'],
|
||||||
|
]
|
||||||
|
|
||||||
|
export function NamingScene() {
|
||||||
|
const [ref, phase] = useLoop(NAMING, 'file')
|
||||||
|
const step = phase === 'tokens' ? 0 : phase === 'file' ? 4 : Number(phase.slice(1))
|
||||||
|
let tokenIndex = 0
|
||||||
|
return (
|
||||||
|
<div ref={ref} className="scene nm" aria-label="Naming tokens resolving into a file path, and the file landing in its folder">
|
||||||
|
<div className="nm__path mono">
|
||||||
|
{TOKENS.map((x, i) => {
|
||||||
|
if (x.sep) return <span key={i} className="nm__sep">{x.sep}</span>
|
||||||
|
tokenIndex += 1
|
||||||
|
const on = step >= tokenIndex
|
||||||
|
return (
|
||||||
|
<span key={i} className={`nm__tok ${on ? 'is-on' : ''}`}>
|
||||||
|
<span className="nm__from">{x.t}</span>
|
||||||
|
<span className="nm__to">{x.v}</span>
|
||||||
|
</span>
|
||||||
|
)
|
||||||
|
})}
|
||||||
|
</div>
|
||||||
|
<div className="nm__list">
|
||||||
|
<div className="nm__crumb"><FolderIcon size={14} /> <span>Mira Lane</span><span className="nm__slash">/</span><span>Videos</span></div>
|
||||||
|
<div className={`nm__row nm__row--new ${phase === 'file' ? 'is-in' : ''}`}>
|
||||||
|
<FileIcon size={14} /><span>2026-11-29_rooftop.mp4</span><span className="mono">412 MB</span><CheckIcon size={14} />
|
||||||
|
</div>
|
||||||
|
{FILES.map(([f, s]) => (
|
||||||
|
<div key={f} className="nm__row"><FileIcon size={14} /><span>{f}</span><span className="mono">{s}</span><CheckIcon size={14} /></div>
|
||||||
|
))}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
/* ============================ Showcase scenes ============================= */
|
||||||
|
const CHAT = [['idle', 1200], ['press', 300], ['saving', 2000], ['done', 2200]]
|
||||||
|
|
||||||
|
function ChatScene() {
|
||||||
|
const [ref, phase] = useLoop(CHAT, 'done')
|
||||||
|
const n = useCount(3, 1700, phase === 'saving', phase === 'done' ? 3 : 0)
|
||||||
|
const done = phase === 'done'
|
||||||
|
return (
|
||||||
|
<div ref={ref} className="scene ch">
|
||||||
|
<div className="ch__head"><span className="pf__avatar" /><strong>Mira Lane</strong><span className="ch__online" /> <span className="mono ch__meta">online</span></div>
|
||||||
|
<div className="ch__body">
|
||||||
|
<div className="ch__bubble">New set from the rooftop shoot, three of my favourites</div>
|
||||||
|
<div className="ch__media">
|
||||||
|
<div className="ch__tiles">
|
||||||
|
{[0, 1, 2].map((k) => (
|
||||||
|
<div key={k} className={`ch__tile ${done || n > k ? 'is-saved' : ''}`} style={shot(k + 6)}>
|
||||||
|
<span className="pf__check"><CheckIcon size={12} /></span>
|
||||||
|
</div>
|
||||||
|
))}
|
||||||
|
</div>
|
||||||
|
<div className="ch__actions">
|
||||||
|
<span className="mono ch__time">10:42</span>
|
||||||
|
<span className={`kpill kpill--sm ${done ? 'kpill--saved' : ''} ${phase === 'press' ? 'is-pressed' : ''}`}>
|
||||||
|
{done ? <CheckIcon size={14} /> : <DownloadIcon size={14} />}
|
||||||
|
<span className="kpill__label">{done ? 'Saved 3' : phase === 'saving' ? `Saving ${n} of 3` : 'Download all'}</span>
|
||||||
|
</span>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div className="ch__bubble ch__bubble--me">Thank you, saving these</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
const DRM_STEPS = [
|
||||||
|
['Read manifest', '38 ms'], ['Request license', '212 ms'], ['Decrypt video', '3.1 s'], ['Decrypt audio', '0.4 s'], ['Mux to mp4', '0.9 s'],
|
||||||
|
]
|
||||||
|
const DRM = [['s0', 500], ['s1', 650], ['s2', 650], ['s3', 650], ['s4', 650], ['s5', 2600]]
|
||||||
|
|
||||||
|
function DrmScene() {
|
||||||
|
const [ref, phase] = useLoop(DRM, 's5')
|
||||||
|
const at = Number(phase.slice(1))
|
||||||
|
return (
|
||||||
|
<div ref={ref} className="scene dr">
|
||||||
|
<div className="dr__video" style={shot(0)}>
|
||||||
|
<span className={`dr__badge ${at >= 5 ? 'is-open' : ''}`}><LockIcon size={13} /> {at >= 5 ? 'Decrypted' : 'Protected'}</span>
|
||||||
|
</div>
|
||||||
|
<ol className="dr__steps">
|
||||||
|
{DRM_STEPS.map(([label, ms], i) => (
|
||||||
|
<li key={label} className={i < at ? 'is-done' : i === at ? 'is-now' : ''}>
|
||||||
|
<span className="dr__dot">{i < at ? <CheckIcon size={12} /> : null}</span>
|
||||||
|
<span>{label}</span>
|
||||||
|
<span className="mono">{i < at ? ms : ''}</span>
|
||||||
|
</li>
|
||||||
|
))}
|
||||||
|
</ol>
|
||||||
|
<div className={`dr__file ${at >= 5 ? 'is-in' : ''}`}>
|
||||||
|
<FileIcon size={16} />
|
||||||
|
<span className="mono">rooftop.mp4</span>
|
||||||
|
<span className="mono dr__meta">1080p · 412 MB · plays anywhere</span>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
const BULK = [['run', 4200], ['done', 2200]]
|
||||||
|
const NAMES = ['2026-11-29_rooftop.mp4', '2026-11-28_photo-07.jpg', '2026-11-27_voice-note.m4a', '2026-11-25_photo-02.jpg', '2026-11-21_gym.mp4', '2026-11-19_photo-11.jpg']
|
||||||
|
|
||||||
|
function BulkScene() {
|
||||||
|
const [ref, phase] = useLoop(BULK, 'done')
|
||||||
|
const run = phase === 'run'
|
||||||
|
const total = useCount(1284, 4000, run, 1284)
|
||||||
|
const k = total / 1284
|
||||||
|
const types = [['Photos', 880], ['Videos', 362], ['Audio', 42]]
|
||||||
|
return (
|
||||||
|
<div ref={ref} className="scene bk">
|
||||||
|
<div className="bk__head"><span className="pf__avatar" /><span><strong>Archiving Mira Lane</strong><span className="mono">Downloads/Mira Lane</span></span></div>
|
||||||
|
<div className="bk__count mono">{total.toLocaleString('en-US')}<span> / 1,284</span></div>
|
||||||
|
<div className="bk__bar"><span style={{ transform: `scaleX(${k})` }} /></div>
|
||||||
|
<div className="bk__types">
|
||||||
|
{types.map(([name, n]) => (
|
||||||
|
<div key={name} className="bk__type">
|
||||||
|
<span>{name}</span>
|
||||||
|
<span className="bk__mini"><span style={{ transform: `scaleX(${k})` }} /></span>
|
||||||
|
<span className="mono">{Math.round(n * k)} / {n}</span>
|
||||||
|
</div>
|
||||||
|
))}
|
||||||
|
</div>
|
||||||
|
<div className="bk__now mono">
|
||||||
|
{phase === 'done' ? <><CheckIcon size={14} /> All 1,284 saved, 0 duplicates</> : <><DownloadIcon size={14} /> {NAMES[Math.floor(total / 37) % NAMES.length]}</>}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
export const SHOWCASE_SCENES = { pills: ChatScene, drm: DrmScene, bundle: BulkScene }
|
||||||
658
src/components/Sections.jsx
Normal file
658
src/components/Sections.jsx
Normal file
@@ -0,0 +1,658 @@
|
|||||||
|
import { useEffect, useRef, useState } from 'react'
|
||||||
|
import { NAV_LINKS, PLATFORMS, SHOWCASE_TABS, FREE_PLAN, STRUCK_PLANS, REVIEWS, FAQS } from '../data.js'
|
||||||
|
import { Reveal, AddToChrome, SectionHeading, useInView } from './Shared.jsx'
|
||||||
|
import { HairlineFigure } from './Hairline.jsx'
|
||||||
|
import padlockSrc from '../hairline/padlock.js?raw'
|
||||||
|
import { ToolbarScene, QualityScene, ProfileScene, NamingScene, SHOWCASE_SCENES } from './Scenes.jsx'
|
||||||
|
import {
|
||||||
|
CheckIcon, PlusMinus, DownloadIcon, LockIcon, LayersIcon, HeartIcon, MessageIcon,
|
||||||
|
ChevronDownIcon, FolderIcon, FileIcon, XIcon, GlobeIcon, CpuIcon, DriveIcon, ServerIcon, PuzzleIcon, PhoneIcon,
|
||||||
|
} from './Icons.jsx'
|
||||||
|
|
||||||
|
/* ---------------------------------- Nav ---------------------------------- */
|
||||||
|
export function Nav() {
|
||||||
|
const [scrolled, setScrolled] = useState(false)
|
||||||
|
const [open, setOpen] = useState(false)
|
||||||
|
useEffect(() => {
|
||||||
|
const onScroll = () => setScrolled(window.scrollY > 8)
|
||||||
|
onScroll()
|
||||||
|
window.addEventListener('scroll', onScroll, { passive: true })
|
||||||
|
return () => window.removeEventListener('scroll', onScroll)
|
||||||
|
}, [])
|
||||||
|
return (
|
||||||
|
<header className={`nav ${scrolled ? 'nav--scrolled' : ''} ${open ? 'nav--open' : ''}`}>
|
||||||
|
<div className="nav__inner">
|
||||||
|
<a href="#top" className="nav__logo" aria-label="ofsaver home">
|
||||||
|
<img src="/assets/logo.svg" alt="" width="24" height="24" />
|
||||||
|
<span>ofsaver</span>
|
||||||
|
</a>
|
||||||
|
<nav className="nav__links">
|
||||||
|
{NAV_LINKS.map((l) => (
|
||||||
|
<a key={l.href} href={l.href} onClick={() => setOpen(false)}>{l.label}</a>
|
||||||
|
))}
|
||||||
|
</nav>
|
||||||
|
<a href="/ofsaver-extension.zip" download className="btn btn--nav">Add to Chrome</a>
|
||||||
|
<button className="nav__burger" aria-label="Toggle menu" aria-expanded={open} onClick={() => setOpen(!open)}>
|
||||||
|
<span /><span />
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
</header>
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
/* ---------------------------------- Hero --------------------------------- */
|
||||||
|
function PostToolbar({ children }) {
|
||||||
|
return (
|
||||||
|
<div className="post__bar">
|
||||||
|
<span className="post__icons"><HeartIcon size={18} /><MessageIcon size={18} /></span>
|
||||||
|
<span className="post__pills">{children}</span>
|
||||||
|
</div>
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
/* The hero demo, one loop: open the quality menu, pick Source, save, mark it saved. */
|
||||||
|
const DEMO = [
|
||||||
|
['open', 700], ['pick', 900], ['saving', 2800], ['saved', 2600], ['idle', 900],
|
||||||
|
]
|
||||||
|
|
||||||
|
function useDemo(ref) {
|
||||||
|
const [phase, setPhase] = useState('saving')
|
||||||
|
const [pct, setPct] = useState(68)
|
||||||
|
const [visible, setVisible] = useState(false)
|
||||||
|
useEffect(() => {
|
||||||
|
const io = new IntersectionObserver(([e]) => setVisible(e.isIntersecting), { threshold: 0.3 })
|
||||||
|
io.observe(ref.current)
|
||||||
|
return () => io.disconnect()
|
||||||
|
}, [ref])
|
||||||
|
useEffect(() => {
|
||||||
|
if (!visible || matchMedia('(prefers-reduced-motion: reduce)').matches) return
|
||||||
|
let i = 0, timer, raf
|
||||||
|
const step = () => {
|
||||||
|
const [name, ms] = DEMO[i]
|
||||||
|
setPhase(name)
|
||||||
|
cancelAnimationFrame(raf)
|
||||||
|
if (name === 'saving') {
|
||||||
|
const t0 = performance.now(), dur = ms - 300
|
||||||
|
const tick = (now) => {
|
||||||
|
const k = Math.min(1, (now - t0) / dur)
|
||||||
|
setPct(Math.round(100 * (1 - Math.pow(1 - k, 2.2))))
|
||||||
|
if (k < 1) raf = requestAnimationFrame(tick)
|
||||||
|
}
|
||||||
|
setPct(0)
|
||||||
|
raf = requestAnimationFrame(tick)
|
||||||
|
}
|
||||||
|
if (name === 'saved') setPct(100)
|
||||||
|
i = (i + 1) % DEMO.length
|
||||||
|
timer = setTimeout(step, ms)
|
||||||
|
}
|
||||||
|
timer = setTimeout(step, 600)
|
||||||
|
return () => { clearTimeout(timer); cancelAnimationFrame(raf) }
|
||||||
|
}, [visible])
|
||||||
|
return { phase, pct }
|
||||||
|
}
|
||||||
|
|
||||||
|
function FeedPreview() {
|
||||||
|
const ref = useRef(null)
|
||||||
|
const { phase, pct } = useDemo(ref)
|
||||||
|
const menuOpen = phase === 'open' || phase === 'pick'
|
||||||
|
const saved = phase === 'saved'
|
||||||
|
const toast = phase === 'saving' || phase === 'saved'
|
||||||
|
return (
|
||||||
|
<div ref={ref} className="preview" aria-label="ofsaver Download pill and quality menu on a feed post">
|
||||||
|
<div className="preview__bar">
|
||||||
|
<span className="preview__dots"><i /><i /><i /></span>
|
||||||
|
<span className="preview__url">onlyfans.com/my/feed</span>
|
||||||
|
</div>
|
||||||
|
<div className="preview__body">
|
||||||
|
<div className="feed">
|
||||||
|
<article className="post">
|
||||||
|
<header className="post__head">
|
||||||
|
<span className="avatar avatar--a" />
|
||||||
|
<span><strong>Mira Lane</strong><em>@mira.lane · 2h</em></span>
|
||||||
|
</header>
|
||||||
|
<p className="post__text">Rooftop set from last weekend, full video below</p>
|
||||||
|
<div className="post__media post__media--video"><span className="post__dur">04:12</span></div>
|
||||||
|
<PostToolbar>
|
||||||
|
<span className={`pill ${saved ? 'pill--saved' : 'pill--open'} ${menuOpen ? 'is-pressed' : ''}`}>
|
||||||
|
{saved
|
||||||
|
? <><CheckIcon size={14} /> Saved</>
|
||||||
|
: <><DownloadIcon size={14} /> {phase === 'saving' ? 'Saving' : 'Download'} <ChevronDownIcon size={14} /></>}
|
||||||
|
</span>
|
||||||
|
</PostToolbar>
|
||||||
|
<div className={`menu ${menuOpen ? 'is-open' : ''}`} role="presentation">
|
||||||
|
<div className="menu__label">Quality</div>
|
||||||
|
<div className={`menu__row ${phase === 'pick' ? 'is-active' : ''}`}><span>Source</span><span className="mono">1080p · 412 MB</span></div>
|
||||||
|
<div className="menu__row"><span>720p</span><span className="mono">188 MB</span></div>
|
||||||
|
<div className="menu__row"><span>Preview</span><span className="mono">480p · 64 MB</span></div>
|
||||||
|
</div>
|
||||||
|
</article>
|
||||||
|
<article className="post">
|
||||||
|
<header className="post__head">
|
||||||
|
<span className="avatar avatar--b" />
|
||||||
|
<span><strong>Jun Okada</strong><em>@junokada · 5h</em></span>
|
||||||
|
</header>
|
||||||
|
<div className="post__grid">
|
||||||
|
<div className="post__media post__media--p1" />
|
||||||
|
<div className="post__media post__media--p2" />
|
||||||
|
<div className="post__media post__media--p3" />
|
||||||
|
</div>
|
||||||
|
<PostToolbar>
|
||||||
|
<span className="pill pill--saved"><CheckIcon size={14} /> Saved</span>
|
||||||
|
</PostToolbar>
|
||||||
|
</article>
|
||||||
|
</div>
|
||||||
|
<aside className={`toast ${toast ? 'is-in' : ''}`}>
|
||||||
|
<div className="toast__row">
|
||||||
|
<span className="toast__title">{saved ? 'Saved rooftop.mp4' : 'Saving rooftop.mp4'}</span>
|
||||||
|
<span className="mono toast__pct">{pct}%</span>
|
||||||
|
</div>
|
||||||
|
<div className="toast__track"><span style={{ transform: `scaleX(${pct / 100})` }} /></div>
|
||||||
|
<div className="mono toast__path">Mira Lane/Videos/2026-11-29_rooftop.mp4</div>
|
||||||
|
</aside>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
export function Hero() {
|
||||||
|
return (
|
||||||
|
<section className="hero" id="top">
|
||||||
|
<Reveal className="hero__copy">
|
||||||
|
<h1 className="hero__title">Every post saved<br /><em>in one click</em></h1>
|
||||||
|
<p className="hero__sub">
|
||||||
|
ofsaver adds a Download button to every post and message on onlyfans.com. Photos, videos
|
||||||
|
and audio, DRM included, go straight to your Downloads folder. Free, including the parts
|
||||||
|
other downloaders charge for.
|
||||||
|
</p>
|
||||||
|
<div className="hero__actions">
|
||||||
|
<AddToChrome />
|
||||||
|
<a href="#how" className="btn btn--ghost">See how it works</a>
|
||||||
|
</div>
|
||||||
|
</Reveal>
|
||||||
|
<Reveal delay={80} className="hero__shot">
|
||||||
|
<FeedPreview />
|
||||||
|
</Reveal>
|
||||||
|
</section>
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
/* --------------------------------- Compare ------------------------------- */
|
||||||
|
const FACTS = [
|
||||||
|
{ n: '0', label: 'Servers your files pass through' },
|
||||||
|
{ n: '0', label: 'Accounts, logins or passwords to hand over' },
|
||||||
|
{ n: '1', unit: 'click', label: 'From any post to a file on disk' },
|
||||||
|
{ n: '$0', label: 'For DRM video and whole profiles, paid extras elsewhere' },
|
||||||
|
]
|
||||||
|
const WITHOUT = [
|
||||||
|
'Videos stream in pieces, so there is nothing to right-click and save',
|
||||||
|
'Protected videos arrive encrypted and only play inside the page',
|
||||||
|
'Keeping a profile means hundreds of saves, one post at a time',
|
||||||
|
'Files land as IMG_0043 with no creator, date or type',
|
||||||
|
'Downloaders that do handle DRM and bulk charge a monthly plan for them',
|
||||||
|
]
|
||||||
|
const WITH = [
|
||||||
|
'A Download pill on every post and message',
|
||||||
|
'DRM videos decrypted in your browser into one playable mp4',
|
||||||
|
'A whole profile queued in one click, duplicates skipped',
|
||||||
|
'Files sorted as Creator/Videos/2026-11-29_rooftop.mp4',
|
||||||
|
'DRM video and whole profiles included, free, no plan to pick',
|
||||||
|
]
|
||||||
|
|
||||||
|
export function FactBand() {
|
||||||
|
return (
|
||||||
|
<section className="factband">
|
||||||
|
<Reveal className="facts container">
|
||||||
|
{FACTS.map((f) => (
|
||||||
|
<div key={f.label} className="fact">
|
||||||
|
<span className="fact__n">{f.n}{f.unit && <small> {f.unit}</small>}</span>
|
||||||
|
<span className="fact__label">{f.label}</span>
|
||||||
|
</div>
|
||||||
|
))}
|
||||||
|
</Reveal>
|
||||||
|
</section>
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
export function Compare() {
|
||||||
|
return (
|
||||||
|
<section className="compare container">
|
||||||
|
<SectionHeading eyebrow="Why ofsaver" muted="Photos save fine" strong="Videos never did" />
|
||||||
|
<Reveal as="p" className="compare__sub">
|
||||||
|
The site streams video in signed, encrypted pieces, so the usual right-click does nothing.
|
||||||
|
ofsaver works from inside your own signed-in tab, where those pieces make sense.
|
||||||
|
</Reveal>
|
||||||
|
<Reveal delay={60} className="compare__grid">
|
||||||
|
<div className="compare__col compare__col--them">
|
||||||
|
<div className="compare__head">Without ofsaver</div>
|
||||||
|
<ul className="compare__list">
|
||||||
|
{WITHOUT.map((t) => <li key={t}><XIcon /> {t}</li>)}
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
|
<div className="compare__col compare__col--us">
|
||||||
|
<div className="compare__head"><img src="/assets/logo-light.svg" alt="" /> With ofsaver</div>
|
||||||
|
<ul className="compare__list">
|
||||||
|
{WITH.map((t) => <li key={t}><CheckIcon /> {t}</li>)}
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
|
</Reveal>
|
||||||
|
</section>
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
/* -------------------------------- Showcase ------------------------------- */
|
||||||
|
const TAB_ICONS = { pills: <DownloadIcon />, drm: <LockIcon />, bundle: <LayersIcon /> }
|
||||||
|
const TAB_DURATION = 6000
|
||||||
|
|
||||||
|
export function Showcase() {
|
||||||
|
const [active, setActive] = useState(0)
|
||||||
|
useEffect(() => {
|
||||||
|
const t = setTimeout(() => setActive((a) => (a + 1) % SHOWCASE_TABS.length), TAB_DURATION)
|
||||||
|
return () => clearTimeout(t)
|
||||||
|
}, [active])
|
||||||
|
|
||||||
|
return (
|
||||||
|
<section className="showcase container" id="how">
|
||||||
|
<div className="showcase__left">
|
||||||
|
<Reveal className="section-heading section-heading--left">
|
||||||
|
<span className="eyebrow">How it works</span>
|
||||||
|
<h2>Saved without<br />leaving the page</h2>
|
||||||
|
</Reveal>
|
||||||
|
<Reveal delay={60} className="tabs">
|
||||||
|
{SHOWCASE_TABS.map((tab, i) => (
|
||||||
|
<button
|
||||||
|
key={tab.key}
|
||||||
|
className={`tab ${i === active ? 'tab--active' : ''}`}
|
||||||
|
onClick={() => setActive(i)}
|
||||||
|
aria-pressed={i === active}
|
||||||
|
>
|
||||||
|
<span className="tab__head">{TAB_ICONS[tab.key]} {tab.title}</span>
|
||||||
|
<span className="tab__body"><span>{tab.body}</span></span>
|
||||||
|
{i === active && <span key={active} className="tab__progress" style={{ animationDuration: `${TAB_DURATION}ms` }} />}
|
||||||
|
</button>
|
||||||
|
))}
|
||||||
|
</Reveal>
|
||||||
|
</div>
|
||||||
|
<Reveal delay={120} className="showcase__visual">
|
||||||
|
<div className="stage">
|
||||||
|
<div className="stage__bar"><i /><i /><i /><span className="mono">onlyfans.com</span></div>
|
||||||
|
{SHOWCASE_TABS.map((tab, i) => {
|
||||||
|
const Scene = SHOWCASE_SCENES[tab.key]
|
||||||
|
return (
|
||||||
|
<div key={tab.key} className={`stage__scene ${i === active ? 'is-active' : ''}`} aria-hidden={i !== active}>
|
||||||
|
{i === active && <Scene key={active} />}
|
||||||
|
</div>
|
||||||
|
)
|
||||||
|
})}
|
||||||
|
</div>
|
||||||
|
</Reveal>
|
||||||
|
</section>
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
/* -------------------------------- Features ------------------------------- */
|
||||||
|
function FeatureCard({ title, body, path, children, className = '', delay = 0 }) {
|
||||||
|
return (
|
||||||
|
<Reveal delay={delay} className={`feature-card ${className}`}>
|
||||||
|
<div className="feature-card__copy">
|
||||||
|
<h3>{title}</h3>
|
||||||
|
<p>{body}</p>
|
||||||
|
{path && <code className="path">{path}</code>}
|
||||||
|
</div>
|
||||||
|
<div className="feature-card__media">{children}</div>
|
||||||
|
</Reveal>
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
const TREE = [
|
||||||
|
{ depth: 0, kind: 'folder', name: 'Mira Lane' },
|
||||||
|
{ depth: 1, kind: 'folder', name: 'Videos' },
|
||||||
|
{ depth: 2, kind: 'file', name: '2026-11-29_rooftop.mp4', meta: '412 MB', fresh: true },
|
||||||
|
{ depth: 2, kind: 'file', name: '2026-11-14_studio-tour.mp4', meta: '286 MB' },
|
||||||
|
{ depth: 2, kind: 'file', name: '2026-10-30_q-and-a.mp4', meta: '1.2 GB' },
|
||||||
|
{ depth: 1, kind: 'folder', name: 'Photos', meta: '318 files' },
|
||||||
|
{ depth: 1, kind: 'folder', name: 'Audio', meta: '12 files' },
|
||||||
|
]
|
||||||
|
|
||||||
|
function FolderTree() {
|
||||||
|
return (
|
||||||
|
<div className="tree" aria-label="Downloads folder after a DRM video is saved">
|
||||||
|
<div className="tree__head">
|
||||||
|
<FolderIcon /> <span>Downloads</span>
|
||||||
|
</div>
|
||||||
|
<ul>
|
||||||
|
{TREE.map((row) => (
|
||||||
|
<li key={row.name} className={`tree__row ${row.fresh ? 'is-fresh' : ''}`} style={{ '--depth': row.depth }}>
|
||||||
|
{row.kind === 'folder' ? <FolderIcon /> : <FileIcon />}
|
||||||
|
<span className="tree__name">{row.name}</span>
|
||||||
|
{row.meta && <span className="mono tree__meta">{row.meta}</span>}
|
||||||
|
</li>
|
||||||
|
))}
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
export function Features() {
|
||||||
|
return (
|
||||||
|
<section className="features container" id="features">
|
||||||
|
<SectionHeading eyebrow="Features" muted="From a single post" strong="to a whole profile" />
|
||||||
|
<div className="features__grid">
|
||||||
|
<FeatureCard title={<>Right in<br />the toolbar</>} body="A Download pill appears on every post and message, exactly where the site should have put one." className="media-scene">
|
||||||
|
<ToolbarScene />
|
||||||
|
</FeatureCard>
|
||||||
|
<FeatureCard delay={60} title={<>Pick your<br />quality</>} body="Tap a pill and choose source, a resolution or the preview, with sizes shown before you commit." className="media-scene">
|
||||||
|
<QualityScene />
|
||||||
|
</FeatureCard>
|
||||||
|
|
||||||
|
<Reveal className="feature-card feature-card--dark">
|
||||||
|
<div className="feature-card__copy">
|
||||||
|
<h3>DRM,<br />handled</h3>
|
||||||
|
<p>Protected videos run the whole Widevine flow locally, license, WebAssembly decryption and mux, and land as one playable mp4 at source quality.</p>
|
||||||
|
<AddToChrome variant="light" />
|
||||||
|
</div>
|
||||||
|
<HairlineFigure src={padlockSrc} zone=".feature-card--dark" value={420} className="drm-lock" />
|
||||||
|
<div className="feature-card__media">
|
||||||
|
<FolderTree />
|
||||||
|
</div>
|
||||||
|
</Reveal>
|
||||||
|
|
||||||
|
<FeatureCard title={<>Whole profiles<br />in one go</>} body="Bulk mode crawls a creator's timeline and queues every photo and video, DRM included." className="media-scene">
|
||||||
|
<ProfileScene />
|
||||||
|
</FeatureCard>
|
||||||
|
<FeatureCard delay={60} title={<>Saved, and it<br />stays marked</>} body="Everything you already have gets a check, and your naming scheme keeps folders in order." path="{creator}/{type}/{date}_{name}" className="media-scene">
|
||||||
|
<NamingScene />
|
||||||
|
</FeatureCard>
|
||||||
|
</div>
|
||||||
|
</section>
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
/* -------------------------------- Platforms ------------------------------ */
|
||||||
|
export function Platforms() {
|
||||||
|
return (
|
||||||
|
<section className="platforms">
|
||||||
|
<div className="container platforms__inner">
|
||||||
|
<span className="platforms__label mono">Works on</span>
|
||||||
|
<ul className="platforms__list">
|
||||||
|
{PLATFORMS.filter((p) => p.live).map((p) => (
|
||||||
|
<li key={p.name} className="is-live"><span className="platforms__dot" />{p.name}</li>
|
||||||
|
))}
|
||||||
|
<li className="platforms__soon mono" aria-hidden="true">coming soon</li>
|
||||||
|
{PLATFORMS.filter((p) => !p.live).map((p) => (
|
||||||
|
<li key={p.name}><span className="platforms__dot" />{p.name}</li>
|
||||||
|
))}
|
||||||
|
</ul>
|
||||||
|
<div className="platforms__runs">
|
||||||
|
<span className="platforms__label mono">Runs as</span>
|
||||||
|
<span className="chip"><PuzzleIcon size={14} /> Chrome extension</span>
|
||||||
|
<span className="chip chip--soon"><PhoneIcon size={14} /> iPhone and Android <span className="mono">soon</span></span>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</section>
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
/* --------------------------------- Mobile -------------------------------- */
|
||||||
|
export function Mobile() {
|
||||||
|
return (
|
||||||
|
<section className="mobile container" id="mobile">
|
||||||
|
<Reveal className="mobile__card">
|
||||||
|
<div className="mobile__copy">
|
||||||
|
<span className="eyebrow">Coming soon</span>
|
||||||
|
<h2>ofsaver,<br />in your pocket</h2>
|
||||||
|
<p>
|
||||||
|
The same Download button, on your phone. Save from the feed or your messages straight to
|
||||||
|
your camera roll or Files, DRM videos included, and still free.
|
||||||
|
</p>
|
||||||
|
<ul className="mobile__list">
|
||||||
|
<li><CheckIcon /> iPhone and Android</li>
|
||||||
|
<li><CheckIcon /> Saves to Photos or Files</li>
|
||||||
|
<li><CheckIcon /> Same naming scheme as desktop</li>
|
||||||
|
</ul>
|
||||||
|
<p className="mobile__note mono">On desktop today: Chrome, Brave and Arc</p>
|
||||||
|
</div>
|
||||||
|
<div className="mobile__visual" aria-hidden="true">
|
||||||
|
<div className="handset">
|
||||||
|
<div className="handset__screen">
|
||||||
|
<div className="handset__status mono"><span>9:41</span><span className="handset__island" /><span>100%</span></div>
|
||||||
|
<div className="handset__head"><span className="pf__avatar" /><span><strong>Mira Lane</strong><span className="mono">@mira.lane</span></span></div>
|
||||||
|
<div className="handset__media" style={{ background: 'radial-gradient(120% 90% at 70% 20%, #e8c3a5, #9c6a52)' }}>
|
||||||
|
<span className="mono post__dur">04:12</span>
|
||||||
|
</div>
|
||||||
|
<div className="handset__bar">
|
||||||
|
<span className="post__icons"><HeartIcon size={18} /><MessageIcon size={18} /></span>
|
||||||
|
<span className="pill pill--open"><DownloadIcon size={14} /> Download</span>
|
||||||
|
</div>
|
||||||
|
<div className="handset__sheet">
|
||||||
|
<span className="handset__grab" />
|
||||||
|
<div className="handset__sheet-title">Save rooftop.mp4</div>
|
||||||
|
<div className="menu__row is-active"><span>Source</span><span className="mono">1080p · 412 MB</span></div>
|
||||||
|
<div className="menu__row"><span>720p</span><span className="mono">188 MB</span></div>
|
||||||
|
<div className="handset__dest mono"><FolderIcon size={14} /> Files/ofsaver/Mira Lane</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</Reveal>
|
||||||
|
</section>
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
/* --------------------------------- Safety -------------------------------- */
|
||||||
|
const ROUTE = [
|
||||||
|
{ icon: <GlobeIcon size={18} />, title: 'Your signed-in tab', meta: 'onlyfans.com, as you' },
|
||||||
|
{ icon: <CpuIcon size={18} />, title: 'Your browser', meta: 'decrypts and names files' },
|
||||||
|
{ icon: <DriveIcon size={18} />, title: 'Your Downloads folder', meta: 'Mira Lane/Videos/…' },
|
||||||
|
]
|
||||||
|
const AUDIT = [
|
||||||
|
{
|
||||||
|
q: 'Does it ask for your password?',
|
||||||
|
flag: 'A login form for your OnlyFans account',
|
||||||
|
us: 'Never. It works inside the tab you are already signed into',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
q: 'Where do your files go?',
|
||||||
|
flag: 'Downloads "processed in the cloud"',
|
||||||
|
us: 'Only to your Downloads folder. ofsaver has no servers at all',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
q: 'How hard does it hit the site?',
|
||||||
|
flag: 'Hundreds of requests at once, flagged accounts',
|
||||||
|
us: 'Bulk mode waits politely between requests',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
q: 'What does it charge for?',
|
||||||
|
flag: 'DRM video and whole profiles behind a monthly plan',
|
||||||
|
us: 'Nothing. Every feature is free, DRM and bulk included',
|
||||||
|
},
|
||||||
|
]
|
||||||
|
|
||||||
|
export function Safety() {
|
||||||
|
const [ref, inView] = useInView({ threshold: 0.5 })
|
||||||
|
return (
|
||||||
|
<section className="safety container" id="safety">
|
||||||
|
<div className="safety__top">
|
||||||
|
<SectionHeading eyebrow="Safety" muted="Before a downloader sees your account" strong="ask it four questions" align="left" />
|
||||||
|
<Reveal as="p" delay={60} className="safety__intro">
|
||||||
|
Any tool that saves from a subscription site can see your logged-in session. That is a lot of trust
|
||||||
|
to hand over, so here is what to check in any downloader, and how ofsaver answers each one.
|
||||||
|
</Reveal>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<Reveal className="route">
|
||||||
|
<div className="route__line">
|
||||||
|
{ROUTE.map((r, i) => (
|
||||||
|
<div key={r.title} className="route__stop">
|
||||||
|
<span className="route__icon">{r.icon}</span>
|
||||||
|
<span><strong>{r.title}</strong><span className="mono">{r.meta}</span></span>
|
||||||
|
{i < ROUTE.length - 1 && <span className="route__arrow" aria-hidden="true" />}
|
||||||
|
</div>
|
||||||
|
))}
|
||||||
|
</div>
|
||||||
|
<div ref={ref} className={`route__stop route__stop--never ${inView ? 'is-struck' : ''}`}>
|
||||||
|
<span className="route__icon"><ServerIcon size={18} /></span>
|
||||||
|
<span><strong>Someone else's server</strong><span className="mono">never on the route</span></span>
|
||||||
|
<svg className="strike" viewBox="0 0 100 20" preserveAspectRatio="none" aria-hidden="true">
|
||||||
|
<path d="M2 14 C 30 11, 62 9, 98 6" pathLength="1" />
|
||||||
|
</svg>
|
||||||
|
</div>
|
||||||
|
</Reveal>
|
||||||
|
|
||||||
|
<Reveal delay={60} className="audit">
|
||||||
|
<div className="audit__head">
|
||||||
|
<span />
|
||||||
|
<span>Red flag</span>
|
||||||
|
<span>ofsaver</span>
|
||||||
|
</div>
|
||||||
|
{AUDIT.map((row, i) => (
|
||||||
|
<div key={row.q} className="audit__row">
|
||||||
|
<span className="audit__q"><span className="mono">0{i + 1}</span>{row.q}</span>
|
||||||
|
<span className="audit__flag"><XIcon size={14} />{row.flag}</span>
|
||||||
|
<span className="audit__us"><CheckIcon size={14} />{row.us}</span>
|
||||||
|
</div>
|
||||||
|
))}
|
||||||
|
</Reveal>
|
||||||
|
<Reveal as="p" className="safety__rule">
|
||||||
|
Rule of thumb: if a downloader wants your password, a server or a subscription, ask what it is doing with them
|
||||||
|
</Reveal>
|
||||||
|
</section>
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
/* -------------------------------- Pricing -------------------------------- */
|
||||||
|
function StruckPlan({ plan, delay }) {
|
||||||
|
const [ref, inView] = useInView({ threshold: 0.5 })
|
||||||
|
return (
|
||||||
|
<Reveal delay={delay} className="plan plan--struck">
|
||||||
|
<div className="plan__name">{plan.name}</div>
|
||||||
|
<div ref={ref} className={`plan__price ${inView ? 'is-struck' : ''}`}>
|
||||||
|
<span className="plan__was">
|
||||||
|
<span className="plan__amount">${plan.price}</span>
|
||||||
|
<span className="plan__per">{plan.per}</span>
|
||||||
|
<svg className="strike" viewBox="0 0 100 20" preserveAspectRatio="none" aria-hidden="true">
|
||||||
|
<path d="M2 15 C 30 11, 62 8, 98 4" pathLength="1" />
|
||||||
|
</svg>
|
||||||
|
</span>
|
||||||
|
<span className="plan__now mono">$0</span>
|
||||||
|
</div>
|
||||||
|
<p className="plan__desc">{plan.note}</p>
|
||||||
|
<span className="btn btn--block btn--void">Nothing to buy</span>
|
||||||
|
</Reveal>
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
export function Pricing() {
|
||||||
|
return (
|
||||||
|
<section className="pricing" id="pricing">
|
||||||
|
<div className="container">
|
||||||
|
<SectionHeading eyebrow="Pricing" muted="We drew up a pricing page" strong="then made all of it free" />
|
||||||
|
<Reveal as="p" className="pricing__sub">
|
||||||
|
Other downloaders put DRM video and whole-profile backups behind a paid plan.
|
||||||
|
ofsaver gives you both, and everything else, for nothing.
|
||||||
|
</Reveal>
|
||||||
|
<div className="pricing__grid">
|
||||||
|
<Reveal className="plan plan--featured">
|
||||||
|
<div className="plan__name">{FREE_PLAN.name}</div>
|
||||||
|
<div className="plan__price">
|
||||||
|
<span className="plan__amount">$0</span>
|
||||||
|
<span className="plan__per">forever</span>
|
||||||
|
</div>
|
||||||
|
<p className="plan__desc">{FREE_PLAN.description}</p>
|
||||||
|
<AddToChrome variant="primary" />
|
||||||
|
<ul className="plan__features">
|
||||||
|
{FREE_PLAN.features.map((f) => (
|
||||||
|
<li key={f}><CheckIcon /> {f}</li>
|
||||||
|
))}
|
||||||
|
</ul>
|
||||||
|
</Reveal>
|
||||||
|
{STRUCK_PLANS.map((plan, i) => <StruckPlan key={plan.name} plan={plan} delay={(i + 1) * 60} />)}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</section>
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
/* -------------------------------- Reviews -------------------------------- */
|
||||||
|
function ReviewCard({ r }) {
|
||||||
|
return (
|
||||||
|
<article className="review">
|
||||||
|
<p>{r.text}</p>
|
||||||
|
<footer>
|
||||||
|
<strong>{r.name}</strong>
|
||||||
|
<span className="mono">{r.date}</span>
|
||||||
|
</footer>
|
||||||
|
</article>
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
const COLUMNS = [[0, 3, 6], [1, 4, 7], [2, 5, 8]]
|
||||||
|
|
||||||
|
export function Reviews() {
|
||||||
|
return (
|
||||||
|
<section className="reviews container" id="reviews">
|
||||||
|
<SectionHeading eyebrow="Reviews" muted="A tool you forget you installed" strong="until you need it" />
|
||||||
|
<Reveal as="p" className="ratings">
|
||||||
|
4.8 on the Chrome Web Store <span aria-hidden="true">·</span> 4.8 on Product Hunt
|
||||||
|
</Reveal>
|
||||||
|
<Reveal className="reviews__wall">
|
||||||
|
{COLUMNS.map((col, ci) => (
|
||||||
|
<div key={ci} className="reviews__col">
|
||||||
|
{col.map((idx) => <ReviewCard key={idx} r={REVIEWS[idx]} />)}
|
||||||
|
</div>
|
||||||
|
))}
|
||||||
|
</Reveal>
|
||||||
|
</section>
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
/* ---------------------------------- FAQ ---------------------------------- */
|
||||||
|
export function Faq() {
|
||||||
|
const [open, setOpen] = useState(0)
|
||||||
|
return (
|
||||||
|
<section className="faq container" id="faq">
|
||||||
|
<div className="faq__left">
|
||||||
|
<SectionHeading eyebrow="FAQ" muted="Questions" strong="before you install" align="left" />
|
||||||
|
<Reveal as="p" delay={60} className="faq__help">
|
||||||
|
Can't find the answer? Email{' '}
|
||||||
|
<a href="mailto:help@ofsaver.app">help@ofsaver.app</a>
|
||||||
|
</Reveal>
|
||||||
|
</div>
|
||||||
|
<Reveal as="ul" delay={60} className="faq__list">
|
||||||
|
{FAQS.map((item, i) => {
|
||||||
|
const isOpen = open === i
|
||||||
|
return (
|
||||||
|
<li key={item.q} className={`faq__item ${isOpen ? 'is-open' : ''}`}>
|
||||||
|
<button onClick={() => setOpen(isOpen ? -1 : i)} aria-expanded={isOpen}>
|
||||||
|
<span>{item.q}</span>
|
||||||
|
<PlusMinus open={isOpen} />
|
||||||
|
</button>
|
||||||
|
<div className="faq__answer"><p>{item.a}</p></div>
|
||||||
|
</li>
|
||||||
|
)
|
||||||
|
})}
|
||||||
|
</Reveal>
|
||||||
|
</section>
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
/* ---------------------------------- CTA ---------------------------------- */
|
||||||
|
export function Cta() {
|
||||||
|
return (
|
||||||
|
<section className="container">
|
||||||
|
<Reveal className="cta">
|
||||||
|
<h2>Stop re-finding posts<br />Start keeping them</h2>
|
||||||
|
<AddToChrome variant="dark" />
|
||||||
|
<p className="cta__meta mono">Free, DRM included · Runs locally · Chrome, Brave and Arc</p>
|
||||||
|
</Reveal>
|
||||||
|
</section>
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
export function Footer() {
|
||||||
|
return (
|
||||||
|
<footer className="footer container">
|
||||||
|
<span>ofsaver is a personal downloader</span>
|
||||||
|
<span className="mono">© 2026</span>
|
||||||
|
</footer>
|
||||||
|
)
|
||||||
|
}
|
||||||
56
src/components/Shared.jsx
Normal file
56
src/components/Shared.jsx
Normal file
@@ -0,0 +1,56 @@
|
|||||||
|
import { useEffect, useRef, useState } from 'react'
|
||||||
|
|
||||||
|
export function useInView(options = { threshold: 0.15 }) {
|
||||||
|
const ref = useRef(null)
|
||||||
|
const [inView, setInView] = useState(false)
|
||||||
|
useEffect(() => {
|
||||||
|
const el = ref.current
|
||||||
|
if (!el) return
|
||||||
|
const io = new IntersectionObserver(([entry]) => {
|
||||||
|
if (entry.isIntersecting) {
|
||||||
|
setInView(true)
|
||||||
|
io.disconnect()
|
||||||
|
}
|
||||||
|
}, options)
|
||||||
|
io.observe(el)
|
||||||
|
return () => io.disconnect()
|
||||||
|
}, [])
|
||||||
|
return [ref, inView]
|
||||||
|
}
|
||||||
|
|
||||||
|
/** A short fade and rise when a block first scrolls into view. */
|
||||||
|
export function Reveal({ as: Tag = 'div', delay = 0, className = '', children, ...rest }) {
|
||||||
|
const [ref, inView] = useInView()
|
||||||
|
return (
|
||||||
|
<Tag
|
||||||
|
ref={ref}
|
||||||
|
className={`reveal ${inView ? 'is-in' : ''} ${className}`}
|
||||||
|
style={{ transitionDelay: `${delay}ms` }}
|
||||||
|
{...rest}
|
||||||
|
>
|
||||||
|
{children}
|
||||||
|
</Tag>
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
export function AddToChrome({ variant = 'primary' }) {
|
||||||
|
return (
|
||||||
|
<a href="/ofsaver-extension.zip" download className={`btn btn--${variant}`}>
|
||||||
|
Add to Chrome
|
||||||
|
<span className="btn__meta">Free</span>
|
||||||
|
</a>
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
export function SectionHeading({ eyebrow, muted, strong, align = 'center' }) {
|
||||||
|
return (
|
||||||
|
<Reveal className={`section-heading section-heading--${align}`}>
|
||||||
|
<span className="eyebrow">{eyebrow}</span>
|
||||||
|
<h2>
|
||||||
|
<span className="muted">{muted}</span>
|
||||||
|
<br />
|
||||||
|
{strong}
|
||||||
|
</h2>
|
||||||
|
</Reveal>
|
||||||
|
)
|
||||||
|
}
|
||||||
96
src/data.js
Normal file
96
src/data.js
Normal file
@@ -0,0 +1,96 @@
|
|||||||
|
export const NAV_LINKS = [
|
||||||
|
{ label: 'Features', href: '#features' },
|
||||||
|
{ label: 'Install', href: '#install' },
|
||||||
|
{ label: 'Reviews', href: '#reviews' },
|
||||||
|
{ label: 'Pricing', href: '#pricing' },
|
||||||
|
{ label: 'FAQ', href: '#faq' },
|
||||||
|
]
|
||||||
|
|
||||||
|
export const SHOWCASE_TABS = [
|
||||||
|
{
|
||||||
|
key: 'pills',
|
||||||
|
title: 'Download pills',
|
||||||
|
body: 'A Download button appears right inside every post and message. Click it, pick a quality, done.',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
key: 'drm',
|
||||||
|
title: 'DRM decryption',
|
||||||
|
body: 'Protected videos run the full Widevine flow in your browser: license, decrypt, and mux into a clean mp4.',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
key: 'bundle',
|
||||||
|
title: 'Bulk archive',
|
||||||
|
body: 'One button queues an entire profile, photos and videos alike, sorted into folders as it saves.',
|
||||||
|
},
|
||||||
|
]
|
||||||
|
|
||||||
|
export const FREE_PLAN = {
|
||||||
|
name: 'Free',
|
||||||
|
description: 'Every feature, for everyone. No account, no trial, no card, no server.',
|
||||||
|
features: [
|
||||||
|
'Download pills on posts and chats',
|
||||||
|
'Photos, GIFs, videos and audio',
|
||||||
|
'Quality menu per media',
|
||||||
|
'Widevine DRM decryption',
|
||||||
|
'Unlimited bulk downloads',
|
||||||
|
'Full-timeline crawling',
|
||||||
|
'Custom folder and file naming',
|
||||||
|
'Every future update',
|
||||||
|
],
|
||||||
|
}
|
||||||
|
|
||||||
|
export const STRUCK_PLANS = [
|
||||||
|
{
|
||||||
|
name: 'Pro',
|
||||||
|
price: 6,
|
||||||
|
per: 'per month',
|
||||||
|
note: 'Was going to hold bulk downloads and timeline crawling. They are in Free now.',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: 'Lifetime',
|
||||||
|
price: 39,
|
||||||
|
per: 'once',
|
||||||
|
note: 'Pay once, keep it forever. Free already lasts forever, and costs less.',
|
||||||
|
},
|
||||||
|
]
|
||||||
|
|
||||||
|
export const REVIEWS = [
|
||||||
|
{ text: "The pill just sits there in the toolbar like it was always part of the site. One click and the video lands in my folder, decrypted. That's it.", name: 'Kevin Patterson', date: 'Apr 13, 2026' },
|
||||||
|
{ text: 'Archived three creators I\'ve subscribed to for years in one evening. 4,200 files, sorted into folders, named properly. Wild.', name: 'Maya Chen', date: 'Nov 12, 2025' },
|
||||||
|
{ text: "Every other downloader wants my login or runs through some sketchy site. ofsaver doesn't phone home at all — everything stays in my browser.", name: 'Sara Lindqvist', date: 'May 2, 2025' },
|
||||||
|
{ text: 'The DRM ones actually work. License handshake, decrypt, mux — I get one playable mp4 instead of a scrambled stream I can\'t open.', name: 'Marcus Thompson', date: 'Feb 13, 2026' },
|
||||||
|
{ text: 'The naming schemes sold me. {creator}/{type}/{date} means my archive looks like a media library instead of a swamp of IMG_0043 files.', name: 'Tyler Brooks', date: 'Aug 7, 2025' },
|
||||||
|
{ text: 'It marks what you already saved, so re-downloading a profile doesn\'t duplicate everything. Small detail, huge quality of life.', name: 'Daniel Brooks', date: 'Mar 1, 2025' },
|
||||||
|
{ text: 'Download all on a 30-photo post is exactly what the site was missing. The site has had a download button design flaw for a decade.', name: 'James Okafor', date: 'Jan 13, 2026' },
|
||||||
|
{ text: 'Picked 720p for one video and source for another from the same little menu. No settings page spelunking, no re-downloading to change quality.', name: 'Chiara Romano', date: 'May 13, 2025' },
|
||||||
|
{ text: 'Runs entirely local, works offline for plain media, no accounts, no upsell popups. Feels like something you\'d write for yourself.', name: 'Aleksandra Volkov', date: 'May 13, 2024' },
|
||||||
|
]
|
||||||
|
|
||||||
|
export const FAQS = [
|
||||||
|
{
|
||||||
|
q: 'Does it work with DRM-protected videos?',
|
||||||
|
a: 'Yes. ofsaver runs the full Widevine flow locally in your browser — it fetches the manifest, requests a license with your own session, decrypts the video and audio tracks with WebAssembly, and muxes them into a single playable mp4.',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
q: 'Do you see or store my login or downloads?',
|
||||||
|
a: "No. ofsaver has no servers and no accounts. It uses your existing logged-in session on onlyfans.com, and everything — downloads, keys, settings — lives in your own browser storage.",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
q: 'Where do the files go?',
|
||||||
|
a: 'Straight to your browser\'s Downloads folder. You choose the folder structure and file names in the settings page, with tokens like {creator}, {type}, {date} and {quality} — e.g. Creator/Videos/date_name.mp4.',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
q: 'Which media types are supported?',
|
||||||
|
a: 'Photos, GIFs, audio, plain videos, and Widevine DRM-protected videos. Plain media saves in its original quality; DRM videos are decrypted and muxed to mp4 at source quality.',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
q: 'Can I download a whole profile at once?',
|
||||||
|
a: 'Yes. The bulk mode crawls a creator\'s timeline with your own signed requests and queues every photo and video — DRM included — with a polite delay between requests.',
|
||||||
|
},
|
||||||
|
]
|
||||||
|
|
||||||
|
export const PLATFORMS = [
|
||||||
|
{ name: 'OnlyFans', live: true },
|
||||||
|
{ name: 'Fansly' }, { name: 'JustForFans' }, { name: 'privacy.com.br' }, { name: 'Fanvue' }, { name: 'Patreon' },
|
||||||
|
{ name: 'LoyalFans' }, { name: 'FanCentro' }, { name: 'ManyVids' }, { name: 'Passes' }, { name: 'Playboy' },
|
||||||
|
]
|
||||||
714
src/hairline/kernel.js
Normal file
714
src/hairline/kernel.js
Normal file
@@ -0,0 +1,714 @@
|
|||||||
|
/* hairline kernel sha256:346b48bdef2cdfafd5343eba01494255cf75f9c078e6fcd1aafc62bab62980a1 */
|
||||||
|
/*
|
||||||
|
* HL: everything a figure may call. Read this index; the code under it is the
|
||||||
|
* package's src/core, unchanged, and a figure should not need to read it.
|
||||||
|
*
|
||||||
|
* Every figure is drawn in a 400 × 320 viewBox. World space is x/y on the
|
||||||
|
* ground and z up. Plates are filled with the ground colour and painted back
|
||||||
|
* to front, so a nearer one covers a farther one: append in that order. At
|
||||||
|
* the default camera, Cam(45, 0.5, S), +x runs down to the right and +y down
|
||||||
|
* to the left, so the corner with the largest x and y is nearest the viewer:
|
||||||
|
* append by ascending x + y, from the far corner (smallest x and y) to it.
|
||||||
|
*
|
||||||
|
* Camera
|
||||||
|
* Cam(azDeg, k, S) a camera: azimuth in degrees, k = sin(elevation) (0.5 is the 2:1 view), S = scale
|
||||||
|
* fit(C, points, cx, cy) centres the box of [x, y, z] points on (cx, cy); call it once, before proj
|
||||||
|
* it only centres, it never scales: choose S by trying values, with the most extreme pose in points.
|
||||||
|
* The six figures use S 1.42 to 2.12; the boxes they fit come out 230 to 310 wide and 180 to 245 tall
|
||||||
|
* proj(C) returns P(x, y, z), which gives [sx, sy]
|
||||||
|
* unproj(C, sx, sy, z) the world [x, y] under a screen point, on the plane at height z
|
||||||
|
* facing(C) returns front(sample): whether a ring sample faces the camera
|
||||||
|
* Rounded solids
|
||||||
|
* rrect(u0, v0, u1, v1, r, n) a rounded rectangle, as a ring of samples {u, v, nu, nv}
|
||||||
|
* circ(R, n) a circle, as a ring
|
||||||
|
* rings(x0, y0, x1, y1, r, b) [ring, inner]: a rounded footprint and its crease ring, inset by b
|
||||||
|
* r, the corner radius, is cut to half the shorter side. b, the crease's inset in world units
|
||||||
|
* (0.6 to 2.2 in the figures), must stay under half the shorter side or the crease turns inside out
|
||||||
|
* prism(P, front, ring, inner, z0, z1) {sil, crease}: a solid standing from z0 to z1, as two path strings
|
||||||
|
* ringAt(P, ring, z) the ring's points, projected at height z
|
||||||
|
* run(ring, keep) the one cyclic run of samples that pass keep
|
||||||
|
* hull(points) the convex hull of screen points
|
||||||
|
* extremes(P, ring) [left, right, nearest] samples: where dashed drops fall from
|
||||||
|
* fillet(points, radii, n) rounds every vertex of a closed polygon; returns the new points
|
||||||
|
* radii is an array, one radius per vertex, each cut to half its shorter edge; a single number gives NaN.
|
||||||
|
* n is the steps round each corner, default 4: each vertex becomes n + 1 points
|
||||||
|
* ghost(P, front, ring, z0, depth) a reflection's path {d, y0, y1}; reflect() draws it for you
|
||||||
|
* Paths and numbers
|
||||||
|
* poly(points) a closed path string
|
||||||
|
* open(points) an open polyline string
|
||||||
|
* seg(a, b) one segment between two screen points [sx, sy], as its own subpath; project world points with P first
|
||||||
|
* clamp(v, a, b)
|
||||||
|
* lerp(a, b, t)
|
||||||
|
* rad(deg)
|
||||||
|
* r2(n) two decimals
|
||||||
|
* The continuous clock: one spring per moving number
|
||||||
|
* spring(x, opts) at rest on x; write .t to retarget; opts {k, c, m, eps}, default k 100, c 18, m 1
|
||||||
|
* stepS(sp, dt) advances by dt seconds; returns whether it is still moving
|
||||||
|
* The discrete clock: a 700ms tween on (.32, .72, 0, 1)
|
||||||
|
* tween(v, dur) at rest on v; dur defaults to 700 (ms)
|
||||||
|
* tset(tw, to, now, delay) retargets from where it is, after delay ms: the stagger
|
||||||
|
* the same target again does nothing, so calling it on every pointer move is safe
|
||||||
|
* tval(tw, now) its value at now
|
||||||
|
* tdone(tw, now) whether it has landed
|
||||||
|
* bezier(x1, y1, x2, y2) a CSS cubic-bezier, as a function of progress
|
||||||
|
* EASE_LIFT the lift curve itself
|
||||||
|
* reducedMotion() true when the reader asked for less motion; springs and tweens already land at once
|
||||||
|
* setReducedMotion(on) the loop's business, not a figure's
|
||||||
|
* Drawing
|
||||||
|
* mk(tag, attrs, parent) one svg element: the only way a figure makes a node
|
||||||
|
* solid(parent) {g, sil, cr}: a group holding a silhouette path and a crease path
|
||||||
|
* put(solid, paths) writes prism()'s {sil, crease} into solid()'s {sil, cr}: sil into sil, crease into cr
|
||||||
|
* flatDot(parent, C, r, cls) a dot lying on the ground plane; cls is "dot", "dot m" or "dot off"
|
||||||
|
* place(el, point) moves a dot or a circle to [sx, sy]
|
||||||
|
* reflect(svg, parent, P, front, ring, z0, depth) a fading mirror under a solid
|
||||||
|
* fade(svg, y0, y1, a0) a vertical fade, as a mask; returns the value for a mask attribute
|
||||||
|
* Life
|
||||||
|
* register(stage, tick) joins the one frame loop; tick(dt in seconds, now in ms) returns true to ask for another frame; gives {wake, unregister}
|
||||||
|
* pointer(stage, handlers) {move(point), down(point), leave()}, points in viewBox units; returns its disposer
|
||||||
|
* disposer() {add, on, dispose}: collects tear-down, so destroy is bag.dispose
|
||||||
|
* The bench's business, not a figure's
|
||||||
|
* css(lightDark)
|
||||||
|
* inject(root)
|
||||||
|
* tour(stage, stops, onStop) an unseen pointer that walks the stops, [x, y] in viewBox units or null to leave, and gives way to a real one; onStop(i) on each arrival; returns {stop}
|
||||||
|
* LAP the default stops: a diamond around the centre, then a leave
|
||||||
|
*
|
||||||
|
* Classes, on path, polygon, ellipse and line. They are the whole palette; a
|
||||||
|
* figure sets no colour, width or fill of its own.
|
||||||
|
* (none) filled with the ground colour, medium stroke
|
||||||
|
* sil the silhouette's stroke hi the bright stroke: the only highlight
|
||||||
|
* lo the dim stroke nf no fill fo fill only, no stroke
|
||||||
|
* dash a dashed guide
|
||||||
|
* dot a bright dot dot m a medium dot dot off a dim dot
|
||||||
|
*/
|
||||||
|
var HL = (() => {
|
||||||
|
var __defProp = Object.defineProperty;
|
||||||
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
||||||
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
||||||
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
||||||
|
var __export = (target, all) => {
|
||||||
|
for (var name in all)
|
||||||
|
__defProp(target, name, { get: all[name], enumerable: true });
|
||||||
|
};
|
||||||
|
var __copyProps = (to, from, except, desc) => {
|
||||||
|
if (from && typeof from === "object" || typeof from === "function") {
|
||||||
|
for (let key of __getOwnPropNames(from))
|
||||||
|
if (!__hasOwnProp.call(to, key) && key !== except)
|
||||||
|
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
||||||
|
}
|
||||||
|
return to;
|
||||||
|
};
|
||||||
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
||||||
|
|
||||||
|
// packages/hairline/src/core/kernel.ts
|
||||||
|
var kernel_exports = {};
|
||||||
|
__export(kernel_exports, {
|
||||||
|
Cam: () => Cam,
|
||||||
|
EASE_LIFT: () => EASE_LIFT,
|
||||||
|
LAP: () => LAP,
|
||||||
|
bezier: () => bezier,
|
||||||
|
circ: () => circ,
|
||||||
|
clamp: () => clamp,
|
||||||
|
css: () => css,
|
||||||
|
disposer: () => disposer,
|
||||||
|
extremes: () => extremes,
|
||||||
|
facing: () => facing,
|
||||||
|
fade: () => fade,
|
||||||
|
fillet: () => fillet,
|
||||||
|
fit: () => fit,
|
||||||
|
flatDot: () => flatDot,
|
||||||
|
ghost: () => ghost,
|
||||||
|
hull: () => hull,
|
||||||
|
inject: () => inject,
|
||||||
|
lerp: () => lerp,
|
||||||
|
mk: () => mk,
|
||||||
|
open: () => open,
|
||||||
|
place: () => place,
|
||||||
|
pointer: () => pointer,
|
||||||
|
poly: () => poly,
|
||||||
|
prism: () => prism,
|
||||||
|
proj: () => proj,
|
||||||
|
put: () => put,
|
||||||
|
r2: () => r2,
|
||||||
|
rad: () => rad,
|
||||||
|
reducedMotion: () => reducedMotion,
|
||||||
|
reflect: () => reflect,
|
||||||
|
register: () => register,
|
||||||
|
ringAt: () => ringAt,
|
||||||
|
rings: () => rings,
|
||||||
|
rrect: () => rrect,
|
||||||
|
run: () => run,
|
||||||
|
seg: () => seg,
|
||||||
|
setReducedMotion: () => setReducedMotion,
|
||||||
|
solid: () => solid,
|
||||||
|
spring: () => spring,
|
||||||
|
stepS: () => stepS,
|
||||||
|
tdone: () => tdone,
|
||||||
|
tour: () => tour,
|
||||||
|
tset: () => tset,
|
||||||
|
tval: () => tval,
|
||||||
|
tween: () => tween,
|
||||||
|
unproj: () => unproj
|
||||||
|
});
|
||||||
|
|
||||||
|
// packages/hairline/src/core/iso.ts
|
||||||
|
var clamp = (v, a, b) => Math.max(a, Math.min(b, v));
|
||||||
|
var lerp = (a, b, t) => a + (b - a) * t;
|
||||||
|
var rad = (d) => d * Math.PI / 180;
|
||||||
|
var r2 = (n) => Math.round(n * 100) / 100;
|
||||||
|
var poly = (pts) => "M" + pts.map((p) => r2(p[0]) + " " + r2(p[1])).join("L") + "Z";
|
||||||
|
var seg = (a, b) => `M${r2(a[0])} ${r2(a[1])}L${r2(b[0])} ${r2(b[1])}`;
|
||||||
|
var open = (pts) => pts.length < 2 ? "" : "M" + pts.map((p) => r2(p[0]) + " " + r2(p[1])).join("L");
|
||||||
|
var Cam = (azDeg, k, S) => ({ az: rad(azDeg), k, S, ox: 0, oy: 0 });
|
||||||
|
function proj(C) {
|
||||||
|
const c = Math.cos(C.az), s = Math.sin(C.az), zf = Math.sqrt(1 - C.k * C.k);
|
||||||
|
return (x, y, z) => {
|
||||||
|
const X = x * c - y * s, Y = x * s + y * c;
|
||||||
|
return [C.ox + C.S * X, C.oy + C.S * (Y * C.k - z * zf)];
|
||||||
|
};
|
||||||
|
}
|
||||||
|
function unproj(C, sx, sy, z) {
|
||||||
|
const c = Math.cos(C.az), s = Math.sin(C.az), zf = Math.sqrt(1 - C.k * C.k);
|
||||||
|
const X = (sx - C.ox) / C.S, Y = ((sy - C.oy) / C.S + z * zf) / C.k;
|
||||||
|
return [X * c + Y * s, -X * s + Y * c];
|
||||||
|
}
|
||||||
|
function fit(C, pts, cx, cy) {
|
||||||
|
C.ox = 0;
|
||||||
|
C.oy = 0;
|
||||||
|
const P = proj(C);
|
||||||
|
let a = 1e9, b = -1e9, c = 1e9, d = -1e9;
|
||||||
|
for (const p of pts) {
|
||||||
|
const q = P(p[0], p[1], p[2]);
|
||||||
|
a = Math.min(a, q[0]);
|
||||||
|
b = Math.max(b, q[0]);
|
||||||
|
c = Math.min(c, q[1]);
|
||||||
|
d = Math.max(d, q[1]);
|
||||||
|
}
|
||||||
|
C.ox = cx - (a + b) / 2;
|
||||||
|
C.oy = cy - (c + d) / 2;
|
||||||
|
}
|
||||||
|
function rrect(u0, v0, u1, v1, r, n = 4) {
|
||||||
|
r = Math.max(0, Math.min(r, (u1 - u0) / 2, (v1 - v0) / 2));
|
||||||
|
const out = [];
|
||||||
|
for (const [cu, cv, a0] of [[u1 - r, v1 - r, 0], [u0 + r, v1 - r, 90], [u0 + r, v0 + r, 180], [u1 - r, v0 + r, 270]])
|
||||||
|
for (let k = 0; k <= n; k++) {
|
||||||
|
const a = rad(a0 + 90 * k / n), ca = Math.cos(a), sa = Math.sin(a);
|
||||||
|
out.push({ u: cu + r * ca, v: cv + r * sa, nu: ca, nv: sa });
|
||||||
|
}
|
||||||
|
return out;
|
||||||
|
}
|
||||||
|
function circ(R, n = 96) {
|
||||||
|
const out = [];
|
||||||
|
for (let k = 0; k < n; k++) {
|
||||||
|
const a = k / n * Math.PI * 2, ca = Math.cos(a), sa = Math.sin(a);
|
||||||
|
out.push({ u: R * ca, v: R * sa, nu: ca, nv: sa });
|
||||||
|
}
|
||||||
|
return out;
|
||||||
|
}
|
||||||
|
function hull(input) {
|
||||||
|
const pts = input.slice().sort((a, b) => a[0] - b[0] || a[1] - b[1]);
|
||||||
|
const x = (o, a, b) => (a[0] - o[0]) * (b[1] - o[1]) - (a[1] - o[1]) * (b[0] - o[0]);
|
||||||
|
const lo = [], up = [];
|
||||||
|
for (const p of pts) {
|
||||||
|
while (lo.length > 1 && x(lo[lo.length - 2], lo[lo.length - 1], p) <= 0) lo.pop();
|
||||||
|
lo.push(p);
|
||||||
|
}
|
||||||
|
for (let i = pts.length - 1; i >= 0; i--) {
|
||||||
|
const p = pts[i];
|
||||||
|
while (up.length > 1 && x(up[up.length - 2], up[up.length - 1], p) <= 0) up.pop();
|
||||||
|
up.push(p);
|
||||||
|
}
|
||||||
|
lo.pop();
|
||||||
|
up.pop();
|
||||||
|
return lo.concat(up);
|
||||||
|
}
|
||||||
|
var ringAt = (P, ring, z) => ring.map((q) => P(q.u, q.v, z));
|
||||||
|
var facing = (C) => {
|
||||||
|
const s = Math.sin(C.az), c = Math.cos(C.az);
|
||||||
|
return (q) => q.nu * s + q.nv * c >= -1e-6;
|
||||||
|
};
|
||||||
|
function run(ring, keep) {
|
||||||
|
const n = ring.length;
|
||||||
|
let s = -1;
|
||||||
|
for (let i = 0; i < n; i++) if (keep(ring[i]) && !keep(ring[(i + n - 1) % n])) {
|
||||||
|
s = i;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
if (s < 0) return keep(ring[0]) ? ring.slice() : [];
|
||||||
|
const out = [];
|
||||||
|
for (let k = 0; k < n && keep(ring[(s + k) % n]); k++) out.push(ring[(s + k) % n]);
|
||||||
|
return out;
|
||||||
|
}
|
||||||
|
function prism(P, front, ring, inner, z0, z1) {
|
||||||
|
return {
|
||||||
|
sil: poly(hull(ringAt(P, ring, z1).concat(ringAt(P, ring, z0)))),
|
||||||
|
crease: inner ? open(ringAt(P, run(inner, front), z1)) : ""
|
||||||
|
};
|
||||||
|
}
|
||||||
|
var rings = (x0, y0, x1, y1, r, b) => [
|
||||||
|
rrect(x0, y0, x1, y1, r),
|
||||||
|
rrect(x0 + b, y0 + b, x1 - b, y1 - b, Math.max(0.3, r - b))
|
||||||
|
];
|
||||||
|
function extremes(P, ring) {
|
||||||
|
const pr = ring.map((q) => P(q.u, q.v, 0));
|
||||||
|
let a = 0, b = 0, c = 0;
|
||||||
|
pr.forEach((p, k) => {
|
||||||
|
if (p[0] < pr[a][0]) a = k;
|
||||||
|
if (p[0] > pr[b][0]) b = k;
|
||||||
|
if (p[1] > pr[c][1]) c = k;
|
||||||
|
});
|
||||||
|
return [ring[a], ring[b], ring[c]];
|
||||||
|
}
|
||||||
|
function fillet(pts, rs, n = 4) {
|
||||||
|
const m = pts.length, out = [];
|
||||||
|
for (let i = 0; i < m; i++) {
|
||||||
|
const a = pts[(i + m - 1) % m], p = pts[i], b = pts[(i + 1) % m];
|
||||||
|
const la = Math.hypot(a[0] - p[0], a[1] - p[1]), lb = Math.hypot(b[0] - p[0], b[1] - p[1]);
|
||||||
|
const t = Math.min(rs[i], la / 2, lb / 2);
|
||||||
|
const p1 = [p[0] + (a[0] - p[0]) / la * t, p[1] + (a[1] - p[1]) / la * t];
|
||||||
|
const p2 = [p[0] + (b[0] - p[0]) / lb * t, p[1] + (b[1] - p[1]) / lb * t];
|
||||||
|
for (let k = 0; k <= n; k++) {
|
||||||
|
const s = k / n, w = 1 - s;
|
||||||
|
out.push([w * w * p1[0] + 2 * w * s * p[0] + s * s * p2[0], w * w * p1[1] + 2 * w * s * p[1] + s * s * p2[1]]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return out;
|
||||||
|
}
|
||||||
|
function ghost(P, front, ring, z0, depth) {
|
||||||
|
const f = run(ring, front), lowP = ringAt(P, f, z0 - depth);
|
||||||
|
return {
|
||||||
|
d: open(lowP) + [f[0], f[f.length - 1]].map((q) => seg(P(q.u, q.v, z0), P(q.u, q.v, z0 - depth))).join(""),
|
||||||
|
y0: Math.min(...ringAt(P, f, z0).map((p) => p[1])),
|
||||||
|
y1: Math.max(...lowP.map((p) => p[1])) + 2
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
// packages/hairline/src/core/motion.ts
|
||||||
|
var reduced = false;
|
||||||
|
var setReducedMotion = (on) => {
|
||||||
|
reduced = on;
|
||||||
|
};
|
||||||
|
var reducedMotion = () => reduced;
|
||||||
|
function spring(x, o = {}) {
|
||||||
|
return { x, v: 0, t: x, k: o.k ?? 100, c: o.c ?? 18, m: o.m ?? 1, eps: o.eps ?? 0.01 };
|
||||||
|
}
|
||||||
|
function stepS(sp, dt) {
|
||||||
|
if (reduced) {
|
||||||
|
sp.x = sp.t;
|
||||||
|
sp.v = 0;
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
const n = Math.max(1, Math.ceil(dt * 240)), h = dt / n;
|
||||||
|
for (let i = 0; i < n; i++) {
|
||||||
|
const a = (-sp.k * (sp.x - sp.t) - sp.c * sp.v) / sp.m;
|
||||||
|
sp.v += a * h;
|
||||||
|
sp.x += sp.v * h;
|
||||||
|
}
|
||||||
|
if (Math.abs(sp.x - sp.t) < sp.eps && Math.abs(sp.v) < sp.eps * 10) {
|
||||||
|
sp.x = sp.t;
|
||||||
|
sp.v = 0;
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
function bezier(x1, y1, x2, y2) {
|
||||||
|
const cx = 3 * x1, bx = 3 * (x2 - x1) - cx, ax = 1 - cx - bx;
|
||||||
|
const cy = 3 * y1, by = 3 * (y2 - y1) - cy, ay = 1 - cy - by;
|
||||||
|
const X = (u) => ((ax * u + bx) * u + cx) * u;
|
||||||
|
const Y = (u) => ((ay * u + by) * u + cy) * u;
|
||||||
|
const dX = (u) => (3 * ax * u + 2 * bx) * u + cx;
|
||||||
|
return (t) => {
|
||||||
|
if (t <= 0) return 0;
|
||||||
|
if (t >= 1) return 1;
|
||||||
|
let u = t;
|
||||||
|
for (let i = 0; i < 8; i++) {
|
||||||
|
const e = X(u) - t;
|
||||||
|
if (Math.abs(e) < 1e-5) break;
|
||||||
|
const d = dX(u);
|
||||||
|
if (Math.abs(d) < 1e-6) break;
|
||||||
|
u -= e / d;
|
||||||
|
}
|
||||||
|
if (!(u >= 0 && u <= 1) || Math.abs(X(u) - t) > 1e-4) {
|
||||||
|
let lo = 0, hi = 1;
|
||||||
|
u = t;
|
||||||
|
for (let i = 0; i < 24; i++) {
|
||||||
|
if (X(u) < t) lo = u;
|
||||||
|
else hi = u;
|
||||||
|
u = (lo + hi) / 2;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return Y(u);
|
||||||
|
};
|
||||||
|
}
|
||||||
|
var EASE_LIFT = bezier(0.32, 0.72, 0, 1);
|
||||||
|
var tween = (v, dur = 700) => ({ from: v, to: v, t0: -1e9, dur });
|
||||||
|
var tval = (tw, now) => {
|
||||||
|
const p = clamp((now - tw.t0) / tw.dur, 0, 1);
|
||||||
|
return tw.from + (tw.to - tw.from) * (reduced ? 1 : EASE_LIFT(p));
|
||||||
|
};
|
||||||
|
var tset = (tw, to, now, delay) => {
|
||||||
|
if (tw.to === to) return;
|
||||||
|
tw.from = tval(tw, now);
|
||||||
|
tw.to = to;
|
||||||
|
tw.t0 = now + delay;
|
||||||
|
};
|
||||||
|
var tdone = (tw, now) => reduced || now >= tw.t0 + tw.dur;
|
||||||
|
|
||||||
|
// packages/hairline/src/core/stage.ts
|
||||||
|
var NS = "http://www.w3.org/2000/svg";
|
||||||
|
function mk(tag, attrs, parent) {
|
||||||
|
const e = document.createElementNS(NS, tag);
|
||||||
|
if (attrs) for (const k in attrs) e.setAttribute(k, String(attrs[k]));
|
||||||
|
if (parent) parent.appendChild(e);
|
||||||
|
return e;
|
||||||
|
}
|
||||||
|
function solid(parent) {
|
||||||
|
const g = mk("g", {}, parent);
|
||||||
|
return { g, sil: mk("path", { class: "sil" }, g), cr: mk("path", { class: "nf lo" }, g) };
|
||||||
|
}
|
||||||
|
var put = (el, s) => {
|
||||||
|
el.sil.setAttribute("d", s.sil);
|
||||||
|
el.cr.setAttribute("d", s.crease);
|
||||||
|
};
|
||||||
|
var flatDot = (parent, C, r, cls) => mk("ellipse", { rx: r2(r * C.S), ry: r2(r * C.S * C.k), class: cls }, parent);
|
||||||
|
var place = (el, q) => {
|
||||||
|
el.setAttribute("cx", String(r2(q[0])));
|
||||||
|
el.setAttribute("cy", String(r2(q[1])));
|
||||||
|
};
|
||||||
|
var fid = 0;
|
||||||
|
function fade(svg, y0, y1, a0 = 0.7) {
|
||||||
|
const id = "hl-fd" + ++fid, defs = mk("defs", {}, svg);
|
||||||
|
const lg = mk("linearGradient", { id: id + "g", gradientUnits: "userSpaceOnUse", x1: 0, y1: r2(y0), x2: 0, y2: r2(y1) }, defs);
|
||||||
|
mk("stop", { offset: 0, "stop-color": "#fff", "stop-opacity": a0 }, lg);
|
||||||
|
mk("stop", { offset: 1, "stop-color": "#fff", "stop-opacity": 0 }, lg);
|
||||||
|
const m = mk("mask", { id, maskUnits: "userSpaceOnUse", x: 0, y: 0, width: 400, height: 320 }, defs);
|
||||||
|
mk("rect", { x: 0, y: 0, width: 400, height: 320, fill: `url(#${id}g)` }, m);
|
||||||
|
return `url(#${id})`;
|
||||||
|
}
|
||||||
|
function reflect(svg, parent, P, front, ring, z0, depth) {
|
||||||
|
const r = ghost(P, front, ring, z0, depth);
|
||||||
|
const gh = mk("g", { class: "ghost", mask: fade(svg, r.y0, r.y1) }, parent);
|
||||||
|
mk("path", { d: r.d }, gh);
|
||||||
|
}
|
||||||
|
var boards = [];
|
||||||
|
var byStage = /* @__PURE__ */ new Map();
|
||||||
|
var raf = 0;
|
||||||
|
var last = 0;
|
||||||
|
var io = null;
|
||||||
|
var rm = null;
|
||||||
|
function frame() {
|
||||||
|
const now = performance.now();
|
||||||
|
const dt = Math.min(0.05, Math.max(0, (now - last) / 1e3));
|
||||||
|
last = now;
|
||||||
|
let any = false;
|
||||||
|
for (const b of boards.slice()) if (b.vis && b.awake) {
|
||||||
|
try {
|
||||||
|
b.awake = !!b.tick(dt, now);
|
||||||
|
} catch (err) {
|
||||||
|
b.awake = false;
|
||||||
|
setTimeout(() => {
|
||||||
|
throw err;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
any = any || b.awake;
|
||||||
|
}
|
||||||
|
raf = any ? requestAnimationFrame(frame) : 0;
|
||||||
|
}
|
||||||
|
function wake(b) {
|
||||||
|
b.awake = true;
|
||||||
|
if (!raf) {
|
||||||
|
last = performance.now();
|
||||||
|
raf = requestAnimationFrame(frame);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
var onMotion = () => {
|
||||||
|
setReducedMotion(!!rm?.matches);
|
||||||
|
boards.forEach(wake);
|
||||||
|
};
|
||||||
|
function start() {
|
||||||
|
if (io) return;
|
||||||
|
io = new IntersectionObserver((es) => {
|
||||||
|
for (const e of es) {
|
||||||
|
const set = byStage.get(e.target);
|
||||||
|
if (!set) continue;
|
||||||
|
for (const b of set) {
|
||||||
|
b.vis = e.isIntersecting;
|
||||||
|
if (b.vis) wake(b);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}, { rootMargin: "80px" });
|
||||||
|
rm = matchMedia("(prefers-reduced-motion: reduce)");
|
||||||
|
setReducedMotion(rm.matches);
|
||||||
|
rm.addEventListener("change", onMotion);
|
||||||
|
}
|
||||||
|
function stop() {
|
||||||
|
if (raf) cancelAnimationFrame(raf);
|
||||||
|
raf = 0;
|
||||||
|
io?.disconnect();
|
||||||
|
io = null;
|
||||||
|
rm?.removeEventListener("change", onMotion);
|
||||||
|
rm = null;
|
||||||
|
}
|
||||||
|
function register(stage, tick) {
|
||||||
|
start();
|
||||||
|
const b = { stage, tick, vis: false, awake: true };
|
||||||
|
boards.push(b);
|
||||||
|
const peers = byStage.get(stage);
|
||||||
|
if (peers) {
|
||||||
|
for (const p of peers) b.vis = p.vis;
|
||||||
|
peers.add(b);
|
||||||
|
if (b.vis) wake(b);
|
||||||
|
} else {
|
||||||
|
byStage.set(stage, /* @__PURE__ */ new Set([b]));
|
||||||
|
io.observe(stage);
|
||||||
|
}
|
||||||
|
tick(0, performance.now());
|
||||||
|
let gone = false;
|
||||||
|
return {
|
||||||
|
wake: () => {
|
||||||
|
if (!gone) wake(b);
|
||||||
|
},
|
||||||
|
unregister: () => {
|
||||||
|
if (gone) return;
|
||||||
|
gone = true;
|
||||||
|
boards = boards.filter((x) => x !== b);
|
||||||
|
const set = byStage.get(stage);
|
||||||
|
if (set) {
|
||||||
|
set.delete(b);
|
||||||
|
if (!set.size) {
|
||||||
|
byStage.delete(stage);
|
||||||
|
io?.unobserve(stage);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (!boards.length) stop();
|
||||||
|
}
|
||||||
|
};
|
||||||
|
}
|
||||||
|
var handlers = /* @__PURE__ */ new WeakMap();
|
||||||
|
var touring = /* @__PURE__ */ new WeakMap();
|
||||||
|
function pointer(stage, on) {
|
||||||
|
handlers.set(stage, on);
|
||||||
|
let tm = 0;
|
||||||
|
const pt = (e) => {
|
||||||
|
const r = stage.getBoundingClientRect();
|
||||||
|
return [(e.clientX - r.left) / r.width * 400, (e.clientY - r.top) / r.height * 320];
|
||||||
|
};
|
||||||
|
const move = (e) => {
|
||||||
|
clearTimeout(tm);
|
||||||
|
touring.get(stage)?.hold();
|
||||||
|
on.move(pt(e), e);
|
||||||
|
};
|
||||||
|
const down = (e) => {
|
||||||
|
clearTimeout(tm);
|
||||||
|
touring.get(stage)?.hold();
|
||||||
|
if (e.pointerType !== "mouse") stage.releasePointerCapture?.(e.pointerId);
|
||||||
|
if (on.down) on.down(pt(e), e);
|
||||||
|
else on.move(pt(e), e);
|
||||||
|
};
|
||||||
|
const leave = (e) => {
|
||||||
|
clearTimeout(tm);
|
||||||
|
tm = window.setTimeout(() => {
|
||||||
|
on.leave(e);
|
||||||
|
touring.get(stage)?.release();
|
||||||
|
}, e.pointerType === "mouse" ? 0 : 1400);
|
||||||
|
};
|
||||||
|
stage.addEventListener("pointermove", move);
|
||||||
|
stage.addEventListener("pointerdown", down);
|
||||||
|
stage.addEventListener("pointerleave", leave);
|
||||||
|
return () => {
|
||||||
|
clearTimeout(tm);
|
||||||
|
if (handlers.get(stage) === on) handlers.delete(stage);
|
||||||
|
stage.removeEventListener("pointermove", move);
|
||||||
|
stage.removeEventListener("pointerdown", down);
|
||||||
|
stage.removeEventListener("pointerleave", leave);
|
||||||
|
};
|
||||||
|
}
|
||||||
|
var LAP = [[128, 150], [200, 118], [272, 150], [200, 206], null];
|
||||||
|
var TRAVEL = 900;
|
||||||
|
var DWELL = 1200;
|
||||||
|
var REST = 1800;
|
||||||
|
var RESUME = 1200;
|
||||||
|
var STAGGER = 450;
|
||||||
|
var GHOST = { pointerType: "ghost" };
|
||||||
|
var started = 0;
|
||||||
|
function entry([x, y]) {
|
||||||
|
const dx = x - 200, dy = y - 160;
|
||||||
|
if (!dx && !dy) return [200, 320];
|
||||||
|
const k = Math.min(dx ? (dx > 0 ? 200 : -200) / dx : Infinity, dy ? (dy > 0 ? 160 : -160) / dy : Infinity);
|
||||||
|
return [200 + dx * k, 160 + dy * k];
|
||||||
|
}
|
||||||
|
function tour(stage, stops, onStop) {
|
||||||
|
let i = 0;
|
||||||
|
let wait = RESUME + STAGGER * (started++ % 4);
|
||||||
|
let t = -1;
|
||||||
|
let at = null;
|
||||||
|
let origin = [200, 320];
|
||||||
|
let hand = false, keys = stage.contains(stage.ownerDocument.activeElement);
|
||||||
|
let gone = false;
|
||||||
|
const leave = () => {
|
||||||
|
at = null;
|
||||||
|
t = -1;
|
||||||
|
handlers.get(stage)?.leave(GHOST);
|
||||||
|
};
|
||||||
|
const tick = (dt) => {
|
||||||
|
if (hand || keys || !stops.length) return false;
|
||||||
|
if (reducedMotion()) {
|
||||||
|
if (at) leave();
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
if (wait > 0) {
|
||||||
|
wait -= dt * 1e3;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
const stop2 = stops[i];
|
||||||
|
if (stop2 === null) {
|
||||||
|
if (at) leave();
|
||||||
|
onStop?.(i);
|
||||||
|
i = (i + 1) % stops.length;
|
||||||
|
wait = REST;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
const h = handlers.get(stage);
|
||||||
|
if (!h) return true;
|
||||||
|
if (t < 0) {
|
||||||
|
origin = at ?? entry(stop2);
|
||||||
|
t = 0;
|
||||||
|
}
|
||||||
|
t = Math.min(TRAVEL, t + dt * 1e3);
|
||||||
|
const k = EASE_LIFT(t / TRAVEL);
|
||||||
|
at = [origin[0] + (stop2[0] - origin[0]) * k, origin[1] + (stop2[1] - origin[1]) * k];
|
||||||
|
h.move(at, GHOST);
|
||||||
|
if (t < TRAVEL) return true;
|
||||||
|
onStop?.(i);
|
||||||
|
i = (i + 1) % stops.length;
|
||||||
|
t = -1;
|
||||||
|
wait = DWELL;
|
||||||
|
return true;
|
||||||
|
};
|
||||||
|
const take = () => {
|
||||||
|
at = null;
|
||||||
|
t = -1;
|
||||||
|
};
|
||||||
|
const give = () => {
|
||||||
|
if (hand || keys) return;
|
||||||
|
i = 0;
|
||||||
|
t = -1;
|
||||||
|
wait = RESUME;
|
||||||
|
board.wake();
|
||||||
|
};
|
||||||
|
const me = {
|
||||||
|
hold: () => {
|
||||||
|
hand = true;
|
||||||
|
take();
|
||||||
|
},
|
||||||
|
release: () => {
|
||||||
|
if (!hand) return;
|
||||||
|
hand = false;
|
||||||
|
give();
|
||||||
|
}
|
||||||
|
};
|
||||||
|
const focusIn = () => {
|
||||||
|
keys = true;
|
||||||
|
take();
|
||||||
|
};
|
||||||
|
const focusOut = (e) => {
|
||||||
|
if (keys && !stage.contains(e.relatedTarget)) {
|
||||||
|
keys = false;
|
||||||
|
give();
|
||||||
|
}
|
||||||
|
};
|
||||||
|
stage.addEventListener("focusin", focusIn);
|
||||||
|
stage.addEventListener("focusout", focusOut);
|
||||||
|
touring.set(stage, me);
|
||||||
|
const board = register(stage, tick);
|
||||||
|
return {
|
||||||
|
stop: () => {
|
||||||
|
if (gone) return;
|
||||||
|
gone = true;
|
||||||
|
board.unregister();
|
||||||
|
stage.removeEventListener("focusin", focusIn);
|
||||||
|
stage.removeEventListener("focusout", focusOut);
|
||||||
|
if (touring.get(stage) === me) touring.delete(stage);
|
||||||
|
if (at) leave();
|
||||||
|
}
|
||||||
|
};
|
||||||
|
}
|
||||||
|
function disposer() {
|
||||||
|
let fns = [];
|
||||||
|
return {
|
||||||
|
add: (fn) => {
|
||||||
|
fns.push(fn);
|
||||||
|
},
|
||||||
|
on: (target, type, fn, opts) => {
|
||||||
|
const h = fn;
|
||||||
|
target.addEventListener(type, h, opts);
|
||||||
|
fns.push(() => target.removeEventListener(type, h, opts));
|
||||||
|
},
|
||||||
|
dispose: () => {
|
||||||
|
const run2 = fns;
|
||||||
|
fns = [];
|
||||||
|
for (let i = run2.length - 1; i >= 0; i--) run2[i]();
|
||||||
|
}
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
// packages/hairline/src/core/styles.ts
|
||||||
|
var LIGHT = { plate: "#ffffff", hi: "#232327", edge: "#a4a4ac", mid: "#c3c3c9", lo: "#e0e0e4" };
|
||||||
|
var DARK = { plate: "#08090a", hi: "#d0d6e0", edge: "#5b5d64", mid: "#3e3e44", lo: "#29292d" };
|
||||||
|
var KEYS = ["plate", "hi", "edge", "mid", "lo"];
|
||||||
|
var vars = (p) => KEYS.map((k) => `--hl-${k}:var(--hairline-${k},${p[k]});`).join("");
|
||||||
|
var EASE = "cubic-bezier(0.5,0,0.1,1)";
|
||||||
|
var SVG = ":where([data-hairline]>svg)";
|
||||||
|
function css(lightDark) {
|
||||||
|
const both = Object.fromEntries(KEYS.map((k) => [k, `light-dark(${LIGHT[k]},${DARK[k]})`]));
|
||||||
|
return [
|
||||||
|
// the box, and the palette: light unless something below says otherwise
|
||||||
|
`:where([data-hairline]){display:block;position:relative;aspect-ratio:5/4;touch-action:pan-y;user-select:none;-webkit-user-select:none;--hl-sw:var(--hairline-stroke,0.9);${vars(LIGHT)}}`,
|
||||||
|
// the page's color-scheme
|
||||||
|
lightDark ? `:where([data-hairline]){${vars(both)}}` : "",
|
||||||
|
// an ancestor that says dark
|
||||||
|
`:where(.dark,[data-theme="dark"]) :where([data-hairline]){${vars(DARK)}}`,
|
||||||
|
// the figure's own theme option
|
||||||
|
`:where([data-hairline][data-hairline-theme="light"]){${vars(LIGHT)}}`,
|
||||||
|
`:where([data-hairline][data-hairline-theme="dark"]){${vars(DARK)}}`,
|
||||||
|
`:where([data-hairline]:focus-visible){outline:1.5px solid var(--hl-hi);outline-offset:2px}`,
|
||||||
|
`${SVG}{position:absolute;inset:0;width:100%;height:100%;display:block}`,
|
||||||
|
// Riffle's live region: read, not seen
|
||||||
|
`:where([data-hairline]>[data-hairline-live]){position:absolute;width:1px;height:1px;margin:-1px;padding:0;border:0;overflow:hidden;clip-path:inset(50%);white-space:nowrap}`,
|
||||||
|
// the drawing: plates are filled with the plate colour and painted back to front
|
||||||
|
`${SVG} :where(path,polygon,ellipse,line){fill:var(--hl-plate);stroke:var(--hl-mid);stroke-width:var(--hl-sw);vector-effect:non-scaling-stroke;stroke-linejoin:round;stroke-linecap:round;transition:stroke 260ms ${EASE}}`,
|
||||||
|
`${SVG} :where(.nf){fill:none}`,
|
||||||
|
`${SVG} :where(.fo){stroke:none}`,
|
||||||
|
`${SVG} :where(.sil){stroke:var(--hl-edge)}`,
|
||||||
|
`${SVG} :where(.hi){stroke:var(--hl-hi)}`,
|
||||||
|
`${SVG} :where(.lo){stroke:var(--hl-lo)}`,
|
||||||
|
`${SVG} :where(.dash){stroke-dasharray:1 3}`,
|
||||||
|
`${SVG} :where(.dot){stroke:none;fill:var(--hl-hi);transition:fill 260ms ${EASE}}`,
|
||||||
|
`${SVG} :where(.dot.m){fill:var(--hl-edge)}`,
|
||||||
|
`${SVG} :where(.dot.off){fill:var(--hl-lo)}`,
|
||||||
|
`${SVG} :where(.ghost path){fill:none;stroke:var(--hl-mid)}`
|
||||||
|
].join("");
|
||||||
|
}
|
||||||
|
var done = /* @__PURE__ */ new WeakSet();
|
||||||
|
function inject(root) {
|
||||||
|
if (done.has(root)) return;
|
||||||
|
done.add(root);
|
||||||
|
const doc = root.nodeType === 9 ? root : root.ownerDocument;
|
||||||
|
const win = doc.defaultView;
|
||||||
|
const text = css(!!win?.CSS?.supports?.("color", "light-dark(#000,#fff)"));
|
||||||
|
if (win && "adoptedStyleSheets" in root) {
|
||||||
|
try {
|
||||||
|
const sheet = new win.CSSStyleSheet();
|
||||||
|
sheet.replaceSync(text);
|
||||||
|
root.adoptedStyleSheets = [...root.adoptedStyleSheets, sheet];
|
||||||
|
return;
|
||||||
|
} catch {
|
||||||
|
}
|
||||||
|
}
|
||||||
|
const style = doc.createElement("style");
|
||||||
|
style.setAttribute("data-hairline-style", "");
|
||||||
|
style.textContent = text;
|
||||||
|
(root.nodeType === 9 ? doc.head ?? doc.documentElement : root).appendChild(style);
|
||||||
|
}
|
||||||
|
return __toCommonJS(kernel_exports);
|
||||||
|
})();
|
||||||
|
/* /hairline kernel */
|
||||||
125
src/hairline/padlock.js
Normal file
125
src/hairline/padlock.js
Normal file
@@ -0,0 +1,125 @@
|
|||||||
|
/**
|
||||||
|
* Padlock: an unlocked padlock standing on its reflection. At rest it is ajar,
|
||||||
|
* the shackle lifted out of its hole and turned a little, as in the ofsaver
|
||||||
|
* mark. As the pointer comes closer the shackle rises the rest of the way and
|
||||||
|
* swings open round its long leg, away to the back, on one spring. The
|
||||||
|
* keyhole is the bright mark at rest; once the lock is open the bright goes to
|
||||||
|
* the shackle. The slider is the reach, in viewBox units.
|
||||||
|
*
|
||||||
|
* The pattern: one continuous value. A spring, a falloff by distance measured
|
||||||
|
* from a fixed point on the resting body, and a rest that is a composition.
|
||||||
|
*/
|
||||||
|
const {
|
||||||
|
Cam, clamp, facing, fit, lerp, poly, prism, proj, rad, rings, rrect, ringAt, seg, spring, stepS,
|
||||||
|
disposer, mk, place, pointer, put, reflect, register, solid,
|
||||||
|
} = HL;
|
||||||
|
|
||||||
|
const W = 64, D = 26, H = 48, BR = 9, BB = 1.8; // the body: footprint W × D, height H
|
||||||
|
const A = 13, RC = (W - 2 * A) / 2, T = 3.4, TK = 2.2; // the shackle: legs at A and W − A, half width T, half depth TK
|
||||||
|
const LEG = 12, LMAX = 12, TH = 78; // straight leg above the body, the lift, the widest swing
|
||||||
|
const YC = D / 2, REST = 0.4;
|
||||||
|
|
||||||
|
/** The shackle's band as a closed outline in its own plane: u along the span from the long leg, w up. */
|
||||||
|
function band(lift) {
|
||||||
|
const z1 = H + LEG + lift, bl = H, br = H + lift, pts = [];
|
||||||
|
const arc = (r, a0, a1) => { for (let k = 0; k <= 12; k++) { const a = rad(lerp(a0, a1, k / 12)); pts.push([RC + r * Math.cos(a), z1 + r * Math.sin(a)]); } };
|
||||||
|
pts.push([-T, bl]);
|
||||||
|
arc(RC + T, 180, 0);
|
||||||
|
pts.push([2 * RC + T, br], [2 * RC - T, br]);
|
||||||
|
arc(RC - T, 0, 180);
|
||||||
|
pts.push([T, bl]);
|
||||||
|
return pts;
|
||||||
|
}
|
||||||
|
|
||||||
|
/** Lift first, then the swing: what a real shackle does once the key turns. */
|
||||||
|
const lift = (o) => LMAX * clamp(o / 0.45, 0, 1);
|
||||||
|
const swing = (o) => -TH * clamp((o - 0.25) / 0.75, 0, 1);
|
||||||
|
|
||||||
|
function mount({ stage, svg, read }, value) {
|
||||||
|
const bag = disposer();
|
||||||
|
let reach = value;
|
||||||
|
|
||||||
|
// Fitted to the widest pose: shackle fully up and swung out towards the viewer.
|
||||||
|
const C = Cam(45, 0.5, 2.08);
|
||||||
|
const top = H + LEG + LMAX + RC + T;
|
||||||
|
fit(C, [[0, 0, 0], [W, D, 0], [W, 0, 0], [0, D, 0], [A, YC, top], [W - A + T, YC, top - RC],
|
||||||
|
[A, YC - 2 * RC - T, H + LEG + LMAX], [A - T, YC - RC, top], [A, YC, -16]], 200, 166);
|
||||||
|
const P = proj(C), front = facing(C);
|
||||||
|
|
||||||
|
const g = mk("g", {}, svg);
|
||||||
|
const [ring, inner] = rings(0, 0, W, D, BR, BB);
|
||||||
|
reflect(svg, g, P, front, ring, 0, 16);
|
||||||
|
|
||||||
|
// The body, with its two shackle holes on the top and the keyhole on the near face.
|
||||||
|
const body = solid(g);
|
||||||
|
put(body, prism(P, front, ring, inner, 0, H));
|
||||||
|
const hole = rrect(W - A - T - 0.6, YC - TK - 0.6, W - A + T + 0.6, YC + TK + 0.6, 2.2, 3);
|
||||||
|
mk("path", { d: poly(ringAt(P, hole, H)), class: "nf lo" }, g);
|
||||||
|
const kz = H * 0.56, ky = D;
|
||||||
|
mk("path", { d: seg(P(W / 2, ky, kz - 2), P(W / 2, ky, kz - 11)), class: "nf" }, g);
|
||||||
|
const key = mk("circle", { r: 2.1, class: "dot" }, g);
|
||||||
|
place(key, P(W / 2, ky, kz));
|
||||||
|
|
||||||
|
// The shackle: two outlines of the band, a tube's depth apart. Whichever faces the camera is painted last.
|
||||||
|
const sh = mk("g", {}, g);
|
||||||
|
const back = mk("path", { class: "lo" }, sh), face = mk("path", { class: "sil" }, sh);
|
||||||
|
|
||||||
|
const o = spring(REST, { eps: 0.002 });
|
||||||
|
let drawn = NaN;
|
||||||
|
|
||||||
|
function draw() {
|
||||||
|
if (Math.abs(o.x - drawn) < 1e-4) return;
|
||||||
|
drawn = o.x;
|
||||||
|
const th = rad(swing(o.x)), c = Math.cos(th), s = Math.sin(th);
|
||||||
|
const pts = band(lift(o.x));
|
||||||
|
// the band's normal; facing the camera when it points towards +x +y
|
||||||
|
const nx = -s, ny = c, near = nx + ny >= 0 ? 1 : -1;
|
||||||
|
const at = (k) => pts.map(([u, w]) => P(A + u * c + k * nx * TK, YC + u * s + k * ny * TK, w));
|
||||||
|
back.setAttribute("d", poly(at(-near)));
|
||||||
|
face.setAttribute("d", poly(at(near)));
|
||||||
|
}
|
||||||
|
|
||||||
|
const B = register(stage, (dt) => { const m = stepS(o, dt); draw(); return m; });
|
||||||
|
bag.add(B.unregister);
|
||||||
|
draw();
|
||||||
|
|
||||||
|
// Distance is measured from a fixed point on the resting body, so the swing never moves the target.
|
||||||
|
const mid = P(W / 2, YC, H * 0.6);
|
||||||
|
let lit = false;
|
||||||
|
function aim(target) {
|
||||||
|
o.t = target;
|
||||||
|
const open = target > 0.72;
|
||||||
|
if (open !== lit) {
|
||||||
|
lit = open;
|
||||||
|
face.classList.toggle("hi", open);
|
||||||
|
key.setAttribute("class", open ? "dot m" : "dot");
|
||||||
|
}
|
||||||
|
read.textContent = target === REST ? "rest" : "open " + Math.round(-swing(target)) + "°";
|
||||||
|
B.wake();
|
||||||
|
}
|
||||||
|
|
||||||
|
function move([x, y]) {
|
||||||
|
const d = Math.hypot(x - mid[0], y - mid[1]) / reach;
|
||||||
|
// full inside a third of the reach, easing down to ajar at its edge, and no further
|
||||||
|
const k = d <= 0.33 ? 1 : d >= 1 ? 0 : 1 - (d - 0.33) / 0.67;
|
||||||
|
aim(Math.round(lerp(REST, 1, k * k * (3 - 2 * k)) * 100) / 100);
|
||||||
|
}
|
||||||
|
|
||||||
|
aim(REST);
|
||||||
|
bag.add(pointer(stage, { move, leave: () => aim(REST) }));
|
||||||
|
bag.add(() => svg.replaceChildren());
|
||||||
|
|
||||||
|
return {
|
||||||
|
set: (v) => { reach = v; },
|
||||||
|
destroy: bag.dispose,
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
hairline({
|
||||||
|
name: "padlock",
|
||||||
|
means: "An unlocked padlock, ajar at rest: as the pointer comes closer, the shackle lifts and swings wide open.",
|
||||||
|
rules: [1, 3, 5, 8],
|
||||||
|
range: [90, 150, 220],
|
||||||
|
tour: [[330, 70], [270, 120], [210, 150], null],
|
||||||
|
mount,
|
||||||
|
});
|
||||||
217
src/install.css
Normal file
217
src/install.css
Normal file
@@ -0,0 +1,217 @@
|
|||||||
|
/* -------------------------------- Install -------------------------------- */
|
||||||
|
.install { padding: 128px 0; }
|
||||||
|
.install__grid {
|
||||||
|
display: grid;
|
||||||
|
grid-template-columns: repeat(3, 1fr);
|
||||||
|
gap: 16px;
|
||||||
|
margin: 0;
|
||||||
|
padding: 0;
|
||||||
|
list-style: none;
|
||||||
|
}
|
||||||
|
.install__step {
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
border-radius: 16px;
|
||||||
|
background: var(--raised);
|
||||||
|
overflow: hidden;
|
||||||
|
}
|
||||||
|
.install__media {
|
||||||
|
position: relative;
|
||||||
|
height: 248px;
|
||||||
|
padding: 24px 24px 0;
|
||||||
|
display: flex;
|
||||||
|
align-items: flex-end;
|
||||||
|
overflow: hidden;
|
||||||
|
}
|
||||||
|
.install__media .scene { width: 100%; }
|
||||||
|
.install__copy { padding: 24px; }
|
||||||
|
.install__n { display: block; margin-bottom: 8px; font-size: 12px; color: var(--accent-ink); }
|
||||||
|
.install__copy h3 { font-size: 20px; line-height: 28px; font-weight: 500; letter-spacing: -0.01em; }
|
||||||
|
.install__copy p { margin-top: 8px; font-size: 14px; line-height: 20px; color: var(--text-2); text-wrap: pretty; }
|
||||||
|
|
||||||
|
.install__foot { display: flex; flex-direction: column; align-items: center; gap: 16px; margin-top: 48px; text-align: center; }
|
||||||
|
.install__note { max-width: 32rem; font-size: 14px; line-height: 20px; color: var(--text-3); text-wrap: pretty; }
|
||||||
|
.install__note strong { font-weight: 500; color: var(--text-2); }
|
||||||
|
|
||||||
|
/* A small browser window, cut off by the card's bottom edge */
|
||||||
|
.iw {
|
||||||
|
border-radius: 12px 12px 0 0;
|
||||||
|
background: var(--card);
|
||||||
|
border: 1px solid var(--line);
|
||||||
|
border-bottom: 0;
|
||||||
|
box-shadow: 0 8px 24px rgba(11, 22, 32, .06);
|
||||||
|
overflow: hidden;
|
||||||
|
}
|
||||||
|
.iw__bar { display: flex; align-items: center; gap: 6px; height: 32px; padding: 0 12px; border-bottom: 1px solid var(--line); background: var(--bg); }
|
||||||
|
.iw__bar i { width: 8px; height: 8px; border-radius: 50%; background: var(--raised-2); }
|
||||||
|
.iw__bar .mono { margin-left: 8px; font-size: 11px; color: var(--text-3); }
|
||||||
|
.iw__body { position: relative; height: 192px; padding: 16px; }
|
||||||
|
|
||||||
|
/* Shared switch, Chrome style */
|
||||||
|
.toggle {
|
||||||
|
position: relative;
|
||||||
|
flex: none;
|
||||||
|
width: 28px;
|
||||||
|
height: 16px;
|
||||||
|
border-radius: 8px;
|
||||||
|
background: var(--raised-2);
|
||||||
|
transition: background-color 300ms var(--ease);
|
||||||
|
}
|
||||||
|
.toggle span {
|
||||||
|
position: absolute;
|
||||||
|
top: 2px;
|
||||||
|
left: 2px;
|
||||||
|
width: 12px;
|
||||||
|
height: 12px;
|
||||||
|
border-radius: 50%;
|
||||||
|
background: #fff;
|
||||||
|
box-shadow: 0 1px 2px rgba(11, 22, 32, .2);
|
||||||
|
transition: transform 300ms var(--ease);
|
||||||
|
}
|
||||||
|
.toggle.is-on { background: var(--accent); }
|
||||||
|
.toggle.is-on span { transform: translateX(12px); }
|
||||||
|
|
||||||
|
/* 1. Download */
|
||||||
|
.dl__btn {
|
||||||
|
display: inline-flex;
|
||||||
|
align-items: center;
|
||||||
|
gap: 8px;
|
||||||
|
height: 32px;
|
||||||
|
padding: 0 12px;
|
||||||
|
border-radius: 8px;
|
||||||
|
background: var(--accent);
|
||||||
|
color: #fff;
|
||||||
|
font-weight: 500;
|
||||||
|
transition: transform 200ms var(--ease), background-color 200ms var(--ease);
|
||||||
|
}
|
||||||
|
.dl__btn.is-pressed { background: var(--accent-hover); transform: scale(.97); }
|
||||||
|
.dl__shelf {
|
||||||
|
margin-top: 16px;
|
||||||
|
border-radius: 8px;
|
||||||
|
border: 1px solid var(--line);
|
||||||
|
background: var(--card);
|
||||||
|
box-shadow: 0 8px 24px rgba(11, 22, 32, .08);
|
||||||
|
opacity: 0;
|
||||||
|
transform: translateY(8px);
|
||||||
|
transition: opacity 400ms var(--ease), transform 400ms var(--ease);
|
||||||
|
}
|
||||||
|
.dl__shelf.is-in { opacity: 1; transform: none; }
|
||||||
|
.dl__row { display: flex; align-items: center; gap: 12px; padding: 8px 12px; }
|
||||||
|
.dl__row--folder {
|
||||||
|
border-top: 1px solid var(--line);
|
||||||
|
opacity: 0;
|
||||||
|
transform: translateY(4px);
|
||||||
|
transition: opacity 400ms var(--ease), transform 400ms var(--ease);
|
||||||
|
}
|
||||||
|
.dl__row--folder.is-in { opacity: 1; transform: none; }
|
||||||
|
.dl__icon { display: grid; place-items: center; width: 28px; height: 28px; border-radius: 6px; background: var(--raised); color: var(--text-2); flex: none; }
|
||||||
|
.dl__icon--folder { background: var(--brand-wash); color: var(--accent-ink); }
|
||||||
|
.dl__name { display: flex; flex-direction: column; min-width: 0; line-height: 16px; }
|
||||||
|
.dl__name strong { font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
|
||||||
|
.dl__name .mono { font-size: 11px; color: var(--text-3); }
|
||||||
|
.dl__track { margin-left: auto; flex: none; width: 48px; height: 4px; border-radius: 2px; background: var(--raised); overflow: hidden; }
|
||||||
|
.dl__track span { display: block; height: 100%; background: var(--accent); transform: scaleX(0); transform-origin: left; }
|
||||||
|
.dl__track.is-running span { transform: scaleX(1); transition: transform 1500ms var(--ease); }
|
||||||
|
.dl__track.is-full span { transform: scaleX(1); background: var(--positive); }
|
||||||
|
.dl__ok { margin-left: auto; flex: none; color: var(--positive); }
|
||||||
|
|
||||||
|
/* 2. Developer mode */
|
||||||
|
.ext__head { display: flex; align-items: center; justify-content: space-between; gap: 12px; height: 28px; }
|
||||||
|
.ext__title { display: inline-flex; align-items: center; gap: 8px; font-weight: 500; }
|
||||||
|
.ext__dev { display: inline-flex; align-items: center; gap: 8px; color: var(--text-2); white-space: nowrap; }
|
||||||
|
.ext__tools {
|
||||||
|
display: flex;
|
||||||
|
gap: 8px;
|
||||||
|
margin-top: 12px;
|
||||||
|
opacity: 0;
|
||||||
|
transform: translateY(-4px);
|
||||||
|
transition: opacity 300ms var(--ease), transform 300ms var(--ease);
|
||||||
|
}
|
||||||
|
.ext__tools.is-in { opacity: 1; transform: none; }
|
||||||
|
.ext__tool {
|
||||||
|
padding: 4px 8px;
|
||||||
|
border-radius: 6px;
|
||||||
|
border: 1px solid var(--line-strong);
|
||||||
|
color: var(--accent-ink);
|
||||||
|
font-size: 12px;
|
||||||
|
white-space: nowrap;
|
||||||
|
}
|
||||||
|
.ext__tool:first-child { background: var(--brand-wash); border-color: transparent; }
|
||||||
|
.ext__ghost { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 16px; }
|
||||||
|
.ext__ghost span { height: 64px; border-radius: 8px; border: 1px solid var(--line); background: var(--bg); }
|
||||||
|
|
||||||
|
.dev__cursor { top: 26px; right: 18px; transition: transform 600ms var(--ease), opacity 300ms var(--ease); }
|
||||||
|
.dev__cursor.is-idle { transform: translate(-64px, 96px); opacity: 0; }
|
||||||
|
.dev__cursor.is-aim { transform: none; opacity: 1; }
|
||||||
|
.dev__cursor.is-press { transform: scale(.88); opacity: 1; }
|
||||||
|
.dev__cursor.is-on { transform: translate(24px, 48px); opacity: 0; }
|
||||||
|
|
||||||
|
/* 3. Drag and drop */
|
||||||
|
.drop__zone {
|
||||||
|
position: absolute;
|
||||||
|
inset: 16px;
|
||||||
|
display: grid;
|
||||||
|
place-items: center;
|
||||||
|
border-radius: 8px;
|
||||||
|
border: 1.5px dashed var(--line-strong);
|
||||||
|
color: var(--text-3);
|
||||||
|
transition: border-color 300ms var(--ease), background-color 300ms var(--ease), color 300ms var(--ease), opacity 300ms var(--ease);
|
||||||
|
}
|
||||||
|
.drop__zone.is-hot { border-color: var(--accent); background: var(--brand-wash); color: var(--accent-ink); }
|
||||||
|
.drop__zone.is-gone { opacity: 0; }
|
||||||
|
|
||||||
|
.ext__card {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
gap: 12px;
|
||||||
|
padding: 12px;
|
||||||
|
border-radius: 8px;
|
||||||
|
border: 1px solid var(--line);
|
||||||
|
background: var(--card);
|
||||||
|
box-shadow: 0 8px 24px rgba(11, 22, 32, .06);
|
||||||
|
opacity: 0;
|
||||||
|
transform: scale(.96);
|
||||||
|
transition: opacity 400ms var(--ease), transform 500ms var(--ease);
|
||||||
|
}
|
||||||
|
.ext__card.is-in { opacity: 1; transform: none; }
|
||||||
|
.ext__card img { width: 32px; height: 32px; border-radius: 8px; flex: none; }
|
||||||
|
.ext__card-name { display: flex; flex-direction: column; min-width: 0; line-height: 16px; }
|
||||||
|
.ext__card-name strong { font-weight: 500; }
|
||||||
|
.ext__card-name strong .mono { font-weight: 400; color: var(--text-3); }
|
||||||
|
.ext__card-name > span { font-size: 12px; color: var(--text-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
|
||||||
|
.ext__card .toggle { margin-left: auto; }
|
||||||
|
|
||||||
|
.drag__chip {
|
||||||
|
position: absolute;
|
||||||
|
left: 50%;
|
||||||
|
top: 50%;
|
||||||
|
display: inline-flex;
|
||||||
|
align-items: center;
|
||||||
|
gap: 8px;
|
||||||
|
padding: 6px 12px;
|
||||||
|
border-radius: 8px;
|
||||||
|
background: var(--card);
|
||||||
|
border: 1px solid var(--line-strong);
|
||||||
|
box-shadow: 0 12px 24px rgba(11, 22, 32, .14);
|
||||||
|
color: var(--text);
|
||||||
|
font-weight: 500;
|
||||||
|
white-space: nowrap;
|
||||||
|
transition: transform 600ms var(--ease), opacity 300ms var(--ease);
|
||||||
|
}
|
||||||
|
.drag__chip svg:first-child { color: var(--accent-ink); }
|
||||||
|
.drag__chip.is-idle { transform: translate(calc(-50% - 96px), calc(-50% + 112px)); opacity: 0; }
|
||||||
|
.drag__chip.is-lift { transform: translate(calc(-50% - 72px), calc(-50% + 48px)) rotate(-3deg); opacity: 1; }
|
||||||
|
.drag__chip.is-drag { transform: translate(-50%, -50%) rotate(-2deg); opacity: 1; }
|
||||||
|
.drag__chip.is-drop,
|
||||||
|
.drag__chip.is-installed { transform: translate(-50%, -50%) scale(.8); opacity: 0; }
|
||||||
|
.drag__cursor { right: -8px; bottom: -12px; transition: none; }
|
||||||
|
|
||||||
|
@media (prefers-reduced-motion: reduce) {
|
||||||
|
.install * { transition: none !important; }
|
||||||
|
}
|
||||||
|
|
||||||
|
@media (max-width: 860px) {
|
||||||
|
.install { padding: 96px 0; }
|
||||||
|
.install__grid { grid-template-columns: 1fr; }
|
||||||
|
.install__media { height: 232px; }
|
||||||
|
}
|
||||||
12
src/main.jsx
Normal file
12
src/main.jsx
Normal file
@@ -0,0 +1,12 @@
|
|||||||
|
import { StrictMode } from 'react'
|
||||||
|
import { createRoot } from 'react-dom/client'
|
||||||
|
import App from './App.jsx'
|
||||||
|
import './styles.css'
|
||||||
|
import './scenes.css'
|
||||||
|
import './install.css'
|
||||||
|
|
||||||
|
createRoot(document.getElementById('root')).render(
|
||||||
|
<StrictMode>
|
||||||
|
<App />
|
||||||
|
</StrictMode>,
|
||||||
|
)
|
||||||
202
src/scenes.css
Normal file
202
src/scenes.css
Normal file
@@ -0,0 +1,202 @@
|
|||||||
|
/* --------------------------- Product scenes ----------------------------- */
|
||||||
|
.scene { position: relative; font-size: 13px; color: var(--text); text-align: left; }
|
||||||
|
.scene .mono { font-size: 12px; }
|
||||||
|
.cursor { position: absolute; z-index: 3; pointer-events: none; filter: drop-shadow(0 1px 1px rgba(0, 0, 0, .2)); transition: transform 500ms var(--ease); }
|
||||||
|
|
||||||
|
/* Shared: our pill, a button, a saved check */
|
||||||
|
.kpill {
|
||||||
|
display: inline-flex;
|
||||||
|
align-items: center;
|
||||||
|
gap: 8px;
|
||||||
|
min-width: 212px;
|
||||||
|
height: 36px;
|
||||||
|
padding: 0 12px;
|
||||||
|
border-radius: 10px;
|
||||||
|
background: var(--accent);
|
||||||
|
color: #fff;
|
||||||
|
font-weight: 500;
|
||||||
|
box-shadow: inset 0 1px 0 rgba(255, 255, 255, .14);
|
||||||
|
transition: background-color var(--fast) var(--ease), color var(--fast) var(--ease), transform var(--fast) var(--ease);
|
||||||
|
}
|
||||||
|
.kpill--sm { min-width: 0; height: 32px; }
|
||||||
|
.kpill__meta { margin-left: auto; opacity: .72; }
|
||||||
|
.kpill.is-pressed { background: var(--accent-hover); transform: scale(.97); }
|
||||||
|
.kpill--saved { background: var(--raised); color: var(--text); box-shadow: inset 0 0 0 1px var(--line); }
|
||||||
|
.kpill--saved svg { color: var(--positive); }
|
||||||
|
.kpill--saved .kpill__meta { color: var(--text-3); opacity: 1; }
|
||||||
|
|
||||||
|
.ring { transform: rotate(-90deg); }
|
||||||
|
.ring circle { fill: none; stroke-width: 2; }
|
||||||
|
.ring__track { stroke: rgba(255, 255, 255, .3); }
|
||||||
|
.ring__fill { stroke: #fff; stroke-dasharray: 100; stroke-linecap: round; }
|
||||||
|
|
||||||
|
.kbtn {
|
||||||
|
display: inline-flex; align-items: center; gap: 6px; height: 32px; padding: 0 12px; margin-left: auto;
|
||||||
|
border-radius: 8px; background: var(--accent); color: #fff;
|
||||||
|
transition: background-color var(--fast) var(--ease), color var(--fast) var(--ease), transform var(--fast) var(--ease);
|
||||||
|
}
|
||||||
|
.kbtn.is-pressed { transform: scale(.97); background: var(--accent-hover); }
|
||||||
|
.kbtn--done { background: var(--raised); color: var(--text); box-shadow: inset 0 0 0 1px var(--line); }
|
||||||
|
.kbtn--done svg { color: var(--positive); }
|
||||||
|
|
||||||
|
.pf__avatar { width: 32px; height: 32px; border-radius: 50%; flex: none; background: linear-gradient(140deg, #d9b8a4, #a9806c); }
|
||||||
|
.pf__check {
|
||||||
|
position: absolute; right: 6px; bottom: 6px; width: 20px; height: 20px; border-radius: 50%;
|
||||||
|
display: grid; place-items: center; background: #fff; color: var(--positive);
|
||||||
|
opacity: 0; transform: scale(.6); transition: opacity 200ms var(--ease), transform 200ms var(--ease);
|
||||||
|
}
|
||||||
|
.is-saved > .pf__check { opacity: 1; transform: none; }
|
||||||
|
|
||||||
|
/* ======================= Right in the toolbar ======================= */
|
||||||
|
.tb { width: min(100%, 440px); margin: 0 auto; }
|
||||||
|
.tb__post { border-radius: 14px; background: var(--card); border: 1px solid var(--line); padding: 12px; box-shadow: 0 8px 24px rgba(11, 22, 32, .06); }
|
||||||
|
.tb__media { position: relative; height: 132px; border-radius: 8px; }
|
||||||
|
.tb__dur { position: absolute; right: 8px; bottom: 8px; padding: 2px 6px; border-radius: 4px; background: rgba(10, 24, 36, .6); color: #fff; }
|
||||||
|
.tb__bar { display: flex; align-items: center; justify-content: space-between; margin-top: 12px; }
|
||||||
|
.tb__icons { display: flex; gap: 16px; color: var(--text-3); }
|
||||||
|
.tb__cursor { right: 40px; bottom: -8px; transform: translate(60px, 40px); opacity: 0; transition: transform 600ms var(--ease), opacity 300ms var(--ease); }
|
||||||
|
.tb__cursor.is-aim, .tb__cursor.is-press, .tb__cursor.is-saving { transform: translate(0, 0); opacity: 1; }
|
||||||
|
.tb__cursor.is-press { transform: translate(0, 0) scale(.88); }
|
||||||
|
.tb__cursor.is-saving { transform: translate(28px, 36px); opacity: 0; }
|
||||||
|
|
||||||
|
/* ========================= Pick your quality ======================== */
|
||||||
|
.qs { width: min(100%, 400px); margin: 0 auto; }
|
||||||
|
.qs__menu { padding: 4px; border-radius: 14px; background: var(--card); border: 1px solid var(--line-strong); box-shadow: 0 12px 32px rgba(11, 22, 32, .08); }
|
||||||
|
.qs__label { display: flex; justify-content: space-between; padding: 8px 8px 4px; font-size: 12px; color: var(--text-3); }
|
||||||
|
.qs__row {
|
||||||
|
display: grid; grid-template-columns: 72px 1fr 64px; align-items: center; gap: 12px;
|
||||||
|
height: 40px; margin-top: 4px; padding: 0 12px; border-radius: 10px;
|
||||||
|
transition: background-color 200ms var(--ease);
|
||||||
|
}
|
||||||
|
.qs__row.is-active { background: var(--raised); }
|
||||||
|
.qs__name { font-weight: 500; }
|
||||||
|
.qs__size { text-align: right; color: var(--text-3); }
|
||||||
|
.qs__track { height: 6px; border-radius: 3px; background: var(--raised-2); overflow: hidden; }
|
||||||
|
.qs__track span { display: block; height: 100%; background: var(--text-3); border-radius: 3px; transform-origin: left; opacity: .45; transition: background-color 200ms var(--ease), opacity 200ms var(--ease); }
|
||||||
|
.qs__row.is-active .qs__track span { background: var(--brand); opacity: 1; }
|
||||||
|
.qs__row.is-active .qs__size { color: var(--text); }
|
||||||
|
.qs__out { display: flex; align-items: center; gap: 8px; margin-top: 4px; padding: 12px; border-top: 1px solid var(--line); color: var(--text-2); }
|
||||||
|
.qs__out svg { color: var(--text-3); }
|
||||||
|
.qs__file { animation: rise 300ms var(--ease); }
|
||||||
|
.qs__cursor { left: 56%; top: 46px; }
|
||||||
|
|
||||||
|
/* ====================== Whole profiles in one go ===================== */
|
||||||
|
.pf { width: min(100%, 440px); margin: 0 auto; padding: 12px; border-radius: 14px; background: var(--card); border: 1px solid var(--line); box-shadow: 0 8px 24px rgba(11, 22, 32, .06); }
|
||||||
|
.pf__head { display: flex; align-items: center; gap: 12px; margin-bottom: 12px; }
|
||||||
|
.pf__who { display: grid; line-height: 18px; }
|
||||||
|
.pf__who strong { font-weight: 500; }
|
||||||
|
.pf__who .mono { color: var(--text-3); }
|
||||||
|
.pf__grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 4px; }
|
||||||
|
.pf__tile { position: relative; aspect-ratio: 1; border-radius: 6px; overflow: hidden; }
|
||||||
|
.pf__tile::after { content: ''; position: absolute; inset: 0; background: rgba(245, 248, 251, .0); transition: background-color 200ms var(--ease); }
|
||||||
|
.pf__tile.is-saved::after { background: rgba(245, 248, 251, .28); }
|
||||||
|
.pf__tile > * { z-index: 1; }
|
||||||
|
.pf__dur { position: absolute; left: 6px; bottom: 6px; padding: 1px 4px; border-radius: 4px; background: rgba(10, 24, 36, .55); color: #fff; font-size: 11px !important; }
|
||||||
|
.pf__lock { position: absolute; left: 6px; top: 6px; width: 20px; height: 20px; display: grid; place-items: center; border-radius: 50%; background: rgba(10, 24, 36, .55); color: #fff; }
|
||||||
|
|
||||||
|
/* =================== Saved, and it stays marked =================== */
|
||||||
|
.nm { width: min(100%, 460px); margin: 0 auto; }
|
||||||
|
.nm__path {
|
||||||
|
display: flex; flex-wrap: wrap; align-items: center; gap: 2px; padding: 12px;
|
||||||
|
border-radius: 12px; background: var(--card); border: 1px solid var(--line);
|
||||||
|
}
|
||||||
|
.nm__sep { color: var(--text-3); padding: 0 2px; }
|
||||||
|
.nm__tok { position: relative; display: inline-grid; }
|
||||||
|
.nm__tok > span { grid-area: 1 / 1; padding: 2px 6px; border-radius: 6px; white-space: nowrap; transition: opacity 250ms var(--ease), transform 250ms var(--ease); }
|
||||||
|
.nm__from { background: var(--raised); color: var(--text-2); }
|
||||||
|
.nm__to { background: rgba(2, 175, 242, .08); color: var(--accent-ink); opacity: 0; transform: translateY(6px); }
|
||||||
|
.nm__tok.is-on .nm__from { opacity: 0; transform: translateY(-6px); }
|
||||||
|
.nm__tok.is-on .nm__to { opacity: 1; transform: none; }
|
||||||
|
.nm__list { margin-top: 12px; padding: 4px; border-radius: 12px; background: var(--card); border: 1px solid var(--line); box-shadow: 0 8px 24px rgba(11, 22, 32, .06); }
|
||||||
|
.nm__crumb { display: flex; align-items: center; gap: 6px; height: 32px; padding: 0 8px; font-size: 12px; color: var(--text-3); border-bottom: 1px solid var(--line); margin-bottom: 4px; }
|
||||||
|
.nm__slash { opacity: .6; }
|
||||||
|
.nm__row { display: grid; grid-template-columns: 16px 1fr auto 16px; align-items: center; gap: 8px; height: 32px; padding: 0 8px; border-radius: 8px; color: var(--text-2); }
|
||||||
|
.nm__row svg { color: var(--text-3); }
|
||||||
|
.nm__row svg:last-child { color: var(--positive); }
|
||||||
|
.nm__row .mono { color: var(--text-3); }
|
||||||
|
.nm__row--new { opacity: 0; transform: translateY(-6px); transition: opacity 300ms var(--ease), transform 300ms var(--ease), background-color 300ms var(--ease); }
|
||||||
|
.nm__row--new.is-in { opacity: 1; transform: none; background: var(--raised); color: var(--text); }
|
||||||
|
.nm__row--new.is-in svg:first-child { color: var(--accent); }
|
||||||
|
|
||||||
|
/* ========================== Showcase stage =========================== */
|
||||||
|
.stage { position: absolute; inset: 32px 32px 0; border-radius: 14px 14px 0 0; background: var(--card); border: 1px solid var(--line-strong); border-bottom: 0; overflow: hidden; box-shadow: 0 24px 48px -24px rgba(11, 22, 32, .2); }
|
||||||
|
.stage__bar { display: flex; align-items: center; gap: 6px; height: 36px; padding: 0 12px; border-bottom: 1px solid var(--line); }
|
||||||
|
.stage__bar i { width: 8px; height: 8px; border-radius: 50%; background: var(--raised-2); }
|
||||||
|
.stage__bar .mono { margin-left: auto; margin-right: auto; font-size: 12px; color: var(--text-3); transform: translateX(-12px); }
|
||||||
|
.stage__scene { position: absolute; inset: 36px 0 0; padding: 24px; opacity: 0; transition: opacity 300ms var(--ease); }
|
||||||
|
.stage__scene.is-active { opacity: 1; }
|
||||||
|
|
||||||
|
/* Chat */
|
||||||
|
.ch__head { display: flex; align-items: center; gap: 8px; padding-bottom: 12px; border-bottom: 1px solid var(--line); }
|
||||||
|
.ch__head strong { font-weight: 500; }
|
||||||
|
.ch__online { width: 6px; height: 6px; border-radius: 50%; background: var(--positive); }
|
||||||
|
.ch__meta { color: var(--text-3); }
|
||||||
|
.ch__body { display: grid; gap: 8px; padding-top: 16px; }
|
||||||
|
.ch__bubble { max-width: 75%; padding: 8px 12px; border-radius: 14px 14px 14px 4px; background: var(--raised); color: var(--text-2); }
|
||||||
|
.ch__bubble--me { justify-self: end; border-radius: 14px 14px 4px 14px; background: var(--text); color: var(--bg); }
|
||||||
|
.ch__media { width: 82%; padding: 6px; border-radius: 14px; background: var(--raised); }
|
||||||
|
.ch__tiles { display: grid; grid-template-columns: 2fr 1fr; grid-template-rows: 1fr 1fr; gap: 4px; height: 196px; }
|
||||||
|
.ch__tile { position: relative; border-radius: 8px; overflow: hidden; }
|
||||||
|
.ch__tile:first-child { grid-row: 1 / 3; }
|
||||||
|
.ch__actions { display: flex; align-items: center; justify-content: space-between; padding: 8px 4px 2px; }
|
||||||
|
.ch__time { color: var(--text-3); }
|
||||||
|
|
||||||
|
/* DRM */
|
||||||
|
.dr__video { position: relative; height: 140px; border-radius: 10px; }
|
||||||
|
.dr__badge {
|
||||||
|
position: absolute; left: 12px; top: 12px; display: inline-flex; align-items: center; gap: 6px; height: 26px; padding: 0 10px;
|
||||||
|
border-radius: 13px; background: rgba(10, 24, 36, .62); color: #fff; font-size: 12px;
|
||||||
|
transition: background-color 300ms var(--ease);
|
||||||
|
}
|
||||||
|
.dr__badge.is-open { background: rgba(22, 120, 70, .78); }
|
||||||
|
.dr__steps { list-style: none; margin: 16px 0 0; padding: 0; display: grid; gap: 2px; }
|
||||||
|
.dr__steps li { display: grid; grid-template-columns: 20px 1fr auto; align-items: center; gap: 10px; height: 32px; padding: 0 8px; border-radius: 8px; color: var(--text-3); transition: color 200ms var(--ease), background-color 200ms var(--ease); }
|
||||||
|
.dr__steps li .mono { color: var(--text-3); }
|
||||||
|
.dr__steps li.is-now { background: var(--raised); color: var(--text); }
|
||||||
|
.dr__steps li.is-done { color: var(--text-2); }
|
||||||
|
.dr__dot { width: 18px; height: 18px; border-radius: 50%; display: grid; place-items: center; border: 1px solid var(--line-strong); color: var(--positive); }
|
||||||
|
.is-now .dr__dot { border-color: var(--accent); box-shadow: inset 0 0 0 4px var(--card), inset 0 0 0 9px var(--accent); }
|
||||||
|
.is-done .dr__dot { border-color: transparent; background: rgba(22, 163, 74, .12); }
|
||||||
|
.dr__file {
|
||||||
|
display: flex; align-items: center; gap: 8px; margin-top: 12px; height: 44px; padding: 0 12px;
|
||||||
|
border-radius: 10px; background: var(--d-bg); color: var(--d-text);
|
||||||
|
opacity: 0; transform: translateY(6px); transition: opacity 300ms var(--ease), transform 300ms var(--ease);
|
||||||
|
}
|
||||||
|
.dr__file.is-in { opacity: 1; transform: none; }
|
||||||
|
.dr__file svg { color: var(--accent); }
|
||||||
|
.dr__meta { margin-left: auto; color: var(--d-text-3); }
|
||||||
|
|
||||||
|
/* Bulk */
|
||||||
|
.bk__head { display: flex; align-items: center; gap: 12px; }
|
||||||
|
.bk__head > span:last-child { display: grid; line-height: 18px; }
|
||||||
|
.bk__head strong { font-weight: 500; }
|
||||||
|
.bk__head .mono { color: var(--text-3); }
|
||||||
|
.bk__count { margin-top: 32px; font-size: 56px !important; line-height: 1; letter-spacing: -0.04em; font-variant-numeric: tabular-nums; }
|
||||||
|
.bk__count span { font-size: 20px; color: var(--text-3); letter-spacing: 0; }
|
||||||
|
.bk__bar { height: 8px; margin-top: 16px; border-radius: 4px; background: var(--raised-2); overflow: hidden; }
|
||||||
|
.bk__bar span, .bk__mini span { display: block; height: 100%; background: var(--brand); transform-origin: left; border-radius: inherit; }
|
||||||
|
.bk__types { display: grid; gap: 8px; margin-top: 24px; }
|
||||||
|
.bk__type { display: grid; grid-template-columns: 64px 1fr 96px; align-items: center; gap: 12px; color: var(--text-2); }
|
||||||
|
.bk__type .mono { text-align: right; color: var(--text-3); font-variant-numeric: tabular-nums; }
|
||||||
|
.bk__mini { height: 4px; border-radius: 2px; background: var(--raised-2); overflow: hidden; }
|
||||||
|
.bk__mini span { background: var(--text-3); }
|
||||||
|
.bk__now { display: flex; align-items: center; gap: 8px; margin-top: 24px; padding: 12px; border-radius: 10px; background: var(--raised); color: var(--text-2); white-space: nowrap; overflow: hidden; }
|
||||||
|
.bk__now svg { flex: none; color: var(--text-3); }
|
||||||
|
|
||||||
|
@keyframes rise { from { opacity: 0; transform: translateY(4px); } }
|
||||||
|
|
||||||
|
/* Feature cards that hold a scene */
|
||||||
|
.media-scene .feature-card__media { height: auto; min-height: 248px; align-items: center; padding: 32px 24px 40px; margin-inline: -40px; }
|
||||||
|
.media-scene .feature-card__media::after { display: none; }
|
||||||
|
|
||||||
|
@media (prefers-reduced-motion: reduce) {
|
||||||
|
.scene *, .cursor { transition: none !important; animation: none !important; }
|
||||||
|
}
|
||||||
|
|
||||||
|
@media (max-width: 860px) {
|
||||||
|
.media-scene .feature-card__media { margin-inline: -24px; padding-inline: 16px; }
|
||||||
|
.stage { inset: 16px 16px 0; }
|
||||||
|
.stage__scene { padding: 16px; }
|
||||||
|
.kpill { min-width: 0; }
|
||||||
|
.ch__media { width: 100%; }
|
||||||
|
}
|
||||||
960
src/styles.css
Normal file
960
src/styles.css
Normal file
@@ -0,0 +1,960 @@
|
|||||||
|
:root {
|
||||||
|
/* Cool ink ramp, light */
|
||||||
|
--bg: #f5f8fb;
|
||||||
|
--card: #ffffff;
|
||||||
|
--raised: #eaf1f6;
|
||||||
|
--raised-2: #dbe5ee;
|
||||||
|
--line: rgba(11, 22, 32, .08);
|
||||||
|
--line-strong: rgba(11, 22, 32, .14);
|
||||||
|
--text: #0b1620;
|
||||||
|
--text-2: #46566a;
|
||||||
|
--text-3: #5f6f82;
|
||||||
|
|
||||||
|
/* Navy ramp, dark (fact band, DRM card, comparison) */
|
||||||
|
--d-bg: #0a1824;
|
||||||
|
--d-raised: #112536;
|
||||||
|
--d-raised-2: #193247;
|
||||||
|
--d-line: rgba(234, 243, 250, .1);
|
||||||
|
--d-text: #eaf3fa;
|
||||||
|
--d-text-2: #a6b8c9;
|
||||||
|
--d-text-3: #8197ab;
|
||||||
|
|
||||||
|
/* Blue: the bright brand fill, a deeper shade behind white text, and one for blue text */
|
||||||
|
--brand: #02aff2;
|
||||||
|
--brand-wash: #dff3fd;
|
||||||
|
--accent: #007cb8;
|
||||||
|
--accent-hover: #006da3;
|
||||||
|
--accent-ink: #006da3;
|
||||||
|
--positive: #16a34a;
|
||||||
|
--negative: #dc2626;
|
||||||
|
|
||||||
|
--font: 'Geist', system-ui, -apple-system, sans-serif;
|
||||||
|
--mono: 'Geist Mono', ui-monospace, 'SF Mono', monospace;
|
||||||
|
--container: 1120px;
|
||||||
|
--ease: cubic-bezier(.22, 1, .36, 1);
|
||||||
|
--fast: 150ms;
|
||||||
|
}
|
||||||
|
|
||||||
|
*,
|
||||||
|
*::before,
|
||||||
|
*::after { box-sizing: border-box; }
|
||||||
|
|
||||||
|
html { scroll-behavior: smooth; scroll-padding-top: 80px; }
|
||||||
|
|
||||||
|
body {
|
||||||
|
margin: 0;
|
||||||
|
background: var(--bg);
|
||||||
|
color: var(--text);
|
||||||
|
font-family: var(--font);
|
||||||
|
font-size: 16px;
|
||||||
|
line-height: 1.5;
|
||||||
|
-webkit-font-smoothing: antialiased;
|
||||||
|
}
|
||||||
|
|
||||||
|
img, video { display: block; max-width: 100%; }
|
||||||
|
a { color: inherit; text-decoration: none; }
|
||||||
|
button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; padding: 0; text-align: left; }
|
||||||
|
h1, h2, h3, p { margin: 0; }
|
||||||
|
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 4px; }
|
||||||
|
|
||||||
|
.container { width: min(var(--container), calc(100% - 48px)); margin-inline: auto; }
|
||||||
|
.mono { font-family: var(--mono); font-variant-numeric: tabular-nums; }
|
||||||
|
|
||||||
|
/* ------------------------------- Entrance -------------------------------- */
|
||||||
|
.reveal {
|
||||||
|
opacity: 0;
|
||||||
|
transform: translateY(8px);
|
||||||
|
transition: opacity 400ms var(--ease), transform 400ms var(--ease);
|
||||||
|
}
|
||||||
|
.reveal.is-in { opacity: 1; transform: none; }
|
||||||
|
|
||||||
|
@media (prefers-reduced-motion: reduce) {
|
||||||
|
html { scroll-behavior: auto; }
|
||||||
|
.reveal { opacity: 1 !important; transform: none !important; transition: none !important; }
|
||||||
|
.tab__progress { animation: none !important; }
|
||||||
|
.phone img, .phone video { transition: none !important; }
|
||||||
|
}
|
||||||
|
|
||||||
|
/* -------------------------------- Buttons -------------------------------- */
|
||||||
|
.btn {
|
||||||
|
display: inline-flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: center;
|
||||||
|
gap: 8px;
|
||||||
|
height: 44px;
|
||||||
|
padding: 0 20px;
|
||||||
|
border-radius: 10px;
|
||||||
|
font-size: 15px;
|
||||||
|
font-weight: 500;
|
||||||
|
white-space: nowrap;
|
||||||
|
transition: background-color var(--fast) var(--ease), color var(--fast) var(--ease), border-color var(--fast) var(--ease), transform var(--fast) var(--ease);
|
||||||
|
}
|
||||||
|
.btn:active { transform: scale(.98); }
|
||||||
|
.btn__meta { font-weight: 400; opacity: .72; }
|
||||||
|
|
||||||
|
.btn--primary { background: var(--accent); color: #fff; box-shadow: inset 0 1px 0 rgba(255, 255, 255, .14); }
|
||||||
|
.btn--primary:hover { background: var(--accent-hover); }
|
||||||
|
|
||||||
|
.btn--secondary { background: var(--card); color: var(--text); border: 1px solid var(--line-strong); }
|
||||||
|
.btn--secondary:hover { background: var(--raised); }
|
||||||
|
|
||||||
|
.btn--ghost { color: var(--text-2); }
|
||||||
|
.btn--ghost:hover { color: var(--text); background: var(--raised); }
|
||||||
|
|
||||||
|
.btn--light { background: var(--d-text); color: var(--d-bg); }
|
||||||
|
.btn--light:hover { background: #fff; }
|
||||||
|
|
||||||
|
.btn--dark { background: var(--text); color: #fff; }
|
||||||
|
.btn--dark:hover { background: #000; }
|
||||||
|
.btn--dark .btn__meta { opacity: .64; }
|
||||||
|
|
||||||
|
.btn--nav { height: 36px; padding: 0 16px; font-size: 14px; border-radius: 8px; background: var(--text); color: var(--bg); }
|
||||||
|
.btn--nav:hover { background: #000; }
|
||||||
|
|
||||||
|
.btn--block { display: flex; width: 100%; }
|
||||||
|
|
||||||
|
/* --------------------------- Section headings ---------------------------- */
|
||||||
|
.eyebrow {
|
||||||
|
display: block;
|
||||||
|
margin-bottom: 12px;
|
||||||
|
font-family: var(--mono);
|
||||||
|
font-size: 13px;
|
||||||
|
color: var(--accent-ink);
|
||||||
|
}
|
||||||
|
.section-heading { text-align: center; margin-bottom: 48px; }
|
||||||
|
.section-heading--left { text-align: left; margin-bottom: 32px; }
|
||||||
|
.section-heading h2 {
|
||||||
|
font-weight: 500;
|
||||||
|
font-size: 48px;
|
||||||
|
line-height: 1.08;
|
||||||
|
letter-spacing: -0.025em;
|
||||||
|
}
|
||||||
|
.section-heading .muted { color: var(--text-3); }
|
||||||
|
|
||||||
|
/* ---------------------------------- Nav ---------------------------------- */
|
||||||
|
.nav {
|
||||||
|
position: fixed;
|
||||||
|
inset: 0 0 auto 0;
|
||||||
|
z-index: 50;
|
||||||
|
background: transparent;
|
||||||
|
border-bottom: 1px solid transparent;
|
||||||
|
transition: background-color 200ms var(--ease), border-color 200ms var(--ease);
|
||||||
|
}
|
||||||
|
.nav--scrolled {
|
||||||
|
background: rgba(245, 248, 251, .7);
|
||||||
|
-webkit-backdrop-filter: blur(16px) saturate(1.4);
|
||||||
|
backdrop-filter: blur(16px) saturate(1.4);
|
||||||
|
border-bottom-color: var(--line);
|
||||||
|
}
|
||||||
|
.nav__inner {
|
||||||
|
width: min(var(--container), calc(100% - 48px));
|
||||||
|
height: 64px;
|
||||||
|
margin-inline: auto;
|
||||||
|
display: grid;
|
||||||
|
grid-template-columns: 1fr auto 1fr;
|
||||||
|
align-items: center;
|
||||||
|
}
|
||||||
|
.nav__logo { display: inline-flex; align-items: center; gap: 8px; font-size: 17px; font-weight: 500; }
|
||||||
|
.nav__logo img { width: 24px; height: 24px; }
|
||||||
|
.nav__links { display: flex; gap: 32px; font-size: 14px; }
|
||||||
|
.nav__links a { color: var(--text-2); transition: color var(--fast) var(--ease); }
|
||||||
|
.nav__links a:hover { color: var(--text); }
|
||||||
|
.nav .btn--nav { justify-self: end; }
|
||||||
|
.nav__burger { display: none; }
|
||||||
|
|
||||||
|
/* ---------------------------------- Hero --------------------------------- */
|
||||||
|
.hero {
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
align-items: center;
|
||||||
|
padding: 176px 24px 0;
|
||||||
|
overflow: hidden;
|
||||||
|
background:
|
||||||
|
radial-gradient(80% 60% at 50% 0%, #ffffff 0, transparent 70%),
|
||||||
|
linear-gradient(#f2fafe 0, var(--brand-wash) 100%);
|
||||||
|
border-bottom: 1px solid var(--line-strong);
|
||||||
|
}
|
||||||
|
.hero__copy { display: flex; flex-direction: column; align-items: center; text-align: center; }
|
||||||
|
.hero__title {
|
||||||
|
font-weight: 500;
|
||||||
|
font-size: 76px;
|
||||||
|
line-height: 1.02;
|
||||||
|
letter-spacing: -0.04em;
|
||||||
|
}
|
||||||
|
.hero__title em { font-style: normal; color: var(--accent-ink); }
|
||||||
|
.hero__sub {
|
||||||
|
max-width: 38rem;
|
||||||
|
margin: 24px 0 32px;
|
||||||
|
font-size: 18px;
|
||||||
|
line-height: 28px;
|
||||||
|
color: var(--text-2);
|
||||||
|
}
|
||||||
|
.hero__actions { display: flex; gap: 8px; flex-wrap: wrap; justify-content: center; }
|
||||||
|
.hero__shot { width: min(var(--container), 100%); margin-top: 80px; }
|
||||||
|
|
||||||
|
/* Feed preview: the hero's moment */
|
||||||
|
.preview {
|
||||||
|
height: 560px;
|
||||||
|
overflow: hidden;
|
||||||
|
border-radius: 16px 16px 0 0;
|
||||||
|
border: 1px solid var(--line-strong);
|
||||||
|
border-bottom: 0;
|
||||||
|
background: var(--bg);
|
||||||
|
box-shadow: 0 -8px 48px -16px rgba(11, 22, 32, .16);
|
||||||
|
}
|
||||||
|
.preview__bar {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
gap: 16px;
|
||||||
|
height: 44px;
|
||||||
|
padding: 0 16px;
|
||||||
|
background: var(--card);
|
||||||
|
border-bottom: 1px solid var(--line);
|
||||||
|
}
|
||||||
|
.preview__dots { display: flex; gap: 8px; }
|
||||||
|
.preview__dots i { width: 10px; height: 10px; border-radius: 50%; background: var(--raised-2); }
|
||||||
|
.preview__url {
|
||||||
|
flex: 0 1 360px;
|
||||||
|
margin-inline: auto;
|
||||||
|
height: 28px;
|
||||||
|
display: grid;
|
||||||
|
place-items: center;
|
||||||
|
border-radius: 8px;
|
||||||
|
background: var(--raised);
|
||||||
|
font-family: var(--mono);
|
||||||
|
font-size: 12px;
|
||||||
|
color: var(--text-3);
|
||||||
|
}
|
||||||
|
.preview__body { position: relative; padding: 32px 32px 0; }
|
||||||
|
.feed { width: 560px; margin-inline: auto; display: grid; gap: 16px; }
|
||||||
|
|
||||||
|
.post {
|
||||||
|
position: relative;
|
||||||
|
padding: 16px;
|
||||||
|
border-radius: 14px;
|
||||||
|
background: var(--card);
|
||||||
|
border: 1px solid var(--line);
|
||||||
|
text-align: left;
|
||||||
|
}
|
||||||
|
.post__head { display: flex; align-items: center; gap: 12px; font-size: 14px; line-height: 20px; }
|
||||||
|
.post__head strong { display: block; font-weight: 500; }
|
||||||
|
.post__head em { font-style: normal; font-size: 13px; color: var(--text-3); }
|
||||||
|
.avatar { width: 36px; height: 36px; border-radius: 50%; flex: none; }
|
||||||
|
.avatar--a { background: linear-gradient(140deg, #d9b8a4, #a9806c); }
|
||||||
|
.avatar--b { background: linear-gradient(140deg, #b7c3c9, #7e8f98); }
|
||||||
|
.post__text { margin: 12px 0; font-size: 14px; color: var(--text-2); }
|
||||||
|
.post__media { border-radius: 8px; }
|
||||||
|
.post__media--video {
|
||||||
|
position: relative;
|
||||||
|
height: 220px;
|
||||||
|
background:
|
||||||
|
radial-gradient(120% 90% at 78% 18%, rgba(255, 214, 170, .9), transparent 55%),
|
||||||
|
linear-gradient(170deg, #c98f6c 0%, #8d5c4a 55%, #4b3530 100%);
|
||||||
|
}
|
||||||
|
.post__dur {
|
||||||
|
position: absolute;
|
||||||
|
right: 12px;
|
||||||
|
bottom: 12px;
|
||||||
|
padding: 2px 8px;
|
||||||
|
border-radius: 4px;
|
||||||
|
background: rgba(10, 24, 36, .6);
|
||||||
|
color: #fff;
|
||||||
|
font-family: var(--mono);
|
||||||
|
font-size: 12px;
|
||||||
|
}
|
||||||
|
.post__grid { display: grid; grid-template-columns: 2fr 1fr 1fr; gap: 4px; margin-top: 12px; }
|
||||||
|
.post__grid .post__media { height: 120px; }
|
||||||
|
.post__media--p1 { background: linear-gradient(160deg, #cfd6d2, #8fa39d 60%, #5f716c); }
|
||||||
|
.post__media--p2 { background: linear-gradient(200deg, #e9d9c4, #c3a586); }
|
||||||
|
.post__media--p3 { background: linear-gradient(170deg, #d8c9cf, #9c8790); }
|
||||||
|
|
||||||
|
.post__bar { display: flex; align-items: center; justify-content: space-between; margin-top: 12px; color: var(--text-3); }
|
||||||
|
.post__icons { display: flex; gap: 16px; }
|
||||||
|
.pill {
|
||||||
|
display: inline-flex;
|
||||||
|
align-items: center;
|
||||||
|
gap: 6px;
|
||||||
|
height: 32px;
|
||||||
|
padding: 0 12px;
|
||||||
|
border-radius: 8px;
|
||||||
|
font-size: 13px;
|
||||||
|
font-weight: 500;
|
||||||
|
}
|
||||||
|
.pill { transition: background-color var(--fast) var(--ease), color var(--fast) var(--ease), transform var(--fast) var(--ease); }
|
||||||
|
.pill--open { background: var(--accent); color: #fff; }
|
||||||
|
.pill.is-pressed { background: var(--accent-hover); transform: scale(.98); }
|
||||||
|
.pill--saved { background: var(--raised); color: var(--text-2); }
|
||||||
|
.pill--saved svg { color: var(--positive); }
|
||||||
|
|
||||||
|
.menu {
|
||||||
|
position: absolute;
|
||||||
|
right: 16px;
|
||||||
|
bottom: 56px;
|
||||||
|
width: 248px;
|
||||||
|
padding: 4px;
|
||||||
|
border-radius: 12px;
|
||||||
|
background: var(--card);
|
||||||
|
border: 1px solid var(--line-strong);
|
||||||
|
box-shadow: 0 12px 32px rgba(11, 22, 32, .12);
|
||||||
|
font-size: 13px;
|
||||||
|
opacity: 0;
|
||||||
|
transform: translateY(6px);
|
||||||
|
transform-origin: bottom right;
|
||||||
|
pointer-events: none;
|
||||||
|
transition: opacity 180ms var(--ease), transform 180ms var(--ease);
|
||||||
|
}
|
||||||
|
.menu.is-open { opacity: 1; transform: none; }
|
||||||
|
.menu__label { padding: 8px 8px 4px; font-size: 12px; color: var(--text-3); }
|
||||||
|
.menu__row {
|
||||||
|
display: flex;
|
||||||
|
justify-content: space-between;
|
||||||
|
align-items: center;
|
||||||
|
height: 32px;
|
||||||
|
padding: 0 8px;
|
||||||
|
border-radius: 8px;
|
||||||
|
}
|
||||||
|
.menu__row .mono { font-size: 12px; color: var(--text-3); }
|
||||||
|
.menu__row { transition: background-color var(--fast) var(--ease); }
|
||||||
|
.menu__row.is-active { background: var(--raised); }
|
||||||
|
|
||||||
|
.toast {
|
||||||
|
position: absolute;
|
||||||
|
right: 32px;
|
||||||
|
top: 32px;
|
||||||
|
width: 280px;
|
||||||
|
padding: 12px;
|
||||||
|
border-radius: 12px;
|
||||||
|
background: var(--d-bg);
|
||||||
|
color: var(--d-text);
|
||||||
|
box-shadow: 0 12px 32px rgba(11, 22, 32, .2);
|
||||||
|
font-size: 13px;
|
||||||
|
text-align: left;
|
||||||
|
opacity: 0;
|
||||||
|
transform: translateY(-6px);
|
||||||
|
transition: opacity 300ms var(--ease), transform 300ms var(--ease);
|
||||||
|
}
|
||||||
|
.toast.is-in { opacity: 1; transform: none; }
|
||||||
|
.toast__row { display: flex; justify-content: space-between; }
|
||||||
|
.toast__pct { color: var(--d-text-2); font-size: 12px; }
|
||||||
|
.toast__track { height: 4px; margin: 8px 0; border-radius: 2px; background: var(--d-raised-2); overflow: hidden; }
|
||||||
|
.toast__track span { display: block; height: 100%; background: var(--brand); transform-origin: left; }
|
||||||
|
.toast__path { font-size: 12px; color: var(--d-text-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
|
||||||
|
|
||||||
|
/* --------------------------------- Compare ------------------------------ */
|
||||||
|
.compare { padding: 112px 0 32px; }
|
||||||
|
.factband { padding: 48px 0 0; }
|
||||||
|
.facts {
|
||||||
|
display: grid; grid-template-columns: repeat(4, 1fr); padding: 32px 0;
|
||||||
|
border-radius: 20px; background: var(--brand-wash); border: 1px solid rgba(2, 175, 242, .18);
|
||||||
|
}
|
||||||
|
.fact { padding: 0 32px; }
|
||||||
|
.fact + .fact { border-left: 1px solid rgba(0, 109, 163, .14); }
|
||||||
|
.fact__n { display: block; font-size: 48px; font-weight: 500; line-height: 1; letter-spacing: -0.04em; font-variant-numeric: tabular-nums; color: var(--accent-ink); }
|
||||||
|
.fact__n small { font-size: 20px; letter-spacing: -0.02em; color: var(--text-2); }
|
||||||
|
.fact__label { display: block; margin-top: 12px; font-size: 14px; line-height: 20px; color: var(--text-2); max-width: 24ch; }
|
||||||
|
.compare__sub { max-width: 36rem; margin: -24px auto 48px; text-align: center; font-size: 17px; line-height: 26px; color: var(--text-2); }
|
||||||
|
.compare__grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; padding: 8px; border-radius: 20px; background: var(--raised); }
|
||||||
|
.compare__col { padding: 24px; border-radius: 14px; background: var(--card); border: 1px solid var(--line); }
|
||||||
|
.compare__col--us { background: var(--d-bg); color: var(--d-text); border-color: transparent; }
|
||||||
|
.compare__head { display: flex; align-items: center; gap: 8px; margin-bottom: 16px; padding-bottom: 16px; border-bottom: 1px solid var(--line); font-weight: 500; }
|
||||||
|
.compare__col--us .compare__head { border-bottom-color: var(--d-line); }
|
||||||
|
.compare__head img { width: 20px; height: 20px; }
|
||||||
|
.compare__list { list-style: none; margin: 0; padding: 0; display: grid; gap: 12px; }
|
||||||
|
.compare__list li { display: grid; grid-template-columns: 20px 1fr; gap: 10px; font-size: 15px; line-height: 22px; color: var(--text-2); }
|
||||||
|
.compare__list svg { margin-top: 3px; }
|
||||||
|
.compare__col--them svg { color: var(--text-3); }
|
||||||
|
.compare__col--us li { color: var(--d-text); }
|
||||||
|
.compare__col--us svg { color: var(--positive); }
|
||||||
|
|
||||||
|
/* -------------------------------- Showcase ------------------------------- */
|
||||||
|
.showcase {
|
||||||
|
display: grid;
|
||||||
|
grid-template-columns: 1fr 560px;
|
||||||
|
gap: 64px;
|
||||||
|
align-items: center;
|
||||||
|
padding: 128px 0;
|
||||||
|
}
|
||||||
|
.tabs { display: flex; flex-direction: column; gap: 8px; max-width: 380px; }
|
||||||
|
.tab {
|
||||||
|
position: relative;
|
||||||
|
overflow: hidden;
|
||||||
|
display: block;
|
||||||
|
width: 100%;
|
||||||
|
padding: 16px 20px;
|
||||||
|
border-radius: 12px;
|
||||||
|
border: 1px solid transparent;
|
||||||
|
transition: background-color var(--fast) var(--ease), border-color var(--fast) var(--ease);
|
||||||
|
}
|
||||||
|
.tab:hover { background: var(--raised); }
|
||||||
|
.tab--active, .tab--active:hover { background: var(--card); border-color: var(--line); }
|
||||||
|
.tab__head { display: flex; align-items: center; gap: 12px; font-weight: 500; color: var(--text-2); }
|
||||||
|
.tab__head svg { color: var(--text-3); flex: none; }
|
||||||
|
.tab--active .tab__head { color: var(--text); }
|
||||||
|
.tab__body {
|
||||||
|
display: grid;
|
||||||
|
grid-template-rows: 0fr;
|
||||||
|
transition: grid-template-rows 300ms var(--ease);
|
||||||
|
}
|
||||||
|
.tab__body > span {
|
||||||
|
overflow: hidden;
|
||||||
|
padding-left: 28px;
|
||||||
|
font-size: 14px;
|
||||||
|
line-height: 20px;
|
||||||
|
color: var(--text-2);
|
||||||
|
}
|
||||||
|
.tab--active .tab__body { grid-template-rows: 1fr; }
|
||||||
|
.tab--active .tab__body > span { padding-top: 8px; }
|
||||||
|
.tab__progress {
|
||||||
|
position: absolute;
|
||||||
|
left: 20px;
|
||||||
|
right: 20px;
|
||||||
|
bottom: 0;
|
||||||
|
height: 2px;
|
||||||
|
background: var(--accent);
|
||||||
|
transform-origin: left;
|
||||||
|
animation: tabProgress linear forwards;
|
||||||
|
opacity: .5;
|
||||||
|
}
|
||||||
|
@keyframes tabProgress { from { transform: scaleX(0); } to { transform: scaleX(1); } }
|
||||||
|
|
||||||
|
.showcase__visual {
|
||||||
|
position: relative;
|
||||||
|
height: 540px;
|
||||||
|
border-radius: 16px;
|
||||||
|
overflow: hidden;
|
||||||
|
background: var(--raised);
|
||||||
|
border: 1px solid var(--line);
|
||||||
|
}
|
||||||
|
.phone {
|
||||||
|
position: absolute;
|
||||||
|
left: 50%;
|
||||||
|
top: 48px;
|
||||||
|
width: 300px;
|
||||||
|
height: 100%;
|
||||||
|
transform: translateX(-50%);
|
||||||
|
border-radius: 16px 16px 0 0;
|
||||||
|
background: #f6f6f6;
|
||||||
|
border: 1px solid var(--line-strong);
|
||||||
|
border-bottom: 0;
|
||||||
|
overflow: hidden;
|
||||||
|
box-shadow: 0 24px 48px -24px rgba(11, 22, 32, .2);
|
||||||
|
}
|
||||||
|
.phone__bar { display: flex; gap: 6px; height: 32px; align-items: center; padding: 0 12px; background: var(--card); border-bottom: 1px solid var(--line); }
|
||||||
|
.phone__bar i { width: 8px; height: 8px; border-radius: 50%; background: var(--raised-2); }
|
||||||
|
.phone img {
|
||||||
|
position: absolute;
|
||||||
|
top: 32px;
|
||||||
|
left: 0;
|
||||||
|
width: 100%;
|
||||||
|
height: auto;
|
||||||
|
opacity: 0;
|
||||||
|
transform: translateY(8px);
|
||||||
|
transition: opacity 400ms var(--ease), transform 400ms var(--ease);
|
||||||
|
}
|
||||||
|
.phone img.is-active { opacity: 1; transform: none; }
|
||||||
|
.phone video {
|
||||||
|
position: absolute;
|
||||||
|
top: 32px;
|
||||||
|
left: 0;
|
||||||
|
width: 100%;
|
||||||
|
height: calc(100% - 32px);
|
||||||
|
object-fit: cover;
|
||||||
|
object-position: top;
|
||||||
|
background: #fff;
|
||||||
|
opacity: 0;
|
||||||
|
transform: translateY(8px);
|
||||||
|
transition: opacity 400ms var(--ease), transform 400ms var(--ease);
|
||||||
|
}
|
||||||
|
.phone video.is-active { opacity: 1; transform: none; }
|
||||||
|
|
||||||
|
/* -------------------------------- Features ------------------------------- */
|
||||||
|
.features { padding-bottom: 96px; }
|
||||||
|
.features__grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
|
||||||
|
.feature-card {
|
||||||
|
position: relative;
|
||||||
|
min-height: 480px;
|
||||||
|
padding: 40px 40px 0;
|
||||||
|
border-radius: 16px;
|
||||||
|
background: var(--raised);
|
||||||
|
overflow: hidden;
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
}
|
||||||
|
.feature-card h3 {
|
||||||
|
font-weight: 500;
|
||||||
|
font-size: 32px;
|
||||||
|
line-height: 1.12;
|
||||||
|
letter-spacing: -0.02em;
|
||||||
|
}
|
||||||
|
.feature-card__copy p {
|
||||||
|
margin-top: 12px;
|
||||||
|
max-width: 400px;
|
||||||
|
font-size: 16px;
|
||||||
|
line-height: 24px;
|
||||||
|
color: var(--text-2);
|
||||||
|
}
|
||||||
|
.path {
|
||||||
|
display: inline-block;
|
||||||
|
margin-top: 16px;
|
||||||
|
padding: 4px 8px;
|
||||||
|
border-radius: 6px;
|
||||||
|
background: var(--card);
|
||||||
|
border: 1px solid var(--line);
|
||||||
|
font-family: var(--mono);
|
||||||
|
font-size: 12px;
|
||||||
|
color: var(--text-2);
|
||||||
|
}
|
||||||
|
.feature-card__media {
|
||||||
|
position: relative;
|
||||||
|
margin-top: auto;
|
||||||
|
height: 248px;
|
||||||
|
margin-inline: -40px;
|
||||||
|
display: flex;
|
||||||
|
justify-content: center;
|
||||||
|
gap: 16px;
|
||||||
|
padding-top: 32px;
|
||||||
|
}
|
||||||
|
.feature-card__media img,
|
||||||
|
.feature-card__media video {
|
||||||
|
width: 336px;
|
||||||
|
height: auto;
|
||||||
|
object-fit: cover;
|
||||||
|
object-position: top;
|
||||||
|
border-radius: 12px;
|
||||||
|
border: 1px solid var(--line);
|
||||||
|
box-shadow: 0 8px 24px rgba(11, 22, 32, .06);
|
||||||
|
background: #fff;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Live recordings from the extension */
|
||||||
|
.media-clip .feature-card__media { align-items: center; }
|
||||||
|
.media-clip .feature-card__media video { width: min(480px, 100%); border-radius: 14px; }
|
||||||
|
.media-wide .feature-card__media { height: auto; padding-top: 24px; }
|
||||||
|
.media-wide .feature-card__media video { width: min(100%, 500px); border-radius: 14px 14px 0 0; border-bottom: 0; }
|
||||||
|
.media-pair .feature-card__media { justify-content: flex-start; padding-left: 24px; }
|
||||||
|
.media-pair .feature-card__media img { flex: 0 0 336px; }
|
||||||
|
.feature-card__media::after {
|
||||||
|
content: '';
|
||||||
|
position: absolute;
|
||||||
|
inset: auto 0 0 0;
|
||||||
|
height: 48px;
|
||||||
|
background: linear-gradient(to top, var(--raised), transparent);
|
||||||
|
pointer-events: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
.feature-card--dark {
|
||||||
|
grid-column: 1 / -1;
|
||||||
|
min-height: 0;
|
||||||
|
flex-direction: row;
|
||||||
|
justify-content: space-between;
|
||||||
|
gap: 48px;
|
||||||
|
padding: 48px;
|
||||||
|
background: var(--d-bg);
|
||||||
|
color: var(--d-text);
|
||||||
|
}
|
||||||
|
.feature-card--dark .feature-card__copy { display: flex; flex-direction: column; align-items: flex-start; }
|
||||||
|
.feature-card--dark .feature-card__copy p { color: var(--d-text-2); margin-bottom: 32px; }
|
||||||
|
.feature-card--dark .btn { margin-top: auto; }
|
||||||
|
.feature-card--dark .feature-card__media { margin: 0; height: auto; padding: 0; flex: 0 0 440px; }
|
||||||
|
.feature-card--dark .feature-card__media::after { display: none; }
|
||||||
|
|
||||||
|
/* Folder tree: the DRM card's moment */
|
||||||
|
.tree {
|
||||||
|
width: 100%;
|
||||||
|
padding: 8px;
|
||||||
|
border-radius: 14px;
|
||||||
|
background: var(--d-raised);
|
||||||
|
border: 1px solid var(--d-line);
|
||||||
|
box-shadow: inset 0 1px 0 rgba(255, 255, 255, .04);
|
||||||
|
font-size: 13px;
|
||||||
|
}
|
||||||
|
.tree svg { flex: none; color: var(--d-text-3); }
|
||||||
|
.tree__head {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
gap: 8px;
|
||||||
|
height: 36px;
|
||||||
|
padding: 0 8px;
|
||||||
|
color: var(--d-text-2);
|
||||||
|
border-bottom: 1px solid var(--d-line);
|
||||||
|
margin-bottom: 4px;
|
||||||
|
}
|
||||||
|
.tree ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 2px; }
|
||||||
|
.tree__row {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
gap: 8px;
|
||||||
|
height: 32px;
|
||||||
|
padding: 0 8px 0 calc(8px + var(--depth) * 20px);
|
||||||
|
border-radius: 6px;
|
||||||
|
color: var(--d-text);
|
||||||
|
}
|
||||||
|
.tree__name { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
|
||||||
|
.tree__meta { margin-left: auto; font-size: 12px; color: var(--d-text-3); }
|
||||||
|
.tree__row.is-fresh { background: var(--d-raised-2); box-shadow: inset 0 1px 0 rgba(255, 255, 255, .06); }
|
||||||
|
.tree__row.is-fresh svg { color: var(--accent); }
|
||||||
|
|
||||||
|
/* -------------------------------- Platforms ----------------------------- */
|
||||||
|
.platforms { padding: 32px 0; border-bottom: 1px solid var(--line); }
|
||||||
|
.platforms__inner { display: grid; justify-items: center; gap: 16px; width: min(1280px, calc(100% - 48px)); }
|
||||||
|
.platforms__label { font-size: 12px; color: var(--text-3); }
|
||||||
|
.platforms__list { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; justify-content: center; gap: 8px 16px; }
|
||||||
|
.platforms__list li { display: inline-flex; align-items: center; gap: 8px; font-size: 14px; font-weight: 500; color: var(--text-3); }
|
||||||
|
.platforms__list li.is-live { color: var(--text); }
|
||||||
|
.platforms__dot { width: 6px; height: 6px; border-radius: 50%; background: var(--raised-2); box-shadow: inset 0 0 0 1px var(--line-strong); }
|
||||||
|
.is-live .platforms__dot { background: var(--positive); box-shadow: 0 0 0 3px rgba(22, 163, 74, .14); }
|
||||||
|
.platforms__list .platforms__soon { padding-left: 16px; border-left: 1px solid var(--line-strong); font-size: 12px; font-weight: 400; color: var(--text-3); }
|
||||||
|
.platforms__runs { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; justify-content: center; }
|
||||||
|
.platforms__runs .platforms__label { margin-right: 4px; }
|
||||||
|
.chip { display: inline-flex; align-items: center; gap: 8px; height: 32px; padding: 0 12px; border-radius: 8px; background: var(--card); border: 1px solid var(--line-strong); font-size: 13px; font-weight: 500; }
|
||||||
|
.chip svg { color: var(--accent); }
|
||||||
|
.chip--soon { color: var(--text-2); border-style: dashed; background: transparent; }
|
||||||
|
.chip--soon svg { color: var(--text-3); }
|
||||||
|
.chip .mono { font-size: 11px; font-weight: 400; color: var(--text-3); }
|
||||||
|
|
||||||
|
/* --------------------------------- Mobile ------------------------------- */
|
||||||
|
.mobile { padding: 0 0 128px; }
|
||||||
|
.mobile__card {
|
||||||
|
display: grid; grid-template-columns: 1fr 1fr; gap: 48px; align-items: center;
|
||||||
|
padding: 56px 56px 0; border-radius: 20px; background: var(--raised); overflow: hidden;
|
||||||
|
}
|
||||||
|
.mobile__copy { padding-bottom: 56px; }
|
||||||
|
.mobile__copy h2 { font-weight: 500; font-size: 48px; line-height: 1.08; letter-spacing: -0.025em; }
|
||||||
|
.mobile__copy > p { margin-top: 16px; max-width: 28rem; font-size: 17px; line-height: 26px; color: var(--text-2); }
|
||||||
|
.mobile__list { list-style: none; margin: 24px 0 0; padding: 0; display: grid; gap: 12px; }
|
||||||
|
.mobile__list li { display: flex; align-items: center; gap: 10px; font-size: 15px; color: var(--text-2); }
|
||||||
|
.mobile__list svg { color: var(--positive); }
|
||||||
|
.mobile__note { margin-top: 32px !important; font-size: 12px !important; color: var(--text-3) !important; }
|
||||||
|
.mobile__visual { align-self: end; display: flex; justify-content: center; }
|
||||||
|
.handset {
|
||||||
|
width: 300px; height: 520px; padding: 10px 10px 0; border-radius: 48px 48px 0 0;
|
||||||
|
background: #0b1620; box-shadow: 0 32px 64px -24px rgba(11, 22, 32, .35), inset 0 0 0 1px rgba(255, 255, 255, .08);
|
||||||
|
}
|
||||||
|
.handset__screen { position: relative; height: 100%; border-radius: 38px 38px 0 0; background: var(--bg); overflow: hidden; padding: 0 16px; font-size: 13px; }
|
||||||
|
.handset__status { display: flex; align-items: center; justify-content: space-between; height: 48px; padding: 0 12px; font-size: 12px; }
|
||||||
|
.handset__island { width: 88px; height: 26px; border-radius: 13px; background: #0b1620; }
|
||||||
|
.handset__head { display: flex; align-items: center; gap: 10px; margin: 8px 0 12px; }
|
||||||
|
.handset__head > span:last-child { display: grid; line-height: 18px; }
|
||||||
|
.handset__head strong { font-weight: 500; }
|
||||||
|
.handset__head .mono { font-size: 12px; color: var(--text-3); }
|
||||||
|
.handset__media { position: relative; height: 200px; border-radius: 12px; }
|
||||||
|
.handset__bar { display: flex; align-items: center; justify-content: space-between; margin-top: 12px; color: var(--text-3); }
|
||||||
|
.handset__sheet {
|
||||||
|
position: absolute; left: 0; right: 0; bottom: 0; padding: 8px 12px 24px;
|
||||||
|
border-radius: 20px 20px 0 0; background: var(--card); border-top: 1px solid var(--line);
|
||||||
|
box-shadow: 0 -12px 32px rgba(11, 22, 32, .12);
|
||||||
|
}
|
||||||
|
.handset__grab { display: block; width: 36px; height: 4px; margin: 0 auto 12px; border-radius: 2px; background: var(--raised-2); }
|
||||||
|
.handset__sheet-title { padding: 0 8px 8px; font-weight: 500; }
|
||||||
|
.handset__sheet .menu__row .mono { font-size: 12px; color: var(--text-3); }
|
||||||
|
.handset__dest { display: flex; align-items: center; gap: 8px; margin-top: 8px; padding: 8px; border-top: 1px solid var(--line); font-size: 12px; color: var(--text-2); }
|
||||||
|
|
||||||
|
/* --------------------------------- Safety ------------------------------- */
|
||||||
|
.safety { padding: 32px 0 128px; }
|
||||||
|
.safety__top { display: grid; grid-template-columns: 1.2fr 1fr; gap: 64px; align-items: end; margin-bottom: 48px; }
|
||||||
|
.safety__top .section-heading { margin-bottom: 0; }
|
||||||
|
.safety__intro { font-size: 17px; line-height: 26px; color: var(--text-2); }
|
||||||
|
.route {
|
||||||
|
display: flex; align-items: center; justify-content: space-between; gap: 24px; flex-wrap: wrap;
|
||||||
|
padding: 16px; margin-bottom: 16px; border-radius: 16px; border: 1px dashed var(--line-strong);
|
||||||
|
}
|
||||||
|
.route__line { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
|
||||||
|
.route__stop { position: relative; display: flex; align-items: center; gap: 12px; padding-right: 32px; }
|
||||||
|
.route__stop strong { display: block; font-weight: 500; font-size: 14px; }
|
||||||
|
.route__stop .mono { font-size: 12px; color: var(--text-3); }
|
||||||
|
.route__icon { width: 36px; height: 36px; flex: none; display: grid; place-items: center; border-radius: 10px; background: var(--text); color: var(--bg); }
|
||||||
|
.route__arrow { position: absolute; right: 4px; top: 50%; width: 16px; height: 1px; background: var(--text-3); }
|
||||||
|
.route__arrow::after { content: ''; position: absolute; right: 0; top: -3px; width: 6px; height: 6px; border-top: 1px solid var(--text-3); border-right: 1px solid var(--text-3); transform: rotate(45deg); }
|
||||||
|
.route__stop--never { padding: 8px 16px 8px 8px; border-radius: 12px; background: var(--raised); }
|
||||||
|
.route__stop--never .route__icon { background: var(--card); color: var(--text-3); border: 1px solid var(--line); }
|
||||||
|
.route__stop--never strong { color: var(--text-3); }
|
||||||
|
.route__stop--never .strike { position: absolute; left: 4px; right: 4px; top: 30%; width: calc(100% - 8px); height: 40%; overflow: visible; }
|
||||||
|
.route__stop--never.is-struck .strike path { stroke-dashoffset: 0; }
|
||||||
|
|
||||||
|
.audit { border-radius: 16px; background: var(--card); border: 1px solid var(--line); overflow: hidden; }
|
||||||
|
.audit__head, .audit__row { display: grid; grid-template-columns: 1.1fr 1fr 1.2fr; gap: 24px; padding: 0 24px; }
|
||||||
|
.audit__head { height: 44px; align-items: center; font-family: var(--mono); font-size: 12px; color: var(--text-3); background: var(--raised); }
|
||||||
|
.audit__row { padding-top: 20px; padding-bottom: 20px; border-top: 1px solid var(--line); align-items: start; font-size: 15px; line-height: 22px; }
|
||||||
|
.audit__q { display: flex; gap: 12px; font-weight: 500; }
|
||||||
|
.audit__q .mono { font-size: 12px; font-weight: 400; color: var(--text-3); padding-top: 1px; }
|
||||||
|
.audit__flag, .audit__us { display: grid; grid-template-columns: 16px 1fr; gap: 10px; }
|
||||||
|
.audit__flag svg, .audit__us svg { margin-top: 4px; }
|
||||||
|
.audit__flag { color: var(--text-3); }
|
||||||
|
.audit__us { color: var(--text); }
|
||||||
|
.audit__us svg { color: var(--positive); }
|
||||||
|
.audit__row:last-child .audit__us { color: var(--accent-ink); font-weight: 500; }
|
||||||
|
.safety__rule { margin-top: 24px; text-align: center; font-size: 14px; color: var(--text-3); }
|
||||||
|
|
||||||
|
.pricing__sub { max-width: 34rem; margin: -24px auto 48px; text-align: center; font-size: 17px; line-height: 26px; color: var(--text-2); }
|
||||||
|
|
||||||
|
/* --------------------------------- Pricing ------------------------------- */
|
||||||
|
.pricing { padding: 128px 0; border-top: 1px solid var(--line); }
|
||||||
|
.pricing__grid {
|
||||||
|
display: grid;
|
||||||
|
grid-template-columns: repeat(3, 1fr);
|
||||||
|
gap: 16px;
|
||||||
|
align-items: start;
|
||||||
|
}
|
||||||
|
.plan {
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
padding: 24px;
|
||||||
|
border-radius: 16px;
|
||||||
|
background: var(--raised);
|
||||||
|
}
|
||||||
|
.plan--featured { background: var(--card); border: 1px solid var(--line-strong); box-shadow: 0 8px 24px rgba(11, 22, 32, .06); }
|
||||||
|
.plan__name { font-size: 15px; font-weight: 500; color: var(--text-2); }
|
||||||
|
.plan--featured .plan__name { color: var(--accent-ink); }
|
||||||
|
.plan__price { display: flex; align-items: baseline; gap: 8px; margin: 16px 0 12px; }
|
||||||
|
.plan__amount { font-size: 48px; font-weight: 500; line-height: 1; letter-spacing: -0.03em; font-variant-numeric: tabular-nums; }
|
||||||
|
.plan__per { font-size: 14px; color: var(--text-3); }
|
||||||
|
.plan__desc { min-height: 72px; margin-bottom: 24px; font-size: 15px; line-height: 24px; color: var(--text-2); }
|
||||||
|
.plan__features { list-style: none; padding: 24px 0 0; margin: 24px 0 0; display: grid; gap: 12px; border-top: 1px solid var(--line); }
|
||||||
|
.plan__features li { display: flex; align-items: center; gap: 10px; font-size: 14px; color: var(--text-2); }
|
||||||
|
.plan__features svg { flex: none; color: var(--text-3); }
|
||||||
|
|
||||||
|
/* --------------------------------- Reviews ------------------------------- */
|
||||||
|
.reviews { padding: 128px 0; }
|
||||||
|
.ratings { margin: -24px 0 48px; text-align: center; font-size: 14px; color: var(--text-3); }
|
||||||
|
.ratings span { margin: 0 8px; }
|
||||||
|
.reviews__wall { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; align-items: start; }
|
||||||
|
.reviews__col { display: grid; gap: 16px; }
|
||||||
|
.review {
|
||||||
|
padding: 24px;
|
||||||
|
border-radius: 14px;
|
||||||
|
background: var(--card);
|
||||||
|
border: 1px solid var(--line);
|
||||||
|
}
|
||||||
|
.review p { font-size: 15px; line-height: 24px; color: var(--text); }
|
||||||
|
.review footer { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; margin-top: 20px; }
|
||||||
|
.review strong { font-weight: 500; font-size: 14px; }
|
||||||
|
.review .mono { font-size: 12px; color: var(--text-3); }
|
||||||
|
|
||||||
|
/* ----------------------------------- FAQ -------------------------------- */
|
||||||
|
.faq {
|
||||||
|
display: grid;
|
||||||
|
grid-template-columns: 1fr 1fr;
|
||||||
|
gap: 64px;
|
||||||
|
padding: 96px 0 128px;
|
||||||
|
align-items: start;
|
||||||
|
border-top: 1px solid var(--line);
|
||||||
|
}
|
||||||
|
.faq .section-heading { margin-bottom: 24px; }
|
||||||
|
.faq__help { font-size: 15px; line-height: 24px; color: var(--text-2); }
|
||||||
|
.faq__help a { color: var(--accent-ink); text-decoration: underline; text-underline-offset: 3px; text-decoration-color: rgba(0, 109, 163, .3); }
|
||||||
|
.faq__list { list-style: none; margin: 0; padding: 0; display: grid; }
|
||||||
|
.faq__item { border-bottom: 1px solid var(--line); }
|
||||||
|
.faq__item:first-child { border-top: 1px solid var(--line); }
|
||||||
|
.faq__item button {
|
||||||
|
width: 100%;
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: space-between;
|
||||||
|
gap: 16px;
|
||||||
|
padding: 20px 0;
|
||||||
|
font-size: 16px;
|
||||||
|
font-weight: 500;
|
||||||
|
color: var(--text);
|
||||||
|
}
|
||||||
|
.faq__item button svg { flex: none; color: var(--text-3); }
|
||||||
|
.pm-v { transform-origin: center; transition: transform 200ms var(--ease); }
|
||||||
|
.pm-v.is-open { transform: scaleY(0); }
|
||||||
|
.faq__answer {
|
||||||
|
display: grid;
|
||||||
|
grid-template-rows: 0fr;
|
||||||
|
transition: grid-template-rows 300ms var(--ease);
|
||||||
|
}
|
||||||
|
.faq__answer p {
|
||||||
|
overflow: hidden;
|
||||||
|
padding-right: 32px;
|
||||||
|
font-size: 15px;
|
||||||
|
line-height: 24px;
|
||||||
|
color: var(--text-2);
|
||||||
|
}
|
||||||
|
.faq__item.is-open .faq__answer { grid-template-rows: 1fr; }
|
||||||
|
.faq__item.is-open .faq__answer p { padding-bottom: 20px; }
|
||||||
|
|
||||||
|
/* ----------------------------------- CTA -------------------------------- */
|
||||||
|
.cta {
|
||||||
|
border-radius: 20px;
|
||||||
|
background:
|
||||||
|
radial-gradient(70% 90% at 50% 0%, rgba(255, 255, 255, .28), transparent 70%),
|
||||||
|
var(--brand);
|
||||||
|
color: var(--text);
|
||||||
|
padding: 96px 24px;
|
||||||
|
text-align: center;
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
align-items: center;
|
||||||
|
}
|
||||||
|
.cta h2 {
|
||||||
|
font-weight: 500;
|
||||||
|
font-size: 48px;
|
||||||
|
line-height: 1.08;
|
||||||
|
letter-spacing: -0.025em;
|
||||||
|
margin-bottom: 32px;
|
||||||
|
}
|
||||||
|
.cta__meta { margin-top: 16px; font-size: 12px; color: rgba(11, 22, 32, .72); }
|
||||||
|
|
||||||
|
.footer {
|
||||||
|
display: flex;
|
||||||
|
justify-content: space-between;
|
||||||
|
padding: 48px 0;
|
||||||
|
font-size: 14px;
|
||||||
|
color: var(--text-3);
|
||||||
|
}
|
||||||
|
.footer .mono { font-size: 12px; }
|
||||||
|
|
||||||
|
|
||||||
|
/* -------------------------------- Figures ------------------------------- */
|
||||||
|
.figure { position: relative; }
|
||||||
|
.figure__stage {
|
||||||
|
width: 100%;
|
||||||
|
--hairline-plate: var(--raised);
|
||||||
|
--hairline-hi: var(--accent-ink);
|
||||||
|
--hairline-edge: #a29c93;
|
||||||
|
--hairline-mid: #c6c1b9;
|
||||||
|
--hairline-lo: #dfdbd4;
|
||||||
|
cursor: crosshair;
|
||||||
|
}
|
||||||
|
.figure__read {
|
||||||
|
position: absolute;
|
||||||
|
top: 0;
|
||||||
|
right: 0;
|
||||||
|
font-size: 12px;
|
||||||
|
color: var(--text-3);
|
||||||
|
}
|
||||||
|
.media-figure .feature-card__media { height: auto; padding: 0 24px 8px; margin-inline: -40px; }
|
||||||
|
.media-figure .feature-card__media::after { display: none; }
|
||||||
|
.media-figure .figure { width: min(100%, 500px); margin-inline: auto; margin-top: -16px; }
|
||||||
|
.media-figure .figure__read { top: auto; bottom: 24px; right: 32px; }
|
||||||
|
|
||||||
|
/* ------------------------------ Struck plans ---------------------------- */
|
||||||
|
.plan .btn { width: 100%; }
|
||||||
|
.plan--struck { background: transparent; border: 1px dashed var(--line-strong); }
|
||||||
|
.plan--struck .plan__name { color: var(--text-3); }
|
||||||
|
.plan__price { position: relative; }
|
||||||
|
.plan__was { position: relative; display: inline-flex; align-items: baseline; gap: 8px; color: var(--text-3); }
|
||||||
|
.strike {
|
||||||
|
position: absolute;
|
||||||
|
left: -6px;
|
||||||
|
right: -6px;
|
||||||
|
top: 30%;
|
||||||
|
width: calc(100% + 12px);
|
||||||
|
height: 24px;
|
||||||
|
overflow: visible;
|
||||||
|
}
|
||||||
|
.strike path {
|
||||||
|
fill: none;
|
||||||
|
stroke: var(--negative);
|
||||||
|
stroke-width: 2.5;
|
||||||
|
stroke-linecap: round;
|
||||||
|
stroke-dasharray: 1;
|
||||||
|
stroke-dashoffset: 1;
|
||||||
|
transition: stroke-dashoffset 500ms var(--ease) 200ms;
|
||||||
|
}
|
||||||
|
.is-struck .strike path { stroke-dashoffset: 0; }
|
||||||
|
.plan__now {
|
||||||
|
margin-left: 12px;
|
||||||
|
font-size: 20px;
|
||||||
|
color: var(--accent-ink);
|
||||||
|
opacity: 0;
|
||||||
|
transform: translateY(4px);
|
||||||
|
transition: opacity 300ms var(--ease) 650ms, transform 300ms var(--ease) 650ms;
|
||||||
|
}
|
||||||
|
.is-struck .plan__now { opacity: 1; transform: none; }
|
||||||
|
.btn--void { color: var(--text-3); border: 1px dashed var(--line-strong); cursor: default; }
|
||||||
|
.btn--void:active { transform: none; }
|
||||||
|
|
||||||
|
@media (prefers-reduced-motion: reduce) {
|
||||||
|
.strike path { stroke-dashoffset: 0; transition: none; }
|
||||||
|
.plan__now { opacity: 1; transform: none; transition: none; }
|
||||||
|
.menu.is-open, .toast { transition: none; }
|
||||||
|
}
|
||||||
|
|
||||||
|
/* -------------------------------- Responsive ---------------------------- */
|
||||||
|
@media (max-width: 1080px) {
|
||||||
|
.showcase { grid-template-columns: 1fr; padding: 96px 0; }
|
||||||
|
.showcase__visual { max-width: 560px; width: 100%; }
|
||||||
|
.feature-card--dark { flex-direction: column; }
|
||||||
|
.feature-card--dark .feature-card__media { flex-basis: auto; }
|
||||||
|
}
|
||||||
|
|
||||||
|
@media (max-width: 860px) {
|
||||||
|
.hero__title { font-size: 52px; }
|
||||||
|
.facts { grid-template-columns: 1fr 1fr; row-gap: 32px; padding: 24px 0; }
|
||||||
|
.fact { padding: 0 20px; }
|
||||||
|
.fact:nth-child(3) { border-left: 0; }
|
||||||
|
.compare__grid { grid-template-columns: 1fr; }
|
||||||
|
.compare { padding-top: 96px; }
|
||||||
|
.safety__top { grid-template-columns: 1fr; gap: 16px; }
|
||||||
|
.mobile__card { grid-template-columns: 1fr; padding: 32px 24px 0; gap: 0; }
|
||||||
|
.mobile__copy { padding-bottom: 32px; }
|
||||||
|
.mobile__copy h2 { font-size: 40px; }
|
||||||
|
.audit__head { display: none; }
|
||||||
|
.audit__row { grid-template-columns: 1fr; gap: 8px; }
|
||||||
|
.section-heading h2, .cta h2 { font-size: 40px; }
|
||||||
|
.features__grid, .pricing__grid, .faq { grid-template-columns: 1fr; }
|
||||||
|
.faq { gap: 32px; }
|
||||||
|
.reviews__wall { grid-template-columns: 1fr 1fr; }
|
||||||
|
.reviews__col:nth-child(3) { display: none; }
|
||||||
|
.feature-card { padding: 32px 24px 0; min-height: 440px; }
|
||||||
|
.feature-card--dark { padding: 32px 24px; }
|
||||||
|
.feature-card__media { margin-inline: -24px; }
|
||||||
|
.media-figure .feature-card__media { margin-inline: -24px; padding-inline: 8px; }
|
||||||
|
|
||||||
|
.preview { height: 520px; }
|
||||||
|
.preview__body { padding: 16px 16px 0; }
|
||||||
|
.feed { width: 100%; }
|
||||||
|
.toast { display: none; }
|
||||||
|
|
||||||
|
.nav__inner { grid-template-columns: 1fr auto; }
|
||||||
|
.nav__links, .nav .btn--nav { display: none; }
|
||||||
|
.nav__burger { display: grid; gap: 6px; padding: 10px; }
|
||||||
|
.nav__burger span { width: 20px; height: 1.5px; background: var(--text); border-radius: 1px; transition: transform var(--fast) var(--ease); }
|
||||||
|
.nav--open .nav__burger span:first-child { transform: translateY(4px) rotate(45deg); }
|
||||||
|
.nav--open .nav__burger span:last-child { transform: translateY(-4px) rotate(-45deg); }
|
||||||
|
.nav--open { background: var(--bg); border-bottom-color: var(--line); }
|
||||||
|
.nav--open .nav__inner { height: auto; min-height: 64px; padding-bottom: 16px; }
|
||||||
|
.nav--open .nav__links {
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
gap: 16px;
|
||||||
|
grid-column: 1 / -1;
|
||||||
|
padding: 8px 0 16px;
|
||||||
|
font-size: 16px;
|
||||||
|
}
|
||||||
|
.nav--open .btn--nav { display: inline-flex; grid-column: 1 / -1; justify-self: start; }
|
||||||
|
}
|
||||||
|
|
||||||
|
@media (max-width: 560px) {
|
||||||
|
.hero { padding: 112px 16px 0; }
|
||||||
|
.hero__title { font-size: 40px; letter-spacing: -0.03em; }
|
||||||
|
.fact__n { font-size: 40px; }
|
||||||
|
.hero__sub { font-size: 16px; line-height: 24px; }
|
||||||
|
.hero__shot { margin-top: 48px; }
|
||||||
|
.menu { width: 216px; }
|
||||||
|
.section-heading h2, .cta h2 { font-size: 32px; }
|
||||||
|
.reviews__wall { grid-template-columns: 1fr; }
|
||||||
|
.reviews__col:nth-child(2) { display: none; }
|
||||||
|
.showcase__visual { height: 420px; }
|
||||||
|
.feature-card--dark .feature-card__media { width: 100%; }
|
||||||
|
.footer { flex-direction: column; gap: 8px; }
|
||||||
|
.container { width: calc(100% - 32px); }
|
||||||
|
}
|
||||||
|
|
||||||
|
/* ------------------------- Hairline padlock (DRM card) ------------------ */
|
||||||
|
.hairline { position: relative; }
|
||||||
|
.hairline__stage {
|
||||||
|
--hairline-plate: #0a1824;
|
||||||
|
--hairline-hi: #02aff2;
|
||||||
|
--hairline-edge: #8197ab;
|
||||||
|
--hairline-mid: #3b5770;
|
||||||
|
--hairline-lo: #22405a;
|
||||||
|
--hairline-stroke: 1.1;
|
||||||
|
}
|
||||||
|
.hairline__read { position: absolute; left: 0; right: 0; bottom: 0; text-align: center; font-size: 12px; color: var(--d-text-3); }
|
||||||
|
.drm-lock { flex: 0 0 300px; align-self: center; margin-inline: -24px; }
|
||||||
|
@media (max-width: 1080px) {
|
||||||
|
.drm-lock { flex: none; width: min(280px, 100%); align-self: center; }
|
||||||
|
}
|
||||||
9
vite.config.js
Normal file
9
vite.config.js
Normal file
@@ -0,0 +1,9 @@
|
|||||||
|
import { defineConfig } from 'vite'
|
||||||
|
import react from '@vitejs/plugin-react'
|
||||||
|
|
||||||
|
export default defineConfig({
|
||||||
|
plugins: [react()],
|
||||||
|
// Hashed build output gets its own folder, so nginx can cache it forever
|
||||||
|
// without also pinning the unhashed files in public/assets.
|
||||||
|
build: { assetsDir: '_app' },
|
||||||
|
})
|
||||||
Reference in New Issue
Block a user