1
0
mirror of https://github.com/TeamPiped/Piped.git synced 2024-12-17 07:40:27 +05:30
Piped/src/components/PreferencesPage.vue

690 lines
29 KiB
Vue
Raw Normal View History

2020-11-17 10:45:35 +05:30
<template>
<div class="flex">
<button @click="$router.go(-1) || $router.push('/')">
2023-07-27 17:16:05 +05:30
<font-awesome-icon icon="chevron-left" /><span v-t="'actions.back'" class="ml-1.5" />
</button>
</div>
<h1 v-t="'titles.preferences'" class="font-bold text-center" />
2020-11-22 10:04:27 +05:30
<hr />
2022-08-11 22:42:08 +05:30
<label for="ddlTheme" class="pref">
<strong v-t="'actions.theme'" />
<select id="ddlTheme" v-model="selectedTheme" class="select w-auto" @change="onChange($event)">
<option v-t="'actions.auto'" value="auto" />
<option v-t="'actions.dark'" value="dark" />
2022-08-11 22:53:18 +05:30
<option v-t="'actions.light'" value="light" />
</select>
</label>
<label class="pref" for="ddlLanguageSelection">
<strong v-t="'actions.language_selection'" />
<select id="ddlLanguageSelection" v-model="selectedLanguage" class="select w-auto" @change="onChange($event)">
<option v-for="language in languages" :key="language.code" :value="language.code" v-text="language.name" />
</select>
</label>
<label class="pref" for="ddlCountrySelection">
<strong v-t="'actions.country_selection'" />
2022-08-13 14:05:54 +05:30
<select id="ddlCountrySelection" v-model="countrySelected" class="select w-50" @change="onChange($event)">
2022-08-11 22:53:18 +05:30
<option v-for="country in countryMap" :key="country.code" :value="country.code" v-text="country.name" />
</select>
</label>
<label class="pref" for="ddlDefaultHomepage">
<strong v-t="'actions.default_homepage'" />
<select id="ddlDefaultHomepage" v-model="defaultHomepage" class="select w-auto" @change="onChange($event)">
<option v-t="'titles.trending'" value="trending" />
<option v-t="'titles.feed'" value="feed" />
</select>
</label>
2023-07-27 17:16:05 +05:30
<h2 v-t="'titles.player'" class="text-center" />
2022-08-11 22:42:08 +05:30
<label class="pref" for="chkAutoPlayVideo">
<strong v-t="'actions.autoplay_video'" />
<input
id="chkAutoPlayVideo"
v-model="autoPlayVideo"
class="checkbox"
type="checkbox"
@change="onChange($event)"
/>
</label>
2023-05-19 21:08:11 +05:30
<label class="pref" for="chkAutoDisplayCaptions">
<strong v-t="'actions.auto_display_captions'" />
<input
id="chkAutoDisplayCaptions"
v-model="autoDisplayCaptions"
class="checkbox"
type="checkbox"
@change="onChange($event)"
/>
</label>
2023-03-03 03:26:06 +05:30
<label class="pref" for="chkAutoPlayNextCountdown">
<strong v-t="'actions.autoplay_next_countdown'" />
<input
id="chkAutoPlayNextCountdown"
v-model="autoPlayNextCountdown"
class="input w-24"
type="number"
@change="onChange($event)"
/>
</label>
2022-08-11 22:42:08 +05:30
<label class="pref" for="chkAudioOnly">
<strong v-t="'actions.audio_only'" />
<input id="chkAudioOnly" v-model="listen" class="checkbox" type="checkbox" @change="onChange($event)" />
</label>
<label class="pref" for="ddlDefaultQuality">
<strong v-t="'actions.default_quality'" />
<select id="ddlDefaultQuality" v-model="defaultQuality" class="select w-auto" @change="onChange($event)">
<option v-t="'actions.auto'" value="0" />
<option v-for="resolution in resolutions" :key="resolution" :value="resolution" v-text="`${resolution}p`" />
</select>
</label>
<label class="pref" for="txtBufferingGoal">
<strong v-t="'actions.buffering_goal'" />
<input
id="txtBufferingGoal"
v-model="bufferingGoal"
2022-08-13 14:05:54 +05:30
class="input w-24"
2022-08-11 22:42:08 +05:30
type="text"
@change="onChange($event)"
/>
</label>
<label class="pref" for="chkMinimizeComments">
<strong v-t="'actions.minimize_comments_default'" />
2022-08-11 22:42:08 +05:30
<input
id="chkMinimizeComments"
v-model="minimizeComments"
2022-08-11 22:42:08 +05:30
class="checkbox"
type="checkbox"
@change="onChange($event)"
/>
</label>
<label class="pref" for="chkMinimizeDescription">
<strong v-t="'actions.minimize_description_default'" />
<input
id="chkMinimizeDescription"
v-model="minimizeDescription"
class="checkbox"
type="checkbox"
@change="onChange($event)"
/>
</label>
<label class="pref" for="chkMinimizeRecommendations">
<strong v-t="'actions.minimize_recommendations_default'" />
<input
id="chkMinimizeRecommendations"
v-model="minimizeRecommendations"
class="checkbox"
type="checkbox"
@change="onChange($event)"
/>
</label>
<label class="pref" for="chkMinimizeChapters">
<strong v-t="'actions.minimize_chapters_default'" />
<input
id="chkMinimizeChapters"
v-model="minimizeChapters"
class="checkbox"
type="checkbox"
@change="onChange($event)"
/>
</label>
<!-- chapters layout on mobile -->
<label class="lg:invisible pref" for="chkMinimizeChapters">
<strong v-t="'actions.chapters_layout_mobile'" />
<select id="ddlDefaultHomepage" v-model="mobileChapterLayout" class="select w-auto" @change="onChange($event)">
<option v-t="'video.chapters_horizontal'" value="Horizontal" />
<option v-t="'video.chapters_vertical'" value="Vertical" />
</select>
</label>
2022-11-02 21:40:27 +05:30
<label class="pref" for="chkShowWatchOnYouTube">
<strong v-t="'actions.show_watch_on_youtube'" />
<input
id="chkShowWatchOnYouTube"
v-model="showWatchOnYouTube"
class="checkbox"
type="checkbox"
@change="onChange($event)"
/>
</label>
2023-06-13 13:54:29 +05:30
<label class="pref" for="chkShowSearchSuggestions">
<strong v-t="'actions.show_search_suggestions'" />
<input
id="chkShowSearchSuggestions"
v-model="searchSuggestions"
class="checkbox"
type="checkbox"
@change="onChange($event)"
/>
</label>
2022-09-11 23:31:58 +05:30
<label class="pref" for="chkStoreSearchHistory">
<strong v-t="'actions.store_search_history'" />
<input
id="chkStoreSearchHistory"
v-model="searchHistory"
class="checkbox"
type="checkbox"
@change="onChange($event)"
/>
</label>
2022-08-11 22:42:08 +05:30
<label class="pref" for="chkStoreWatchHistory">
<strong v-t="'actions.store_watch_history'" />
<input
id="chkStoreWatchHistory"
v-model="watchHistory"
class="checkbox"
type="checkbox"
@change="onChange($event)"
/>
</label>
2022-09-10 22:38:50 +05:30
<label v-if="watchHistory" class="pref" for="chkHideWatched">
<strong v-t="'actions.hide_watched'" />
<input id="chkHideWatched" v-model="hideWatched" class="checkbox" type="checkbox" @change="onChange($event)" />
</label>
2022-08-11 22:42:08 +05:30
<label class="pref" for="ddlEnabledCodecs">
<strong v-t="'actions.enabled_codecs'" />
<select
id="ddlEnabledCodecs"
v-model="enabledCodecs"
class="select w-auto h-auto"
multiple
@change="onChange($event)"
>
<option value="av1">AV1</option>
<option value="vp9">VP9</option>
<option value="avc">AVC (h.264)</option>
</select>
</label>
<label class="pref" for="chkDisableLBRY">
<strong v-t="'actions.disable_lbry'" />
<input id="chkDisableLBRY" v-model="disableLBRY" class="checkbox" type="checkbox" @change="onChange($event)" />
</label>
<label class="pref" for="chkEnableLBRYProxy">
<strong v-t="'actions.enable_lbry_proxy'" />
<input
id="chkEnableLBRYProxy"
v-model="proxyLBRY"
class="checkbox"
type="checkbox"
@change="onChange($event)"
/>
</label>
<h2 class="text-center">SponsorBlock</h2>
<p class="text-center">
<span v-t="'actions.uses_api_from'" /><a class="link" href="https://sponsor.ajay.app/">sponsor.ajay.app</a>
</p>
<label class="pref" for="chkEnableSponsorblock">
<strong v-t="'actions.enable_sponsorblock'" />
<input
id="chkEnableSponsorblock"
v-model="sponsorBlock"
class="checkbox"
type="checkbox"
@change="onChange($event)"
/>
</label>
<div v-if="sponsorBlock">
2023-07-27 17:16:05 +05:30
<label v-for="[name, item] in skipOptions" :key="name" class="pref" :for="'ddlSkip_' + name">
2023-02-06 22:54:12 +05:30
<strong v-t="item.label" />
<select :id="'ddlSkip_' + name" v-model="item.value" class="select w-auto" @change="onChange($event)">
<option v-t="'actions.no'" value="no" />
<option v-t="'actions.skip_button_only'" value="button" />
<option v-t="'actions.skip_automatically'" value="auto" />
</select>
</label>
<label class="pref" for="chkShowMarkers">
<strong v-t="'actions.show_markers'" />
<input
id="chkShowMarkers"
v-model="showMarkers"
class="checkbox"
type="checkbox"
@change="onChange($event)"
/>
</label>
<label class="pref" for="txtMinSegmentLength">
<strong v-t="'actions.min_segment_length'" />
<input
id="txtMinSegmentLength"
v-model="minSegmentLength"
class="input w-24"
type="text"
@change="onChange($event)"
/>
</label>
</div>
2023-07-19 06:10:12 +05:30
2023-07-27 17:16:05 +05:30
<h2 v-t="'titles.dearrow'" class="text-center" />
2023-07-19 06:10:12 +05:30
<p class="text-center">
<span v-t="'actions.uses_api_from'" /><a class="link" href="https://sponsor.ajay.app/">sponsor.ajay.app</a>
</p>
<label class="pref" for="chkDeArrow">
<strong v-t="'actions.enable_dearrow'" />
<input id="chkDeArrow" v-model="dearrow" class="checkbox" type="checkbox" @change="onChange($event)" />
</label>
2023-07-27 17:16:05 +05:30
<h2 v-t="'titles.instance'" class="text-center" />
2022-08-11 22:42:08 +05:30
<label class="pref" for="ddlInstanceSelection">
<strong v-text="`${$t('actions.instance_selection')}:`" />
<select id="ddlInstanceSelection" v-model="selectedInstance" class="select w-auto" @change="onChange($event)">
<option
v-for="instance in instances"
:key="instance.name"
:value="instance.api_url"
v-text="instance.name"
/>
</select>
</label>
<label class="pref" for="chkAuthInstance">
<strong v-text="`${$t('actions.different_auth_instance')}:`" />
<input
id="chkAuthInstance"
v-model="authInstance"
class="checkbox"
type="checkbox"
@change="onChange($event)"
/>
</label>
<template v-if="authInstance">
<label class="pref" for="ddlAuthInstanceSelection">
<strong v-text="`${$t('actions.instance_auth_selection')}:`" />
<select
id="ddlAuthInstanceSelection"
v-model="selectedAuthInstance"
class="select w-auto"
@change="onChange($event)"
>
<option
v-for="instance in instances"
:key="instance.name"
:value="instance.api_url"
v-text="instance.name"
/>
</select>
</label>
</template>
<br />
2022-08-11 22:42:08 +05:30
<!-- options that are visible only when logged in -->
2023-07-27 17:16:05 +05:30
<div v-if="authenticated">
<h2 v-t="'titles.account'" class="text-center"></h2>
2022-08-11 22:42:08 +05:30
<label class="pref" for="txtDeleteAccountPassword">
<strong v-t="'actions.delete_account'" />
<div class="flex items-center">
<input
id="txtDeleteAccountPassword"
ref="txtDeleteAccountPassword"
v-model="password"
:placeholder="$t('login.password')"
:aria-label="$t('login.password')"
2022-08-11 22:53:18 +05:30
class="input w-auto mr-2"
2022-08-11 22:42:08 +05:30
type="password"
2023-07-27 17:16:05 +05:30
@keyup.enter="deleteAccount"
2022-08-11 22:42:08 +05:30
/>
2023-07-27 17:16:05 +05:30
<a v-t="'actions.delete_account'" class="btn w-auto" @click="deleteAccount" />
2022-08-11 22:42:08 +05:30
</div>
</label>
<div class="pref">
2023-07-27 17:16:05 +05:30
<a v-t="'actions.logout'" class="btn w-auto" @click="logout" />
2022-08-11 22:42:08 +05:30
<a
2023-07-27 17:16:05 +05:30
v-t="'actions.invalidate_session'"
2022-08-11 22:42:08 +05:30
class="btn w-auto"
style="margin-left: 0.5em"
@click="invalidateSession"
/>
</div>
<br />
</div>
<h2 id="instancesList" v-t="'actions.instances_list'" />
<table class="table">
2020-11-17 10:45:35 +05:30
<thead>
<tr>
<th v-t="'preferences.instance_name'" />
<th v-t="'preferences.instance_locations'" />
<th v-t="'preferences.has_cdn'" />
<th v-t="'preferences.registered_users'" />
2023-07-27 17:16:05 +05:30
<th v-t="'preferences.version'" class="lt-md:hidden" />
<th v-t="'preferences.up_to_date'" />
<th v-t="'preferences.ssl_score'" />
2020-11-17 10:45:35 +05:30
</tr>
</thead>
<tbody v-for="instance in instances" :key="instance.name">
2020-11-17 10:45:35 +05:30
<tr>
2021-12-27 21:59:25 +05:30
<td v-text="instance.name" />
<td v-text="instance.locations" />
2022-08-13 17:12:35 +05:30
<td v-text="`${instance.cdn ? '&#9989;' : '&#10060;'}`" />
<td v-text="instance.registered" />
2022-08-17 19:04:57 +05:30
<td class="lt-md:hidden" v-text="instance.version" />
2022-08-13 17:12:35 +05:30
<td v-text="`${instance.up_to_date ? '&#9989;' : '&#10060;'}`" />
2020-11-30 12:09:40 +05:30
<td>
2023-07-27 17:16:05 +05:30
<a v-t="'actions.view_ssl_score'" :href="sslScore(instance.api_url)" target="_blank" />
2020-11-30 12:09:40 +05:30
</td>
2020-11-17 10:45:35 +05:30
</tr>
</tbody>
</table>
2022-08-11 23:04:35 +05:30
<br />
2022-08-22 17:21:44 +05:30
<p v-t="'info.preferences_note'" />
2022-08-11 23:04:35 +05:30
<br />
2023-07-27 17:16:05 +05:30
<button v-t="'actions.reset_preferences'" class="btn" @click="showConfirmResetPrefsDialog = true" />
<button v-t="'actions.backup_preferences'" class="btn mx-4" @click="backupPreferences()" />
<label v-t="'actions.restore_preferences'" for="fileSelector" class="btn" @click="restorePreferences()" />
<input id="fileSelector" ref="fileSelector" class="hidden" type="file" @change="restorePreferences()" />
<ConfirmModal
v-if="showConfirmResetPrefsDialog"
2023-07-27 17:16:05 +05:30
:message="$t('actions.confirm_reset_preferences')"
@close="showConfirmResetPrefsDialog = false"
@confirm="resetPreferences()"
/>
2020-11-17 10:45:35 +05:30
</template>
<script>
import CountryMap from "@/utils/CountryMaps/en.json";
import ConfirmModal from "./ConfirmModal.vue";
2020-11-17 10:45:35 +05:30
export default {
2023-07-27 17:16:05 +05:30
components: {
ConfirmModal,
},
2020-11-17 10:45:35 +05:30
data() {
return {
mobileChapterLayout: "Vertical",
2020-11-17 10:45:35 +05:30
selectedInstance: null,
authInstance: false,
selectedAuthInstance: null,
2021-02-25 20:10:40 +05:30
instances: [],
2021-02-25 20:48:59 +05:30
sponsorBlock: true,
2023-02-06 22:54:12 +05:30
skipOptions: new Map([
["sponsor", { value: "auto", label: "actions.skip_sponsors" }],
["intro", { value: "no", label: "actions.skip_intro" }],
["outro", { value: "no", label: "actions.skip_outro" }],
["preview", { value: "no", label: "actions.skip_preview" }],
["interaction", { value: "auto", label: "actions.skip_interaction" }],
["selfpromo", { value: "auto", label: "actions.skip_self_promo" }],
["music_offtopic", { value: "auto", label: "actions.skip_non_music" }],
["poi_highlight", { value: "no", label: "actions.skip_highlight" }],
["filler", { value: "no", label: "actions.skip_filler_tangent" }],
]),
showMarkers: true,
minSegmentLength: 0,
2023-07-19 06:10:12 +05:30
dearrow: false,
selectedTheme: "dark",
autoPlayVideo: true,
2023-05-19 21:08:11 +05:30
autoDisplayCaptions: false,
2023-03-03 03:26:06 +05:30
autoPlayNextCountdown: 5,
listen: false,
resolutions: [144, 240, 360, 480, 720, 1080, 1440, 2160, 4320],
2021-06-22 01:33:11 +05:30
defaultQuality: 0,
2021-06-22 16:24:20 +05:30
bufferingGoal: 10,
countryMap: CountryMap,
countrySelected: "US",
defaultHomepage: "trending",
minimizeComments: false,
minimizeDescription: false,
minimizeRecommendations: false,
minimizeChapters: false,
2022-11-02 21:40:27 +05:30
showWatchOnYouTube: false,
2023-06-13 13:54:29 +05:30
searchSuggestions: true,
watchHistory: false,
2022-09-11 23:31:58 +05:30
searchHistory: false,
2022-09-10 22:38:50 +05:30
hideWatched: false,
selectedLanguage: "en",
languages: [
2022-06-16 20:25:08 +05:30
{ code: "ar", name: "Arabic" },
{ code: "az", name: "Azərbaycan" },
2023-03-12 08:36:15 +05:30
{ code: "bg", name: "Български" },
2021-09-06 12:38:15 +05:30
{ code: "bn", name: "বাংলা" },
2022-04-09 05:38:54 +05:30
{ code: "bs", name: "Bosanski" },
2022-02-15 16:27:37 +05:30
{ code: "ca", name: "Català" },
{ code: "cs", name: "Čeština" },
2022-03-21 00:06:05 +05:30
{ code: "da", name: "Dansk" },
2021-09-06 12:38:15 +05:30
{ code: "de", name: "Deutsch" },
{ code: "el", name: "Ελληνικά" },
{ code: "es", name: "Español" },
{ code: "en", name: "English" },
2022-02-15 16:27:37 +05:30
{ code: "eo", name: "Esperanto" },
{ code: "et", name: "Eesti" },
{ code: "fa", name: "فارسی" },
Translations update from Weblate (#475) * Added translation using Weblate (Chinese (Simplified)) * Translated using Weblate (Chinese (Simplified)) Currently translated at 100.0% (64 of 64 strings) Translation: Piped/Frontend Translate-URL: https://hosted.weblate.org/projects/piped/frontend/zh_Hans/ * Added translation using Weblate (Basque) * Translated using Weblate (Basque) Currently translated at 100.0% (64 of 64 strings) Translation: Piped/Frontend Translate-URL: https://hosted.weblate.org/projects/piped/frontend/eu/ * Added translation using Weblate (Finnish) * Translated using Weblate (French) Currently translated at 100.0% (70 of 70 strings) Translation: Piped/Frontend Translate-URL: https://hosted.weblate.org/projects/piped/frontend/fr/ * Translated using Weblate (German) Currently translated at 100.0% (70 of 70 strings) Translation: Piped/Frontend Translate-URL: https://hosted.weblate.org/projects/piped/frontend/de/ * Translated using Weblate (Italian) Currently translated at 100.0% (70 of 70 strings) Translation: Piped/Frontend Translate-URL: https://hosted.weblate.org/projects/piped/frontend/it/ * Translated using Weblate (Spanish) Currently translated at 100.0% (70 of 70 strings) Translation: Piped/Frontend Translate-URL: https://hosted.weblate.org/projects/piped/frontend/es/ * Translated using Weblate (Finnish) Currently translated at 74.2% (52 of 70 strings) Translation: Piped/Frontend Translate-URL: https://hosted.weblate.org/projects/piped/frontend/fi/ * Translated using Weblate (Lithuanian) Currently translated at 100.0% (70 of 70 strings) Translation: Piped/Frontend Translate-URL: https://hosted.weblate.org/projects/piped/frontend/lt/ * Translated using Weblate (Chinese (Simplified)) Currently translated at 100.0% (70 of 70 strings) Translation: Piped/Frontend Translate-URL: https://hosted.weblate.org/projects/piped/frontend/zh_Hans/ * Translated using Weblate (Turkish) Currently translated at 100.0% (70 of 70 strings) Translation: Piped/Frontend Translate-URL: https://hosted.weblate.org/projects/piped/frontend/tr/ * Translated using Weblate (Croatian) Currently translated at 100.0% (70 of 70 strings) Translation: Piped/Frontend Translate-URL: https://hosted.weblate.org/projects/piped/frontend/hr/ * Translated using Weblate (Basque) Currently translated at 100.0% (70 of 70 strings) Translation: Piped/Frontend Translate-URL: https://hosted.weblate.org/projects/piped/frontend/eu/ * Add support for Finnish and Chinese Simplified. Co-authored-by: Xie Yanbo <xieyanbo@gmail.com> Co-authored-by: Sergio Varela <sergitroll9@gmail.com> Co-authored-by: J. Lavoie <j.lavoie@net-c.ca> Co-authored-by: Gediminas Murauskas <muziejusinfo@gmail.com> Co-authored-by: Oğuz Ersen <oguzersen@protonmail.com> Co-authored-by: Milo Ivir <mail@milotype.de> Co-authored-by: FireMasterK <20838718+FireMasterK@users.noreply.github.com>
2021-09-24 04:07:40 +05:30
{ code: "fi", name: "Suomi" },
{ code: "fr", name: "Français" },
2022-09-11 13:07:14 +05:30
{ code: "he", name: "עברית" },
Translations update from Hosted Weblate (#735) * Added translation using Weblate (Hindi) * Added translation using Weblate (Tamil) * Translated using Weblate (Hindi) Currently translated at 25.6% (20 of 78 strings) Translation: Piped/Frontend Translate-URL: https://hosted.weblate.org/projects/piped/frontend/hi/ * Translated using Weblate (Tamil) Currently translated at 10.2% (8 of 78 strings) Translation: Piped/Frontend Translate-URL: https://hosted.weblate.org/projects/piped/frontend/ta/ * Translated using Weblate (Hindi) Currently translated at 77.2% (61 of 79 strings) Translation: Piped/Frontend Translate-URL: https://hosted.weblate.org/projects/piped/frontend/hi/ * Translated using Weblate (Tamil) Currently translated at 45.5% (36 of 79 strings) Translation: Piped/Frontend Translate-URL: https://hosted.weblate.org/projects/piped/frontend/ta/ * Translated using Weblate (Norwegian Bokmål) Currently translated at 92.5% (75 of 81 strings) Translation: Piped/Frontend Translate-URL: https://hosted.weblate.org/projects/piped/frontend/nb_NO/ * Translated using Weblate (Turkish) Currently translated at 100.0% (81 of 81 strings) Translation: Piped/Frontend Translate-URL: https://hosted.weblate.org/projects/piped/frontend/tr/ * Translated using Weblate (Spanish) Currently translated at 100.0% (81 of 81 strings) Translation: Piped/Frontend Translate-URL: https://hosted.weblate.org/projects/piped/frontend/es/ * Translated using Weblate (Hindi) Currently translated at 76.5% (62 of 81 strings) Translation: Piped/Frontend Translate-URL: https://hosted.weblate.org/projects/piped/frontend/hi/ * Translated using Weblate (Tamil) Currently translated at 43.2% (35 of 81 strings) Translation: Piped/Frontend Translate-URL: https://hosted.weblate.org/projects/piped/frontend/ta/ * Translated using Weblate (Turkish) Currently translated at 100.0% (81 of 81 strings) Translation: Piped/Frontend Translate-URL: https://hosted.weblate.org/projects/piped/frontend/tr/ * Translated using Weblate (Spanish) Currently translated at 100.0% (81 of 81 strings) Translation: Piped/Frontend Translate-URL: https://hosted.weblate.org/projects/piped/frontend/es/ * Translated using Weblate (Swedish) Currently translated at 100.0% (81 of 81 strings) Translation: Piped/Frontend Translate-URL: https://hosted.weblate.org/projects/piped/frontend/sv/ Co-authored-by: Kavin <kavin@kavin.rocks> Co-authored-by: Allan Nordhøy <epost@anotheragency.no> Co-authored-by: Oğuz Ersen <oguzersen@protonmail.com> Co-authored-by: Jorge Maldonado Ventura <jorgesumle@freakspot.net> Co-authored-by: Shjosan <shjosan@kakmix.co>
2022-01-16 14:12:01 +05:30
{ code: "hi", name: "हिंदी" },
{ code: "id", name: "Indonesia" },
{ code: "is", name: "Íslenska" },
2022-11-25 21:24:33 +05:30
{ code: "kab", name: "Taqbaylit" },
2021-09-16 23:59:48 +05:30
{ code: "hr", name: "Hrvatski" },
{ code: "it", name: "Italiano" },
{ code: "ja", name: "日本語" },
{ code: "ko", name: "한국어" },
{ code: "lt", name: "Lietuvių kalba" },
2021-09-06 12:38:15 +05:30
{ code: "ml", name: "മലയാളം" },
Translations update from Weblate (#384) * Added translation using Weblate (German) * Added translation using Weblate (Norwegian Bokmål) * Added translation using Weblate (Chinese (Traditional)) * Translated using Weblate (Norwegian Bokmål) Currently translated at 82.5% (33 of 40 strings) Translation: Piped/Frontend Translate-URL: https://hosted.weblate.org/projects/piped/frontend/nb_NO/ * Added translation using Weblate (Malayalam) * Translated using Weblate (French) Currently translated at 100.0% (40 of 40 strings) Translation: Piped/Frontend Translate-URL: https://hosted.weblate.org/projects/piped/frontend/fr/ * Translated using Weblate (French) Currently translated at 100.0% (40 of 40 strings) Translation: Piped/Frontend Translate-URL: https://hosted.weblate.org/projects/piped/frontend/fr/ * Translated using Weblate (German) Currently translated at 100.0% (40 of 40 strings) Translation: Piped/Frontend Translate-URL: https://hosted.weblate.org/projects/piped/frontend/de/ * Translated using Weblate (Chinese (Traditional)) Currently translated at 42.5% (17 of 40 strings) Translation: Piped/Frontend Translate-URL: https://hosted.weblate.org/projects/piped/frontend/zh_Hant/ * Translated using Weblate (Malayalam) Currently translated at 90.0% (36 of 40 strings) Translation: Piped/Frontend Translate-URL: https://hosted.weblate.org/projects/piped/frontend/ml/ * Add support for 4 new languages. Co-authored-by: J. Lavoie <j.lavoie@net-c.ca> Co-authored-by: Allan Nordhøy <epost@anotheragency.no> Co-authored-by: Jamugha <hackdown@necord.com> Co-authored-by: vachan-maker <vachan2014carmel@gmail.com> Co-authored-by: FireMasterK <20838718+FireMasterK@users.noreply.github.com>
2021-08-26 17:18:23 +05:30
{ code: "nb_NO", name: "Norwegian Bokmål" },
2022-04-09 05:38:54 +05:30
{ code: "nl", name: "Nederlands" },
2023-01-15 23:07:53 +05:30
{ code: "oc", name: "Occitan" },
2022-11-07 07:03:58 +05:30
{ code: "or", name: "ଓଡ଼ିଆ" },
{ code: "pl", name: "Polski" },
{ code: "pt", name: "Português" },
2022-03-14 20:31:01 +05:30
{ code: "pt_PT", name: "Português (Portugal)" },
2022-06-16 20:25:08 +05:30
{ code: "pt_BR", name: "Português (Brasil)" },
2022-11-11 21:22:25 +05:30
{ code: "ro", name: "Română" },
{ code: "ru", name: "Русский" },
2023-01-15 23:07:53 +05:30
{ code: "si", name: "සිංහල" },
2021-11-25 01:01:39 +05:30
{ code: "sr", name: "Српски" },
{ code: "sv", name: "Svenska" },
Translations update from Hosted Weblate (#735) * Added translation using Weblate (Hindi) * Added translation using Weblate (Tamil) * Translated using Weblate (Hindi) Currently translated at 25.6% (20 of 78 strings) Translation: Piped/Frontend Translate-URL: https://hosted.weblate.org/projects/piped/frontend/hi/ * Translated using Weblate (Tamil) Currently translated at 10.2% (8 of 78 strings) Translation: Piped/Frontend Translate-URL: https://hosted.weblate.org/projects/piped/frontend/ta/ * Translated using Weblate (Hindi) Currently translated at 77.2% (61 of 79 strings) Translation: Piped/Frontend Translate-URL: https://hosted.weblate.org/projects/piped/frontend/hi/ * Translated using Weblate (Tamil) Currently translated at 45.5% (36 of 79 strings) Translation: Piped/Frontend Translate-URL: https://hosted.weblate.org/projects/piped/frontend/ta/ * Translated using Weblate (Norwegian Bokmål) Currently translated at 92.5% (75 of 81 strings) Translation: Piped/Frontend Translate-URL: https://hosted.weblate.org/projects/piped/frontend/nb_NO/ * Translated using Weblate (Turkish) Currently translated at 100.0% (81 of 81 strings) Translation: Piped/Frontend Translate-URL: https://hosted.weblate.org/projects/piped/frontend/tr/ * Translated using Weblate (Spanish) Currently translated at 100.0% (81 of 81 strings) Translation: Piped/Frontend Translate-URL: https://hosted.weblate.org/projects/piped/frontend/es/ * Translated using Weblate (Hindi) Currently translated at 76.5% (62 of 81 strings) Translation: Piped/Frontend Translate-URL: https://hosted.weblate.org/projects/piped/frontend/hi/ * Translated using Weblate (Tamil) Currently translated at 43.2% (35 of 81 strings) Translation: Piped/Frontend Translate-URL: https://hosted.weblate.org/projects/piped/frontend/ta/ * Translated using Weblate (Turkish) Currently translated at 100.0% (81 of 81 strings) Translation: Piped/Frontend Translate-URL: https://hosted.weblate.org/projects/piped/frontend/tr/ * Translated using Weblate (Spanish) Currently translated at 100.0% (81 of 81 strings) Translation: Piped/Frontend Translate-URL: https://hosted.weblate.org/projects/piped/frontend/es/ * Translated using Weblate (Swedish) Currently translated at 100.0% (81 of 81 strings) Translation: Piped/Frontend Translate-URL: https://hosted.weblate.org/projects/piped/frontend/sv/ Co-authored-by: Kavin <kavin@kavin.rocks> Co-authored-by: Allan Nordhøy <epost@anotheragency.no> Co-authored-by: Oğuz Ersen <oguzersen@protonmail.com> Co-authored-by: Jorge Maldonado Ventura <jorgesumle@freakspot.net> Co-authored-by: Shjosan <shjosan@kakmix.co>
2022-01-16 14:12:01 +05:30
{ code: "ta", name: "தமிழ்" },
{ code: "th", name: "ไทย" },
2021-09-06 12:38:15 +05:30
{ code: "tr", name: "Türkçe" },
{ code: "uk", name: "Українська" },
2022-04-07 08:04:48 +05:30
{ code: "vi", name: "Tiếng Việt" },
2021-09-16 23:59:48 +05:30
{ code: "zh_Hant", name: "繁體中文" },
Translations update from Weblate (#475) * Added translation using Weblate (Chinese (Simplified)) * Translated using Weblate (Chinese (Simplified)) Currently translated at 100.0% (64 of 64 strings) Translation: Piped/Frontend Translate-URL: https://hosted.weblate.org/projects/piped/frontend/zh_Hans/ * Added translation using Weblate (Basque) * Translated using Weblate (Basque) Currently translated at 100.0% (64 of 64 strings) Translation: Piped/Frontend Translate-URL: https://hosted.weblate.org/projects/piped/frontend/eu/ * Added translation using Weblate (Finnish) * Translated using Weblate (French) Currently translated at 100.0% (70 of 70 strings) Translation: Piped/Frontend Translate-URL: https://hosted.weblate.org/projects/piped/frontend/fr/ * Translated using Weblate (German) Currently translated at 100.0% (70 of 70 strings) Translation: Piped/Frontend Translate-URL: https://hosted.weblate.org/projects/piped/frontend/de/ * Translated using Weblate (Italian) Currently translated at 100.0% (70 of 70 strings) Translation: Piped/Frontend Translate-URL: https://hosted.weblate.org/projects/piped/frontend/it/ * Translated using Weblate (Spanish) Currently translated at 100.0% (70 of 70 strings) Translation: Piped/Frontend Translate-URL: https://hosted.weblate.org/projects/piped/frontend/es/ * Translated using Weblate (Finnish) Currently translated at 74.2% (52 of 70 strings) Translation: Piped/Frontend Translate-URL: https://hosted.weblate.org/projects/piped/frontend/fi/ * Translated using Weblate (Lithuanian) Currently translated at 100.0% (70 of 70 strings) Translation: Piped/Frontend Translate-URL: https://hosted.weblate.org/projects/piped/frontend/lt/ * Translated using Weblate (Chinese (Simplified)) Currently translated at 100.0% (70 of 70 strings) Translation: Piped/Frontend Translate-URL: https://hosted.weblate.org/projects/piped/frontend/zh_Hans/ * Translated using Weblate (Turkish) Currently translated at 100.0% (70 of 70 strings) Translation: Piped/Frontend Translate-URL: https://hosted.weblate.org/projects/piped/frontend/tr/ * Translated using Weblate (Croatian) Currently translated at 100.0% (70 of 70 strings) Translation: Piped/Frontend Translate-URL: https://hosted.weblate.org/projects/piped/frontend/hr/ * Translated using Weblate (Basque) Currently translated at 100.0% (70 of 70 strings) Translation: Piped/Frontend Translate-URL: https://hosted.weblate.org/projects/piped/frontend/eu/ * Add support for Finnish and Chinese Simplified. Co-authored-by: Xie Yanbo <xieyanbo@gmail.com> Co-authored-by: Sergio Varela <sergitroll9@gmail.com> Co-authored-by: J. Lavoie <j.lavoie@net-c.ca> Co-authored-by: Gediminas Murauskas <muziejusinfo@gmail.com> Co-authored-by: Oğuz Ersen <oguzersen@protonmail.com> Co-authored-by: Milo Ivir <mail@milotype.de> Co-authored-by: FireMasterK <20838718+FireMasterK@users.noreply.github.com>
2021-09-24 04:07:40 +05:30
{ code: "zh_Hans", name: "简体中文" },
],
2022-06-06 10:25:01 +05:30
enabledCodecs: ["vp9", "avc"],
disableLBRY: false,
proxyLBRY: false,
2022-07-20 19:45:27 +05:30
password: null,
showConfirmResetPrefsDialog: false,
2020-11-17 10:45:35 +05:30
};
},
activated() {
document.title = this.$t("titles.preferences") + " - Piped";
},
async mounted() {
if (Object.keys(this.$route.query).length > 0) this.$router.replace({ query: {} });
this.fetchJson("https://piped-instances.kavin.rocks/").then(resp => {
this.instances = resp;
2023-03-04 13:33:45 +05:30
if (!this.instances.some(instance => instance.api_url == this.apiUrl()))
this.instances.push({
name: "Custom Instance",
api_url: this.apiUrl(),
locations: "Unknown",
cdn: false,
2020-11-17 10:45:35 +05:30
});
});
2020-11-17 10:45:35 +05:30
if (this.testLocalStorage) {
this.selectedInstance = this.getPreferenceString("instance", "https://pipedapi.kavin.rocks");
this.authInstance = this.getPreferenceBoolean("authInstance", false);
this.selectedAuthInstance = this.getPreferenceString("auth_instance_url", this.selectedInstance);
2021-02-25 20:10:40 +05:30
this.sponsorBlock = this.getPreferenceBoolean("sponsorblock", true);
var skipOptions, skipList;
2023-02-06 22:48:04 +05:30
if ((skipOptions = this.getPreferenceJSON("skipOptions")) !== undefined) {
2023-02-06 22:54:12 +05:30
Object.entries(skipOptions).forEach(([key, value]) => {
var opt = this.skipOptions.get(key);
if (opt !== undefined) opt.value = value;
else console.log("Unknown sponsor type: " + key);
});
2023-02-06 22:48:04 +05:30
} else if ((skipList = this.getPreferenceString("selectedSkip")) !== undefined) {
skipList = skipList.split(",");
2023-02-06 22:54:12 +05:30
this.skipOptions.forEach(opt => (opt.value = "no"));
2021-02-25 20:48:59 +05:30
skipList.forEach(skip => {
2023-02-06 22:54:12 +05:30
var opt = this.skipOptions.get(skip);
if (opt !== undefined) opt.value = "auto";
else console.log("Unknown sponsor type: " + skip);
2021-02-25 20:48:59 +05:30
});
}
this.showMarkers = this.getPreferenceBoolean("showMarkers", true);
this.minSegmentLength = Math.max(this.getPreferenceNumber("minSegmentLength", 0), 0);
2023-07-19 06:10:12 +05:30
this.dearrow = this.getPreferenceBoolean("dearrow", false);
this.selectedTheme = this.getPreferenceString("theme", "dark");
this.autoPlayVideo = this.getPreferenceBoolean("playerAutoPlay", true);
2023-05-19 21:08:11 +05:30
this.autoDisplayCaptions = this.getPreferenceBoolean("autoDisplayCaptions", false);
2023-03-03 03:26:06 +05:30
this.autoPlayNextCountdown = this.getPreferenceNumber("autoPlayNextCountdown", 5);
this.listen = this.getPreferenceBoolean("listen", false);
2021-06-22 01:33:11 +05:30
this.defaultQuality = Number(localStorage.getItem("quality"));
2021-06-22 16:24:20 +05:30
this.bufferingGoal = Math.max(Number(localStorage.getItem("bufferGoal")), 10);
this.countrySelected = this.getPreferenceString("region", "US");
this.defaultHomepage = this.getPreferenceString("homepage", "trending");
2022-10-24 15:19:29 +05:30
this.minimizeComments = this.getPreferenceBoolean("minimizeComments", false);
this.minimizeDescription = this.getPreferenceBoolean("minimizeDescription", false);
this.minimizeRecommendations = this.getPreferenceBoolean("minimizeRecommendations", false);
this.minimizeChapters = this.getPreferenceBoolean("minimizeChapters", false);
2022-11-02 21:40:27 +05:30
this.showWatchOnYouTube = this.getPreferenceBoolean("showWatchOnYouTube", false);
2023-06-13 13:54:29 +05:30
this.searchSuggestions = this.getPreferenceBoolean("searchSuggestions", true);
this.watchHistory = this.getPreferenceBoolean("watchHistory", false);
2022-09-11 23:31:58 +05:30
this.searchHistory = this.getPreferenceBoolean("searchHistory", false);
this.selectedLanguage = this.getPreferenceString("hl", await this.defaultLanguage);
2022-06-06 10:25:01 +05:30
this.enabledCodecs = this.getPreferenceString("enabledCodecs", "vp9,avc").split(",");
this.disableLBRY = this.getPreferenceBoolean("disableLBRY", false);
this.proxyLBRY = this.getPreferenceBoolean("proxyLBRY", false);
2022-09-10 22:38:50 +05:30
this.hideWatched = this.getPreferenceBoolean("hideWatched", false);
this.mobileChapterLayout = this.getPreferenceString("mobileChapterLayout", "Vertical");
if (this.selectedLanguage != "en") {
try {
2021-12-28 20:09:20 +05:30
this.CountryMap = await import(`../utils/CountryMaps/${this.selectedLanguage}.json`).then(
val => val.default,
Translations update from Weblate (#475) * Added translation using Weblate (Chinese (Simplified)) * Translated using Weblate (Chinese (Simplified)) Currently translated at 100.0% (64 of 64 strings) Translation: Piped/Frontend Translate-URL: https://hosted.weblate.org/projects/piped/frontend/zh_Hans/ * Added translation using Weblate (Basque) * Translated using Weblate (Basque) Currently translated at 100.0% (64 of 64 strings) Translation: Piped/Frontend Translate-URL: https://hosted.weblate.org/projects/piped/frontend/eu/ * Added translation using Weblate (Finnish) * Translated using Weblate (French) Currently translated at 100.0% (70 of 70 strings) Translation: Piped/Frontend Translate-URL: https://hosted.weblate.org/projects/piped/frontend/fr/ * Translated using Weblate (German) Currently translated at 100.0% (70 of 70 strings) Translation: Piped/Frontend Translate-URL: https://hosted.weblate.org/projects/piped/frontend/de/ * Translated using Weblate (Italian) Currently translated at 100.0% (70 of 70 strings) Translation: Piped/Frontend Translate-URL: https://hosted.weblate.org/projects/piped/frontend/it/ * Translated using Weblate (Spanish) Currently translated at 100.0% (70 of 70 strings) Translation: Piped/Frontend Translate-URL: https://hosted.weblate.org/projects/piped/frontend/es/ * Translated using Weblate (Finnish) Currently translated at 74.2% (52 of 70 strings) Translation: Piped/Frontend Translate-URL: https://hosted.weblate.org/projects/piped/frontend/fi/ * Translated using Weblate (Lithuanian) Currently translated at 100.0% (70 of 70 strings) Translation: Piped/Frontend Translate-URL: https://hosted.weblate.org/projects/piped/frontend/lt/ * Translated using Weblate (Chinese (Simplified)) Currently translated at 100.0% (70 of 70 strings) Translation: Piped/Frontend Translate-URL: https://hosted.weblate.org/projects/piped/frontend/zh_Hans/ * Translated using Weblate (Turkish) Currently translated at 100.0% (70 of 70 strings) Translation: Piped/Frontend Translate-URL: https://hosted.weblate.org/projects/piped/frontend/tr/ * Translated using Weblate (Croatian) Currently translated at 100.0% (70 of 70 strings) Translation: Piped/Frontend Translate-URL: https://hosted.weblate.org/projects/piped/frontend/hr/ * Translated using Weblate (Basque) Currently translated at 100.0% (70 of 70 strings) Translation: Piped/Frontend Translate-URL: https://hosted.weblate.org/projects/piped/frontend/eu/ * Add support for Finnish and Chinese Simplified. Co-authored-by: Xie Yanbo <xieyanbo@gmail.com> Co-authored-by: Sergio Varela <sergitroll9@gmail.com> Co-authored-by: J. Lavoie <j.lavoie@net-c.ca> Co-authored-by: Gediminas Murauskas <muziejusinfo@gmail.com> Co-authored-by: Oğuz Ersen <oguzersen@protonmail.com> Co-authored-by: Milo Ivir <mail@milotype.de> Co-authored-by: FireMasterK <20838718+FireMasterK@users.noreply.github.com>
2021-09-24 04:07:40 +05:30
);
} catch (e) {
console.error("Countries not translated into " + this.selectedLanguage);
}
}
2021-02-25 20:10:40 +05:30
}
2020-11-17 10:45:35 +05:30
},
methods: {
async onChange() {
if (this.testLocalStorage) {
var shouldReload = false;
if (
this.getPreferenceString("theme", "dark") !== this.selectedTheme ||
this.getPreferenceBoolean("watchHistory", false) != this.watchHistory ||
this.getPreferenceString("hl", await this.defaultLanguage) !== this.selectedLanguage ||
2022-11-06 06:14:27 +05:30
this.getPreferenceString("enabledCodecs", "vp9,avc") !== this.enabledCodecs.join(",")
)
shouldReload = true;
2020-11-17 10:45:35 +05:30
localStorage.setItem("instance", this.selectedInstance);
localStorage.setItem("authInstance", this.authInstance);
localStorage.setItem("auth_instance_url", this.selectedAuthInstance);
2021-02-25 20:10:40 +05:30
localStorage.setItem("sponsorblock", this.sponsorBlock);
2021-02-25 20:48:59 +05:30
2023-02-06 22:54:12 +05:30
var skipOptions = {};
this.skipOptions.forEach((v, k) => (skipOptions[k] = v.value));
localStorage.setItem("skipOptions", JSON.stringify(skipOptions));
localStorage.setItem("showMarkers", this.showMarkers);
localStorage.setItem("minSegmentLength", this.minSegmentLength);
2023-07-19 06:10:12 +05:30
localStorage.setItem("dearrow", this.dearrow);
localStorage.setItem("theme", this.selectedTheme);
localStorage.setItem("playerAutoPlay", this.autoPlayVideo);
2023-05-19 21:08:11 +05:30
localStorage.setItem("autoDisplayCaptions", this.autoDisplayCaptions);
2023-03-03 03:26:06 +05:30
localStorage.setItem("autoPlayNextCountdown", this.autoPlayNextCountdown);
localStorage.setItem("listen", this.listen);
2021-06-22 01:33:11 +05:30
localStorage.setItem("quality", this.defaultQuality);
2021-06-22 16:24:20 +05:30
localStorage.setItem("bufferGoal", this.bufferingGoal);
localStorage.setItem("region", this.countrySelected);
localStorage.setItem("homepage", this.defaultHomepage);
localStorage.setItem("minimizeComments", this.minimizeComments);
localStorage.setItem("minimizeDescription", this.minimizeDescription);
localStorage.setItem("minimizeRecommendations", this.minimizeRecommendations);
localStorage.setItem("minimizeChapters", this.minimizeChapters);
2022-11-02 21:40:27 +05:30
localStorage.setItem("showWatchOnYouTube", this.showWatchOnYouTube);
2023-06-13 13:54:29 +05:30
localStorage.setItem("searchSuggestions", this.searchSuggestions);
localStorage.setItem("watchHistory", this.watchHistory);
2022-09-11 23:31:58 +05:30
localStorage.setItem("searchHistory", this.searchHistory);
if (!this.searchHistory) localStorage.removeItem("search_history");
localStorage.setItem("hl", this.selectedLanguage);
localStorage.setItem("enabledCodecs", this.enabledCodecs.join(","));
localStorage.setItem("disableLBRY", this.disableLBRY);
localStorage.setItem("proxyLBRY", this.proxyLBRY);
2022-09-10 22:38:50 +05:30
localStorage.setItem("hideWatched", this.hideWatched);
localStorage.setItem("mobileChapterLayout", this.mobileChapterLayout);
if (shouldReload) window.location.reload();
2021-02-25 20:10:40 +05:30
}
2020-11-30 12:09:40 +05:30
},
sslScore(url) {
return "https://www.ssllabs.com/ssltest/analyze.html?d=" + new URL(url).host + "&latest";
},
2022-07-20 19:45:27 +05:30
async deleteAccount() {
this.fetchJson(this.authApiUrl() + "/user/delete", null, {
2022-07-20 19:45:27 +05:30
method: "POST",
headers: {
Authorization: this.getAuthToken(),
},
body: JSON.stringify({
password: this.password,
}),
}).then(resp => {
if (!resp.error) {
this.logout();
} else alert(resp.error);
});
},
logout() {
// reset the auth token
localStorage.removeItem("authToken" + this.hashCode(this.authApiUrl()));
2022-07-20 19:45:27 +05:30
// redirect to trending page
window.location = "/";
},
2022-08-11 23:11:07 +05:30
resetPreferences() {
this.showConfirmResetPrefsDialog = false;
2022-08-11 23:11:07 +05:30
// clear the local storage
localStorage.clear();
// redirect to the home page
window.location = "/";
},
2022-07-20 21:51:11 +05:30
async invalidateSession() {
this.fetchJson(this.authApiUrl() + "/logout", null, {
2022-07-20 21:51:11 +05:30
method: "POST",
headers: {
Authorization: this.getAuthToken(),
},
}).then(resp => {
if (!resp.error) {
this.logout();
} else alert(resp.error);
});
},
2022-08-13 14:59:31 +05:30
backupPreferences() {
const data = JSON.stringify(localStorage);
this.download(data, "preferences.json", "application/json");
},
restorePreferences() {
var file = this.$refs.fileSelector.files[0];
file.text().then(text => {
const data = JSON.parse(text);
Object.keys(data).forEach(function (key) {
localStorage.setItem(key, data[key]);
});
window.location.reload();
});
},
},
2020-11-17 10:45:35 +05:30
};
</script>
2022-08-11 22:42:08 +05:30
<style>
.pref {
2022-08-17 19:04:57 +05:30
@apply flex justify-between items-center my-2 mx-[15vw] lt-md:mx-[2vw];
2022-08-11 22:42:08 +05:30
}
2023-03-01 21:25:30 +05:30
.pref:nth-child(odd) {
2023-03-11 23:30:13 +05:30
@apply bg-gray-200;
}
.dark .pref:nth-child(odd) {
2023-03-01 21:25:30 +05:30
@apply bg-dark-800;
}
2022-08-11 22:42:08 +05:30
</style>