Compare commits
2 Commits
fix-ismusi
...
6d13aed0f0
Author | SHA1 | Date | |
---|---|---|---|
6d13aed0f0
|
|||
185d28c295
|
@ -4,7 +4,7 @@ import {
|
|||||||
ODESLI_API_KEY,
|
ODESLI_API_KEY,
|
||||||
YOUTUBE_API_KEY
|
YOUTUBE_API_KEY
|
||||||
} from '$env/static/private';
|
} from '$env/static/private';
|
||||||
import { enableVerboseLog, log } from '$lib/log';
|
import { log } from '$lib/log';
|
||||||
import type {
|
import type {
|
||||||
Account,
|
Account,
|
||||||
AccountAvatar,
|
AccountAvatar,
|
||||||
@ -59,17 +59,13 @@ export class TimelineReader {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const item = respObj.items[0];
|
const item = respObj.items[0];
|
||||||
if (!item.snippet) {
|
if (item.tags?.includes('music')) {
|
||||||
console.warn('Could not load snippet for video', videoId, item);
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
if (item.snippet.tags?.includes('music')) {
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
const categorySearchParams = new URLSearchParams([
|
const categorySearchParams = new URLSearchParams([
|
||||||
['part', 'snippet'],
|
['part', 'snippet'],
|
||||||
['id', item.snippet.categoryId],
|
['id', item.categoryId],
|
||||||
['key', YOUTUBE_API_KEY]
|
['key', YOUTUBE_API_KEY]
|
||||||
]);
|
]);
|
||||||
const youtubeCategoryUrl = new URL(
|
const youtubeCategoryUrl = new URL(
|
||||||
@ -77,25 +73,7 @@ export class TimelineReader {
|
|||||||
);
|
);
|
||||||
const categoryTitle: string = await fetch(youtubeCategoryUrl)
|
const categoryTitle: string = await fetch(youtubeCategoryUrl)
|
||||||
.then((r) => r.json())
|
.then((r) => r.json())
|
||||||
.then((r) => r.items[0]?.snippet?.title);
|
.then((r) => r.items[0]?.title);
|
||||||
if (enableVerboseLog) {
|
|
||||||
log.verbose(
|
|
||||||
'Video',
|
|
||||||
videoId,
|
|
||||||
'category',
|
|
||||||
categoryTitle,
|
|
||||||
'tags',
|
|
||||||
item.snippet.tags,
|
|
||||||
'category id',
|
|
||||||
item.snippet.categoryId,
|
|
||||||
'response',
|
|
||||||
respObj,
|
|
||||||
'snippet',
|
|
||||||
item.snippet
|
|
||||||
);
|
|
||||||
} else {
|
|
||||||
log.debug('Video', videoId, 'category', categoryTitle);
|
|
||||||
}
|
|
||||||
return categoryTitle === 'Music';
|
return categoryTitle === 'Music';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -11,15 +11,14 @@ const config = {
|
|||||||
// adapter-auto only supports some environments, see https://kit.svelte.dev/docs/adapter-auto for a list.
|
// adapter-auto only supports some environments, see https://kit.svelte.dev/docs/adapter-auto for a list.
|
||||||
// If your environment is not supported or you settled on a specific environment, switch out the adapter.
|
// If your environment is not supported or you settled on a specific environment, switch out the adapter.
|
||||||
// See https://kit.svelte.dev/docs/adapters for more information about adapters.
|
// See https://kit.svelte.dev/docs/adapters for more information about adapters.
|
||||||
adapter: adapter()
|
adapter: adapter(),
|
||||||
},
|
|
||||||
|
|
||||||
csp: {
|
csp: {
|
||||||
directives: {
|
directives: {
|
||||||
'script-src': ['self']
|
'script-src': ['self', 'unsafe-inline'],
|
||||||
},
|
'base-uri': ['self'],
|
||||||
reportOnly: {
|
'object-src': ['none']
|
||||||
'script-src': ['self']
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
Reference in New Issue
Block a user