mirror of
https://github.com/PR0M3TH3AN/bitvid.git
synced 2026-11-05 12:22:28 +00:00
Fix Netlify build by restoring dist build script and config
- Restore `scripts/build-dist.mjs` to clean `dist/`, build CSS, and copy assets. - Update `package.json` to use the new build script and serve `dist`. - Update `netlify.toml` to publish the `dist` directory. - Update `dist/` artifacts to match current source. Co-authored-by: PR0M3TH3AN <[email protected]>
This commit is contained in:
1 parent
a432d3d4c0
commit
c862cbc358
72 files changed
+1555
-5883
No files matched your search
+9
-25
@@ -6,9 +6,6 @@ import { buildVideoAddressPointer } from "../utils/videoPointer.js";
|
||||
const DEFAULT_IDF_REFRESH_INTERVAL_MS = 5 * 60 * 1000;
|
||||
const DEFAULT_HISTORY_REFRESH_INTERVAL_MS = 60 * 1000;
|
||||
const DEFAULT_REFRESH_DEBOUNCE_MS = 200;
|
||||
const YIELD_CHUNK_SIZE = 500;
|
||||
|
||||
const yieldToMain = () => new Promise((resolve) => setTimeout(resolve, 0));
|
||||
|
||||
function normalizeAddressKey(value) {
|
||||
if (typeof value !== "string") {
|
||||
@@ -102,8 +99,7 @@ export async function buildWatchHistoryTagCounts({
|
||||
return counts;
|
||||
}
|
||||
|
||||
for (let i = 0; i < items.length; i++) {
|
||||
const entry = items[i];
|
||||
for (const entry of items) {
|
||||
const pointer = normalizePointerInput(entry?.pointer || entry);
|
||||
let video = entry?.video || entry?.metadata?.video || null;
|
||||
|
||||
@@ -127,16 +123,12 @@ export async function buildWatchHistoryTagCounts({
|
||||
for (const tag of tags) {
|
||||
counts.set(tag, (counts.get(tag) || 0) + 1);
|
||||
}
|
||||
|
||||
if (i > 0 && i % YIELD_CHUNK_SIZE === 0) {
|
||||
await yieldToMain();
|
||||
}
|
||||
}
|
||||
|
||||
return counts;
|
||||
}
|
||||
|
||||
export async function buildTagIdf({ videos } = {}) {
|
||||
export function buildTagIdf({ videos } = {}) {
|
||||
const idf = new Map();
|
||||
const list = Array.isArray(videos) ? videos : [];
|
||||
if (!list.length) {
|
||||
@@ -146,31 +138,23 @@ export async function buildTagIdf({ videos } = {}) {
|
||||
const docFrequency = new Map();
|
||||
const totalDocs = list.length;
|
||||
|
||||
for (let i = 0; i < list.length; i++) {
|
||||
const video = list[i];
|
||||
for (const video of list) {
|
||||
const tags = collectVideoTags(video);
|
||||
if (tags.size) {
|
||||
for (const tag of tags) {
|
||||
docFrequency.set(tag, (docFrequency.get(tag) || 0) + 1);
|
||||
}
|
||||
if (!tags.size) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (i > 0 && i % YIELD_CHUNK_SIZE === 0) {
|
||||
await yieldToMain();
|
||||
for (const tag of tags) {
|
||||
docFrequency.set(tag, (docFrequency.get(tag) || 0) + 1);
|
||||
}
|
||||
}
|
||||
|
||||
let processedCount = 0;
|
||||
for (const [tag, df] of docFrequency.entries()) {
|
||||
const ratio = (totalDocs + 1) / (df + 1);
|
||||
const value = 1 + Math.log(ratio);
|
||||
if (Number.isFinite(value) && value > 0) {
|
||||
idf.set(tag, value);
|
||||
}
|
||||
processedCount++;
|
||||
if (processedCount % YIELD_CHUNK_SIZE === 0) {
|
||||
await yieldToMain();
|
||||
}
|
||||
}
|
||||
|
||||
return idf;
|
||||
@@ -326,7 +310,7 @@ export default class ExploreDataService {
|
||||
}
|
||||
}
|
||||
|
||||
async refreshTagIdf({ force = false, videos, reason } = {}) {
|
||||
refreshTagIdf({ force = false, videos, reason } = {}) {
|
||||
const now = Date.now();
|
||||
if (!force && this.tagIdfUpdatedAt) {
|
||||
const elapsed = now - this.tagIdfUpdatedAt;
|
||||
@@ -342,7 +326,7 @@ export default class ExploreDataService {
|
||||
: [];
|
||||
|
||||
try {
|
||||
this.tagIdf = await buildTagIdf({ videos: sourceVideos });
|
||||
this.tagIdf = buildTagIdf({ videos: sourceVideos });
|
||||
this.tagIdfUpdatedAt = now;
|
||||
} catch (error) {
|
||||
if (this.logger?.warn) {
|
||||
|
||||
Reference in new issue
Block a user