2020-11-17 05:15:35 +00:00
|
|
|
<template>
|
2020-11-22 04:34:27 +00:00
|
|
|
<h1 class="uk-text-bold uk-text-center">Preferences</h1>
|
|
|
|
<hr />
|
2021-02-25 14:40:40 +00:00
|
|
|
<h2>SponsorBlock</h2>
|
|
|
|
<b>Enable Sponsorblock</b>
|
|
|
|
<br />
|
|
|
|
<input
|
|
|
|
class="uk-checkbox"
|
|
|
|
v-model="sponsorBlock"
|
|
|
|
@change="onChange($event)"
|
|
|
|
type="checkbox"
|
|
|
|
/>
|
2020-11-22 04:34:27 +00:00
|
|
|
<h2>Instances List</h2>
|
2020-11-17 05:15:35 +00:00
|
|
|
<table class="uk-table">
|
|
|
|
<thead>
|
|
|
|
<tr>
|
|
|
|
<th>Instance Name</th>
|
|
|
|
<th>Instance Locations</th>
|
|
|
|
<th>Has CDN?</th>
|
2020-11-30 06:39:40 +00:00
|
|
|
<th>SSL Score</th>
|
2020-11-17 05:15:35 +00:00
|
|
|
</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 06:39:40 +00:00
|
|
|
<td>
|
|
|
|
<a :href="sslScore(instance.apiurl)" target="_blank"
|
|
|
|
>Click Here</a
|
|
|
|
>
|
|
|
|
</td>
|
2020-11-17 05:15:35 +00:00
|
|
|
</tr>
|
|
|
|
</tbody>
|
|
|
|
</table>
|
|
|
|
|
2020-11-22 04:34:27 +00:00
|
|
|
<hr />
|
|
|
|
|
|
|
|
<b>Instance Selection:</b>
|
2020-11-17 05:15:35 +00:00
|
|
|
<select
|
|
|
|
class="uk-select"
|
|
|
|
v-model="selectedInstance"
|
|
|
|
@change="onChange($event)"
|
|
|
|
>
|
|
|
|
<option
|
|
|
|
v-bind:key="instance.name"
|
|
|
|
v-for="instance in instances"
|
|
|
|
v-bind:value="instance.apiurl"
|
|
|
|
>
|
|
|
|
{{ instance.name }}
|
|
|
|
</option>
|
|
|
|
</select>
|
|
|
|
</template>
|
|
|
|
|
|
|
|
<script>
|
|
|
|
export default {
|
|
|
|
data() {
|
|
|
|
return {
|
|
|
|
selectedInstance: null,
|
2021-02-25 14:40:40 +00:00
|
|
|
instances: [],
|
|
|
|
sponsorBlock: true
|
2020-11-17 05:15:35 +00:00
|
|
|
};
|
|
|
|
},
|
|
|
|
mounted() {
|
|
|
|
fetch(
|
|
|
|
"https://raw.githubusercontent.com/wiki/TeamPiped/Piped-Frontend/Instances.md"
|
|
|
|
)
|
|
|
|
.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(),
|
|
|
|
cdn: split[3].trim()
|
|
|
|
});
|
|
|
|
}
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
2021-02-25 14:40:40 +00:00
|
|
|
if (localStorage) {
|
2020-11-17 05:15:35 +00:00
|
|
|
this.selectedInstance =
|
|
|
|
localStorage.getItem("instance") ||
|
|
|
|
"https://pipedapi.kavin.rocks";
|
2021-02-25 14:40:40 +00:00
|
|
|
|
|
|
|
this.sponsorBlock = localStorage.getItem("sponsorblock") || true;
|
|
|
|
}
|
2020-11-17 05:15:35 +00:00
|
|
|
},
|
|
|
|
methods: {
|
|
|
|
onChange() {
|
2021-02-25 14:40:40 +00:00
|
|
|
if (localStorage) {
|
2020-11-17 05:15:35 +00:00
|
|
|
localStorage.setItem("instance", this.selectedInstance);
|
2021-02-25 14:40:40 +00:00
|
|
|
localStorage.setItem("sponsorblock", this.sponsorBlock);
|
|
|
|
}
|
2020-11-30 06:39:40 +00:00
|
|
|
},
|
|
|
|
sslScore(url) {
|
|
|
|
return (
|
|
|
|
"https://www.ssllabs.com/ssltest/analyze.html?d=" +
|
|
|
|
new URL(url).host +
|
|
|
|
"&latest"
|
|
|
|
);
|
2020-11-17 05:15:35 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
};
|
|
|
|
</script>
|