merge: 10.6 updates
This commit is contained in:
@@ -40,9 +40,9 @@
|
||||
"video.twitter.gif.title": "convert looping videos to GIF",
|
||||
"video.twitter.gif.description": "GIF conversion is inefficient, converted file may be obnoxiously big and low quality.",
|
||||
|
||||
"video.tiktok.h265": "tiktok",
|
||||
"video.tiktok.h265.title": "prefer HEVC/H265 format",
|
||||
"video.tiktok.h265.description": "allows downloading videos in 1080p at cost of compatibility.",
|
||||
"video.h265": "high efficiency video codec",
|
||||
"video.h265.title": "allow h265 for videos",
|
||||
"video.h265.description": "allows downloading videos from platforms like tiktok and xiaohongshu in higher quality at cost of compatibility.",
|
||||
|
||||
"audio.format": "audio format",
|
||||
"audio.format.best": "best",
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@imput/cobalt-web",
|
||||
"version": "10.5.1",
|
||||
"version": "10.6",
|
||||
"type": "module",
|
||||
"private": true,
|
||||
"scripts": {
|
||||
|
||||
@@ -11,6 +11,7 @@
|
||||
import dialogs from "$lib/state/dialogs";
|
||||
import { link } from "$lib/state/omnibox";
|
||||
import { updateSetting } from "$lib/state/settings";
|
||||
import { pasteLinkFromClipboard } from "$lib/clipboard";
|
||||
import { turnstileEnabled, turnstileSolved } from "$lib/state/turnstile";
|
||||
|
||||
import type { Optional } from "$lib/types/generic";
|
||||
@@ -41,7 +42,7 @@
|
||||
|
||||
const validLink = (url: string) => {
|
||||
try {
|
||||
return /^https:/i.test(new URL(url).protocol);
|
||||
return /^https?\:/i.test(new URL(url).protocol);
|
||||
} catch {}
|
||||
};
|
||||
|
||||
@@ -59,22 +60,24 @@
|
||||
goto("/", { replaceState: true });
|
||||
}
|
||||
|
||||
const pasteClipboard = () => {
|
||||
const pasteClipboard = async () => {
|
||||
if ($dialogs.length > 0 || isDisabled || isLoading) {
|
||||
return;
|
||||
}
|
||||
|
||||
navigator.clipboard.readText().then(async (text: string) => {
|
||||
let matchLink = text.match(/https:\/\/[^\s]+/g);
|
||||
if (matchLink) {
|
||||
$link = matchLink[0];
|
||||
const pastedData = await pasteLinkFromClipboard();
|
||||
if (!pastedData) return;
|
||||
|
||||
if (!isBotCheckOngoing) {
|
||||
await tick(); // wait for button to render
|
||||
downloadButton.download($link);
|
||||
}
|
||||
const linkMatch = pastedData.match(/https?\:\/\/[^\s]+/g);
|
||||
|
||||
if (linkMatch) {
|
||||
$link = linkMatch[0].split(',')[0];
|
||||
|
||||
if (!isBotCheckOngoing) {
|
||||
await tick(); // wait for button to render
|
||||
downloadButton.download($link);
|
||||
}
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
const changeDownloadMode = (mode: DownloadModeOption) => {
|
||||
|
||||
17
web/src/lib/clipboard.ts
Normal file
17
web/src/lib/clipboard.ts
Normal file
@@ -0,0 +1,17 @@
|
||||
const allowedLinkTypes = new Set(["text/plain", "text/uri-list"]);
|
||||
|
||||
export const pasteLinkFromClipboard = async () => {
|
||||
const clipboard = await navigator.clipboard.read();
|
||||
|
||||
if (clipboard?.length) {
|
||||
const clipboardItem = clipboard[0];
|
||||
for (const type of clipboardItem.types) {
|
||||
if (allowedLinkTypes.has(type)) {
|
||||
const blob = await clipboardItem.getType(type);
|
||||
const blobText = await blob.text();
|
||||
|
||||
return blobText;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -69,6 +69,15 @@
|
||||
/>
|
||||
</SettingsCategory>
|
||||
|
||||
<SettingsCategory sectionId="h265" title={$t("settings.video.h265")}>
|
||||
<SettingsToggle
|
||||
settingContext="save"
|
||||
settingId="tiktokH265"
|
||||
title={$t("settings.video.h265.title")}
|
||||
description={$t("settings.video.h265.description")}
|
||||
/>
|
||||
</SettingsCategory>
|
||||
|
||||
<SettingsCategory sectionId="twitter" title={$t("settings.video.twitter.gif")}>
|
||||
<SettingsToggle
|
||||
settingContext="save"
|
||||
@@ -78,11 +87,3 @@
|
||||
/>
|
||||
</SettingsCategory>
|
||||
|
||||
<SettingsCategory sectionId="tiktok" title={$t("settings.video.tiktok.h265")}>
|
||||
<SettingsToggle
|
||||
settingContext="save"
|
||||
settingId="tiktokH265"
|
||||
title={$t("settings.video.tiktok.h265.title")}
|
||||
description={$t("settings.video.tiktok.h265.description")}
|
||||
/>
|
||||
</SettingsCategory>
|
||||
|
||||
Reference in New Issue
Block a user