added an option for tiktok h265 videos, majorly cleaned up frontend
- cleaned up cobalt.js (by a lot) - removed notification dot - removed settings migration - removed vimeoDash - turned youtube track language switcher into a toggle - added clarification as to what youtube dub does - updated defaults to match with backend - now matching a url from any string at any place
This commit is contained in:
@@ -1,10 +1,30 @@
|
||||
import { checkbox, collapsibleList, explanation, footerButtons, multiPagePopup, popup, popupWithBottomButtons, sep, settingsCategory, switcher, socialLink, socialLinks, urgentNotice, keyboardShortcuts, webLoc, sponsoredList, betaTag, linkSVG } from "./elements.js";
|
||||
import { services as s, authorInfo, version, repo, donations, supportedAudio, links, env } from "../config.js";
|
||||
import { services as s, version, repo, donations, supportedAudio, links, env } from "../config.js";
|
||||
import { getCommitInfo } from "../sub/currentCommit.js";
|
||||
import loc from "../../localization/manager.js";
|
||||
import emoji from "../emoji.js";
|
||||
import changelogManager from "../changelog/changelogManager.js";
|
||||
|
||||
import {
|
||||
checkbox,
|
||||
collapsibleList,
|
||||
explanation,
|
||||
footerButtons,
|
||||
multiPagePopup,
|
||||
popup,
|
||||
popupWithBottomButtons,
|
||||
sep,
|
||||
settingsCategory,
|
||||
switcher,
|
||||
socialLink,
|
||||
socialLinks,
|
||||
urgentNotice,
|
||||
keyboardShortcuts,
|
||||
webLoc,
|
||||
sponsoredList,
|
||||
betaTag,
|
||||
linkSVG
|
||||
} from "./elements.js";
|
||||
|
||||
let com = getCommitInfo();
|
||||
|
||||
let enabledServices = Object.keys(s).filter(p => s[p].enabled).sort().map((p) => {
|
||||
@@ -98,7 +118,7 @@ export default function(obj) {
|
||||
header: {
|
||||
aboveTitle: {
|
||||
text: t('MadeWithLove'),
|
||||
url: authorInfo.link
|
||||
url: repo
|
||||
},
|
||||
closeAria: t('AccessibilityGoBack'),
|
||||
title: `${emoji("🔮", 30)} ${t('TitlePopupAbout')}`
|
||||
@@ -285,12 +305,6 @@ export default function(obj) {
|
||||
}, {
|
||||
text: donate.replace(/REPLACEME/g, t('ClickToCopy')),
|
||||
classes: ["desc-padding"]
|
||||
}, {
|
||||
text: sep(),
|
||||
raw: true
|
||||
}, {
|
||||
text: t('DonateHireMe', authorInfo.link),
|
||||
classes: ["desc-padding"]
|
||||
}]
|
||||
})
|
||||
}],
|
||||
@@ -338,16 +352,6 @@ export default function(obj) {
|
||||
}]
|
||||
})
|
||||
})
|
||||
+ settingsCategory({
|
||||
name: "twitter",
|
||||
title: "twitter",
|
||||
body: checkbox([{
|
||||
action: "twitterGif",
|
||||
name: t("SettingsTwitterGif"),
|
||||
padding: "no-margin"
|
||||
}])
|
||||
+ explanation(t('SettingsTwitterGifDescription'))
|
||||
})
|
||||
+ settingsCategory({
|
||||
name: "codec",
|
||||
title: t('SettingsCodecSubtitle'),
|
||||
@@ -367,19 +371,24 @@ export default function(obj) {
|
||||
})
|
||||
})
|
||||
+ settingsCategory({
|
||||
name: "vimeo",
|
||||
title: t('SettingsVimeoPrefer'),
|
||||
body: switcher({
|
||||
name: "vimeoDash",
|
||||
explanation: t('SettingsVimeoPreferDescription'),
|
||||
items: [{
|
||||
action: "false",
|
||||
text: "progressive"
|
||||
}, {
|
||||
action: "true",
|
||||
text: "dash"
|
||||
}]
|
||||
})
|
||||
name: "twitter",
|
||||
title: "twitter",
|
||||
body: checkbox([{
|
||||
action: "twitterGif",
|
||||
name: t("SettingsTwitterGif"),
|
||||
padding: "no-margin"
|
||||
}])
|
||||
+ explanation(t('SettingsTwitterGifDescription'))
|
||||
})
|
||||
+ settingsCategory({
|
||||
name: "tiktok",
|
||||
title: "tiktok",
|
||||
body: checkbox([{
|
||||
action: "tiktokH265",
|
||||
name: t("SettingsTikTokH265"),
|
||||
padding: "no-margin"
|
||||
}])
|
||||
+ explanation(t('SettingsTikTokH265Description'))
|
||||
})
|
||||
}, {
|
||||
name: "audio",
|
||||
@@ -401,19 +410,14 @@ export default function(obj) {
|
||||
+ explanation(t('SettingsVideoMuteExplanation'))
|
||||
})
|
||||
+ settingsCategory({
|
||||
name: "dub",
|
||||
name: "youtube-dub",
|
||||
title: t("SettingsAudioDub"),
|
||||
body: switcher({
|
||||
name: "dubLang",
|
||||
explanation: t('SettingsAudioDubDescription'),
|
||||
items: [{
|
||||
action: "original",
|
||||
text: t('SettingsDubDefault')
|
||||
}, {
|
||||
action: "auto",
|
||||
text: t('SettingsDubAuto')
|
||||
}]
|
||||
})
|
||||
body: checkbox([{
|
||||
action: "ytDub",
|
||||
name: t("SettingsYoutubeDub"),
|
||||
padding: "no-margin"
|
||||
}])
|
||||
+ explanation(t('SettingsYoutubeDubDescription'))
|
||||
})
|
||||
+ settingsCategory({
|
||||
name: "tiktok-audio",
|
||||
|
||||
@@ -88,7 +88,8 @@ export default async function(host, patternMatch, url, lang, obj) {
|
||||
postId: patternMatch.postId,
|
||||
id: patternMatch.id,
|
||||
fullAudio: obj.isTTFullAudio,
|
||||
isAudioOnly: isAudioOnly
|
||||
isAudioOnly: isAudioOnly,
|
||||
h265: obj.tiktokH265
|
||||
});
|
||||
break;
|
||||
case "tumblr":
|
||||
@@ -103,8 +104,7 @@ export default async function(host, patternMatch, url, lang, obj) {
|
||||
id: patternMatch.id.slice(0, 11),
|
||||
password: patternMatch.password,
|
||||
quality: obj.vQuality,
|
||||
isAudioOnly: isAudioOnly,
|
||||
forceDash: isAudioOnly ? true : obj.vimeoDash
|
||||
isAudioOnly: isAudioOnly
|
||||
});
|
||||
break;
|
||||
case "soundcloud":
|
||||
|
||||
@@ -47,8 +47,8 @@ export default async function(obj) {
|
||||
images = detail.image_post_info?.images;
|
||||
|
||||
let playAddr = detail.video.play_addr_h264;
|
||||
|
||||
if (!playAddr) playAddr = detail.video.play_addr;
|
||||
if ((obj.h265 || !playAddr) && detail.video.play_addr)
|
||||
playAddr = detail.video.play_addr;
|
||||
|
||||
if (!obj.isAudioOnly && !images) {
|
||||
video = playAddr.url_list[0];
|
||||
|
||||
@@ -39,7 +39,7 @@ export default async function(obj) {
|
||||
if (!api) return { error: 'ErrorCouldntFetch' };
|
||||
|
||||
let downloadType = "dash";
|
||||
if (!obj.forceDash && JSON.stringify(api).includes('"progressive":[{')) downloadType = "progressive";
|
||||
if (!obj.isAudioOnly && JSON.stringify(api).includes('"progressive":[{')) downloadType = "progressive";
|
||||
|
||||
let fileMetadata = {
|
||||
title: cleanString(api.video.title.trim()),
|
||||
|
||||
@@ -9,7 +9,15 @@ const apiVar = {
|
||||
aFormat: ["best", "mp3", "ogg", "wav", "opus"],
|
||||
filenamePattern: ["classic", "pretty", "basic", "nerdy"]
|
||||
},
|
||||
booleanOnly: ["isAudioOnly", "isTTFullAudio", "isAudioMuted", "dubLang", "vimeoDash", "disableMetadata", "twitterGif"]
|
||||
booleanOnly: [
|
||||
"isAudioOnly",
|
||||
"isTTFullAudio",
|
||||
"isAudioMuted",
|
||||
"dubLang",
|
||||
"disableMetadata",
|
||||
"twitterGif",
|
||||
"tiktokH265"
|
||||
]
|
||||
}
|
||||
const forbiddenCharsString = ['}', '{', '%', '>', '<', '^', ';', '`', '$', '"', "@", '='];
|
||||
|
||||
@@ -83,8 +91,8 @@ export function checkJSONPost(obj) {
|
||||
isAudioMuted: false,
|
||||
disableMetadata: false,
|
||||
dubLang: false,
|
||||
vimeoDash: false,
|
||||
twitterGif: false
|
||||
twitterGif: false,
|
||||
tiktokH265: false
|
||||
}
|
||||
try {
|
||||
let objKeys = Object.keys(obj);
|
||||
|
||||
Reference in New Issue
Block a user