2020-11-17 10:45:35 +05:30
|
|
|
<template>
|
2021-07-20 20:15:17 +05:30
|
|
|
<div class="uk-flex uk-flex-between uk-flex-middle">
|
|
|
|
<router-link class="uk-button uk-button-text" to="/"><font-awesome-icon icon="chevron-left" /> Back</router-link>
|
|
|
|
<span><h1 class="uk-text-bold uk-text-center">Preferences</h1></span>
|
|
|
|
<span />
|
|
|
|
</div>
|
2020-11-22 10:04:27 +05:30
|
|
|
<hr />
|
2021-02-25 20:10:40 +05:30
|
|
|
<h2>SponsorBlock</h2>
|
2021-04-07 17:15:40 +05:30
|
|
|
<p>Uses the API from <a href="https://sponsor.ajay.app/">sponsor.ajay.app</a></p>
|
2021-02-25 20:10:40 +05:30
|
|
|
<b>Enable Sponsorblock</b>
|
|
|
|
<br />
|
2021-04-07 17:15:40 +05:30
|
|
|
<input class="uk-checkbox" v-model="sponsorBlock" @change="onChange($event)" type="checkbox" />
|
2021-02-25 20:48:59 +05:30
|
|
|
<br />
|
|
|
|
<b>Skip Sponsors</b>
|
|
|
|
<br />
|
2021-04-07 17:15:40 +05:30
|
|
|
<input class="uk-checkbox" v-model="skipSponsor" @change="onChange($event)" type="checkbox" />
|
2021-02-25 20:48:59 +05:30
|
|
|
<br />
|
|
|
|
<b>Skip Intermission/Intro Animation</b>
|
|
|
|
<br />
|
2021-04-07 17:15:40 +05:30
|
|
|
<input class="uk-checkbox" v-model="skipIntro" @change="onChange($event)" type="checkbox" />
|
2021-02-25 20:48:59 +05:30
|
|
|
<br />
|
|
|
|
<b>Skip Endcards/Credits</b>
|
|
|
|
<br />
|
2021-04-07 17:15:40 +05:30
|
|
|
<input class="uk-checkbox" v-model="skipOutro" @change="onChange($event)" type="checkbox" />
|
2021-02-25 20:48:59 +05:30
|
|
|
<br />
|
2021-07-19 01:23:17 +05:30
|
|
|
<b>Skip Preview/Recap</b>
|
|
|
|
<br />
|
|
|
|
<input class="uk-checkbox" v-model="skipPreview" @change="onChange($event)" type="checkbox" />
|
|
|
|
<br />
|
2021-02-25 20:48:59 +05:30
|
|
|
<b>Skip Interaction Reminder (Subscribe)</b>
|
|
|
|
<br />
|
2021-04-07 17:15:40 +05:30
|
|
|
<input class="uk-checkbox" v-model="skipInteraction" @change="onChange($event)" type="checkbox" />
|
2021-02-25 20:48:59 +05:30
|
|
|
<br />
|
|
|
|
<b>Skip Unpaid/Self Promotion</b>
|
|
|
|
<br />
|
2021-04-07 17:15:40 +05:30
|
|
|
<input class="uk-checkbox" v-model="skipSelfPromo" @change="onChange($event)" type="checkbox" />
|
2021-02-25 20:48:59 +05:30
|
|
|
<br />
|
|
|
|
<b>Skip Music: Non-Music Section</b>
|
|
|
|
<br />
|
2021-04-07 17:15:40 +05:30
|
|
|
<input class="uk-checkbox" v-model="skipMusicOffTopic" @change="onChange($event)" type="checkbox" />
|
2021-05-06 23:00:02 +05:30
|
|
|
<br />
|
2021-06-29 01:15:03 +05:30
|
|
|
<b>Theme</b>
|
|
|
|
<br />
|
|
|
|
<select class="uk-select uk-width-auto" v-model="selectedTheme" @change="onChange($event)">
|
2021-07-06 00:03:00 +05:30
|
|
|
<option value="auto">Auto</option>
|
2021-06-29 01:15:03 +05:30
|
|
|
<option value="dark">Dark</option>
|
|
|
|
<option value="light">Light</option>
|
|
|
|
</select>
|
|
|
|
<br />
|
2021-05-06 23:00:02 +05:30
|
|
|
<b>Autoplay Video</b>
|
|
|
|
<br />
|
|
|
|
<input class="uk-checkbox" v-model="autoPlayVideo" @change="onChange($event)" type="checkbox" />
|
2021-06-08 02:05:45 +05:30
|
|
|
<br />
|
|
|
|
<b>Audio Only</b>
|
|
|
|
<br />
|
2021-07-04 00:54:09 +05:30
|
|
|
<input class="uk-checkbox" v-model="listen" @change="onChange($event)" type="checkbox" />
|
2021-06-22 01:33:11 +05:30
|
|
|
<br />
|
|
|
|
<b>Default Quality</b>
|
|
|
|
<br />
|
2021-06-22 16:27:12 +05:30
|
|
|
<select class="uk-select uk-width-auto" v-model="defaultQuality" @change="onChange($event)">
|
2021-06-22 01:43:21 +05:30
|
|
|
<option value="0">Auto</option>
|
2021-06-22 01:55:38 +05:30
|
|
|
<option :key="resolution" v-for="resolution in resolutions" :value="resolution">{{ resolution }}p</option>
|
2021-06-22 01:33:11 +05:30
|
|
|
</select>
|
2021-06-22 16:24:20 +05:30
|
|
|
<br />
|
|
|
|
<b>Buffering Goal</b>
|
|
|
|
<br />
|
2021-06-22 16:27:12 +05:30
|
|
|
<input class="uk-input uk-width-auto" v-model="bufferingGoal" @change="onChange($event)" type="text" />
|
2021-07-05 18:48:54 +05:30
|
|
|
<br />
|
|
|
|
<b>Country Selection</b>
|
|
|
|
<br />
|
|
|
|
<select class="uk-select uk-width-auto" v-model="country" @change="onChange($event)">
|
|
|
|
<option :key="country.code" v-for="country in countryMap" :value="country.code">{{ country.name }}</option>
|
|
|
|
</select>
|
2021-07-19 01:50:35 +05:30
|
|
|
<br />
|
|
|
|
<b>Default Homepage</b>
|
|
|
|
<br />
|
|
|
|
<select class="uk-select uk-width-auto" v-model="defaultHomepage" @change="onChange($event)">
|
|
|
|
<option value="trending">Trending</option>
|
|
|
|
<option value="feed">Feed</option>
|
|
|
|
</select>
|
2021-07-19 01:57:34 +05:30
|
|
|
<br />
|
|
|
|
<b>Show Comments</b>
|
|
|
|
<br />
|
|
|
|
<input class="uk-checkbox" v-model="showComments" @change="onChange($event)" type="checkbox" />
|
2020-11-22 10:04:27 +05:30
|
|
|
<h2>Instances List</h2>
|
2020-11-17 10:45:35 +05:30
|
|
|
<table class="uk-table">
|
|
|
|
<thead>
|
|
|
|
<tr>
|
|
|
|
<th>Instance Name</th>
|
|
|
|
<th>Instance Locations</th>
|
|
|
|
<th>Has CDN?</th>
|
2020-11-30 12:09:40 +05:30
|
|
|
<th>SSL Score</th>
|
2020-11-17 10:45:35 +05:30
|
|
|
</tr>
|
|
|
|
</thead>
|
|
|
|
<tbody v-bind:key="instance.name" v-for="instance in instances">
|
|
|
|
<tr>
|
|
|
|
<td>{{ instance.name }}</td>
|
|
|
|
<td>{{ instance.locations }}</td>
|
|
|
|
<td>{{ instance.cdn }}</td>
|
2020-11-30 12:09:40 +05:30
|
|
|
<td>
|
2021-04-07 17:15:40 +05:30
|
|
|
<a :href="sslScore(instance.apiurl)" target="_blank">Click Here</a>
|
2020-11-30 12:09:40 +05:30
|
|
|
</td>
|
2020-11-17 10:45:35 +05:30
|
|
|
</tr>
|
|
|
|
</tbody>
|
|
|
|
</table>
|
|
|
|
|
2020-11-22 10:04:27 +05:30
|
|
|
<hr />
|
|
|
|
|
|
|
|
<b>Instance Selection:</b>
|
2021-06-22 16:27:12 +05:30
|
|
|
<br />
|
|
|
|
<select class="uk-select uk-width-auto" v-model="selectedInstance" @change="onChange($event)">
|
2021-04-07 17:15:40 +05:30
|
|
|
<option v-bind:key="instance.name" v-for="instance in instances" v-bind:value="instance.apiurl">
|
2020-11-17 10:45:35 +05:30
|
|
|
{{ instance.name }}
|
|
|
|
</option>
|
|
|
|
</select>
|
|
|
|
</template>
|
|
|
|
|
|
|
|
<script>
|
2021-07-05 18:48:54 +05:30
|
|
|
import CountryMap from "@/utils/CountryMap.js";
|
2020-11-17 10:45:35 +05:30
|
|
|
export default {
|
|
|
|
data() {
|
|
|
|
return {
|
|
|
|
selectedInstance: null,
|
2021-02-25 20:10:40 +05:30
|
|
|
instances: [],
|
2021-02-25 20:48:59 +05:30
|
|
|
sponsorBlock: true,
|
|
|
|
skipSponsor: true,
|
|
|
|
skipIntro: false,
|
|
|
|
skipOutro: false,
|
2021-07-19 01:23:17 +05:30
|
|
|
skipPreview: false,
|
2021-02-25 20:48:59 +05:30
|
|
|
skipInteraction: true,
|
|
|
|
skipSelfPromo: true,
|
2021-04-07 17:15:40 +05:30
|
|
|
skipMusicOffTopic: true,
|
2021-06-29 01:15:03 +05:30
|
|
|
selectedTheme: "dark",
|
2021-05-06 23:00:02 +05:30
|
|
|
autoPlayVideo: true,
|
2021-07-04 00:54:09 +05:30
|
|
|
listen: false,
|
2021-06-22 01:55:38 +05:30
|
|
|
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,
|
2021-07-05 18:48:54 +05:30
|
|
|
countryMap: CountryMap.COUNTRIES,
|
|
|
|
country: "US",
|
2021-07-19 01:50:35 +05:30
|
|
|
defaultHomepage: "trending",
|
2021-07-19 01:57:34 +05:30
|
|
|
showComments: true,
|
2020-11-17 10:45:35 +05:30
|
|
|
};
|
|
|
|
},
|
|
|
|
mounted() {
|
2021-07-04 00:54:09 +05:30
|
|
|
if (Object.keys(this.$route.query).length > 0) this.$router.replace({ query: {} });
|
|
|
|
|
2021-04-07 17:15:40 +05:30
|
|
|
fetch("https://raw.githubusercontent.com/wiki/TeamPiped/Piped-Frontend/Instances.md")
|
2020-11-17 10:45:35 +05:30
|
|
|
.then(resp => resp.text())
|
|
|
|
.then(body => {
|
|
|
|
var skipped = 0;
|
|
|
|
const lines = body.split("\n");
|
|
|
|
lines.map(line => {
|
|
|
|
const split = line.split("|");
|
|
|
|
if (split.length == 4) {
|
|
|
|
if (skipped < 2) {
|
|
|
|
skipped++;
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
this.instances.push({
|
|
|
|
name: split[0].trim(),
|
|
|
|
apiurl: split[1].trim(),
|
|
|
|
locations: split[2].trim(),
|
2021-04-07 17:15:40 +05:30
|
|
|
cdn: split[3].trim(),
|
2020-11-17 10:45:35 +05:30
|
|
|
});
|
|
|
|
}
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
2021-02-25 20:10:40 +05:30
|
|
|
if (localStorage) {
|
2021-07-05 18:48:54 +05:30
|
|
|
this.selectedInstance = this.getPreferenceString("instance", "https://pipedapi.kavin.rocks");
|
2021-02-25 20:10:40 +05:30
|
|
|
|
2021-07-04 00:54:09 +05:30
|
|
|
this.sponsorBlock = this.getPreferenceBoolean("sponsorblock", true);
|
2021-04-21 19:08:50 +05:30
|
|
|
if (localStorage.getItem("selectedSkip") !== null) {
|
2021-02-25 20:48:59 +05:30
|
|
|
var skipList = localStorage.getItem("selectedSkip").split(",");
|
2021-07-19 01:23:17 +05:30
|
|
|
this.skipSponsor = this.skipIntro = this.skipOutro = this.skipPreview = this.skipInteraction = this.skipSelfPromo = this.skipMusicOffTopic = false;
|
2021-02-25 20:48:59 +05:30
|
|
|
skipList.forEach(skip => {
|
|
|
|
switch (skip) {
|
|
|
|
case "sponsor":
|
|
|
|
this.skipSponsor = true;
|
|
|
|
break;
|
|
|
|
case "intro":
|
|
|
|
this.skipIntro = true;
|
|
|
|
break;
|
|
|
|
case "outro":
|
|
|
|
this.skipOutro = true;
|
|
|
|
break;
|
2021-07-19 01:23:17 +05:30
|
|
|
case "preview":
|
|
|
|
this.skipPreview = true;
|
|
|
|
break;
|
2021-02-25 20:48:59 +05:30
|
|
|
case "interaction":
|
|
|
|
this.skipInteraction = true;
|
|
|
|
break;
|
|
|
|
case "selfpromo":
|
|
|
|
this.skipSelfPromo = true;
|
|
|
|
break;
|
|
|
|
case "music_offtopic":
|
|
|
|
this.skipMusicOffTopic = true;
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
console.log("Unknown sponsor type: " + skip);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
});
|
|
|
|
}
|
2021-05-06 23:00:02 +05:30
|
|
|
|
2021-07-04 00:54:09 +05:30
|
|
|
this.selectedTheme = this.getPreferenceString("theme", "dark");
|
|
|
|
this.autoPlayVideo = this.getPreferenceBoolean(localStorage.getItem("playerAutoPlay"), true);
|
|
|
|
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);
|
2021-07-05 18:48:54 +05:30
|
|
|
this.country = this.getPreferenceString("region", "US");
|
2021-07-19 01:50:35 +05:30
|
|
|
this.defaultHomepage = this.getPreferenceString("homepage", "trending");
|
2021-07-19 01:57:34 +05:30
|
|
|
this.showComments = this.getPreferenceBoolean("comments", true);
|
2021-02-25 20:10:40 +05:30
|
|
|
}
|
2020-11-17 10:45:35 +05:30
|
|
|
},
|
|
|
|
methods: {
|
|
|
|
onChange() {
|
2021-02-25 20:10:40 +05:30
|
|
|
if (localStorage) {
|
2021-06-29 01:15:03 +05:30
|
|
|
var shouldReload = false;
|
|
|
|
|
2021-07-04 00:54:09 +05:30
|
|
|
if (this.getPreferenceString("theme", "dark") !== this.selectedTheme) shouldReload = true;
|
2021-06-29 01:15:03 +05:30
|
|
|
|
2020-11-17 10:45:35 +05:30
|
|
|
localStorage.setItem("instance", this.selectedInstance);
|
2021-02-25 20:10:40 +05:30
|
|
|
localStorage.setItem("sponsorblock", this.sponsorBlock);
|
2021-02-25 20:48:59 +05:30
|
|
|
|
|
|
|
var sponsorSelected = [];
|
|
|
|
if (this.skipSponsor) sponsorSelected.push("sponsor");
|
|
|
|
if (this.skipIntro) sponsorSelected.push("intro");
|
|
|
|
if (this.skipOutro) sponsorSelected.push("outro");
|
2021-07-19 01:23:17 +05:30
|
|
|
if (this.skipPreview) sponsorSelected.push("preview");
|
2021-02-25 20:48:59 +05:30
|
|
|
if (this.skipInteraction) sponsorSelected.push("interaction");
|
|
|
|
if (this.skipSelfPromo) sponsorSelected.push("selfpromo");
|
2021-04-07 17:15:40 +05:30
|
|
|
if (this.skipMusicOffTopic) sponsorSelected.push("music_offtopic");
|
2021-02-25 20:48:59 +05:30
|
|
|
localStorage.setItem("selectedSkip", sponsorSelected);
|
2021-05-06 23:00:02 +05:30
|
|
|
|
2021-06-29 01:15:03 +05:30
|
|
|
localStorage.setItem("theme", this.selectedTheme);
|
2021-05-06 23:00:02 +05:30
|
|
|
localStorage.setItem("playerAutoPlay", this.autoPlayVideo);
|
2021-07-04 00:54:09 +05:30
|
|
|
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);
|
2021-07-05 18:48:54 +05:30
|
|
|
localStorage.setItem("region", this.country);
|
2021-07-19 01:50:35 +05:30
|
|
|
localStorage.setItem("homepage", this.defaultHomepage);
|
2021-07-19 01:57:34 +05:30
|
|
|
localStorage.setItem("comments", this.showComments);
|
2021-06-29 01:15:03 +05:30
|
|
|
|
|
|
|
if (shouldReload) window.location.reload();
|
2021-02-25 20:10:40 +05:30
|
|
|
}
|
2020-11-30 12:09:40 +05:30
|
|
|
},
|
|
|
|
sslScore(url) {
|
2021-04-07 17:15:40 +05:30
|
|
|
return "https://www.ssllabs.com/ssltest/analyze.html?d=" + new URL(url).host + "&latest";
|
|
|
|
},
|
|
|
|
},
|
2020-11-17 10:45:35 +05:30
|
|
|
};
|
|
|
|
</script>
|