mirror of
https://github.com/VueTubeApp/VueTube
synced 2024-11-01 01:12:39 +00:00
better description, ryd plugin
This commit is contained in:
parent
976aea5fb6
commit
2f3da283fb
3 changed files with 140 additions and 10 deletions
|
@ -16,7 +16,8 @@ export default {
|
||||||
target: 'static',
|
target: 'static',
|
||||||
plugins: [
|
plugins: [
|
||||||
{ src: "~/plugins/youtube", mode: "client" },
|
{ src: "~/plugins/youtube", mode: "client" },
|
||||||
{ src: "~/plugins/vuetube", mode: "client" }
|
{ src: "~/plugins/vuetube", mode: "client" },
|
||||||
|
{ src: "~/plugins/ryd", mode: "client"}
|
||||||
],
|
],
|
||||||
generate: {
|
generate: {
|
||||||
dir: '../dist'
|
dir: '../dist'
|
||||||
|
|
|
@ -4,13 +4,13 @@
|
||||||
<v-card class="ml-2 mr-2 flat light" flat>
|
<v-card class="ml-2 mr-2 flat light" flat>
|
||||||
<v-card-title style="padding-top: 0;">{{ title }}</v-card-title>
|
<v-card-title style="padding-top: 0;">{{ title }}</v-card-title>
|
||||||
<v-card-text>
|
<v-card-text>
|
||||||
<span>{{ views }} views • {{uploaded}}</span><br />
|
<span>{{ views }} views • {{uploaded}}</span><br /><br />
|
||||||
|
|
||||||
<!-- Scrolling Div For Interactions --->
|
<!-- Scrolling Div For Interactions --->
|
||||||
<div style="display: flex;">
|
<div style="display: flex;">
|
||||||
<v-list-item v-for="(item, index) in interactions" :key="index" style="padding: 0; flex: 0 0 20%;">
|
<v-list-item v-for="(item, index) in interactions" :key="index" style="padding: 0; flex: 0 0 20%;">
|
||||||
|
|
||||||
|
|
||||||
<v-btn text class="vertical-button" style="padding: 0; margin: 0;" elevation=0 :disabled="item.disabled">
|
<v-btn text class="vertical-button" style="padding: 0; margin: 0;" elevation=0 :disabled="item.disabled">
|
||||||
<v-icon v-text="item.icon" />
|
<v-icon v-text="item.icon" />
|
||||||
<div v-text="item.value || item.name" />
|
<div v-text="item.value || item.name" />
|
||||||
|
@ -18,15 +18,22 @@
|
||||||
|
|
||||||
</v-list-item>
|
</v-list-item>
|
||||||
|
|
||||||
|
|
||||||
<v-spacer />
|
<v-spacer />
|
||||||
<v-btn text @click="showMore = !showMore"><v-icon>mdi-chevron-up</v-icon></v-btn>
|
<v-btn text @click="showMore = !showMore">
|
||||||
|
<v-icon v-if="showMore">mdi-chevron-up</v-icon>
|
||||||
|
<v-icon v-else>mdi-chevron-down</v-icon>
|
||||||
|
</v-btn>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
<!-- End Scrolling Div For Interactions --->
|
<!-- End Scrolling Div For Interactions --->
|
||||||
|
|
||||||
</v-card-text>
|
</v-card-text>
|
||||||
|
<div class="scroll-y ml-2 mr-2" v-if="showMore">
|
||||||
|
{{ description }}
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<!--<v-bottom-sheet v-model="showMore" color="accent2" style="z-index: 9999999;">
|
||||||
<v-bottom-sheet v-model="showMore" color="accent2" style="z-index: 9999999;">
|
|
||||||
<v-sheet style="padding: 1em;">
|
<v-sheet style="padding: 1em;">
|
||||||
|
|
||||||
<v-btn block @click="showMore = !showMore"><v-icon>mdi-chevron-down</v-icon></v-btn><br>
|
<v-btn block @click="showMore = !showMore"><v-icon>mdi-chevron-down</v-icon></v-btn><br>
|
||||||
|
@ -35,6 +42,16 @@
|
||||||
{{ description }}
|
{{ description }}
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
</v-sheet>
|
||||||
|
</v-bottom-sheet>-->
|
||||||
|
<v-bottom-sheet v-model="share" color="accent2" style="z-index: 9999999;">
|
||||||
|
<v-sheet style="padding: 1em;">
|
||||||
|
|
||||||
|
|
||||||
|
<div class="scroll-y">
|
||||||
|
{{ description }}
|
||||||
|
</div>
|
||||||
|
|
||||||
</v-sheet>
|
</v-sheet>
|
||||||
</v-bottom-sheet>
|
</v-bottom-sheet>
|
||||||
</v-card>
|
</v-card>
|
||||||
|
@ -56,16 +73,23 @@
|
||||||
import recommended from '../components/recommended.vue';
|
import recommended from '../components/recommended.vue';
|
||||||
export default {
|
export default {
|
||||||
components: { recommended },
|
components: { recommended },
|
||||||
|
methods: {
|
||||||
|
dislike() {
|
||||||
|
},
|
||||||
|
share() {
|
||||||
|
this.share = !this.share;
|
||||||
|
}
|
||||||
|
},
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
|
|
||||||
interactions: [
|
interactions: [
|
||||||
{ name: "Likes", icon: "mdi-thumb-up", action: null, value: this.likes, disabled: true },
|
{ name: "Likes", icon: "mdi-thumb-up", action: null, value: this.likes, disabled: true },
|
||||||
{ name: "Dislikes", icon: "mdi-thumb-down", action: null, value: this.dislikes, disabled: true },
|
{ name: "Dislikes", icon: "mdi-thumb-down", action: this.dislike(), value: this.dislikes, disabled: true },
|
||||||
{ name: "Share", icon: "mdi-share", action: null, disabled: true },
|
{ name: "Share", icon: "mdi-share", action: this.share(), disabled: true },
|
||||||
],
|
],
|
||||||
showMore: false,
|
showMore: false,
|
||||||
|
share: false,
|
||||||
title: null,
|
title: null,
|
||||||
uploaded: null,
|
uploaded: null,
|
||||||
vidSrc: null,
|
vidSrc: null,
|
||||||
|
@ -91,7 +115,9 @@ export default {
|
||||||
this.interactions[0].value = data.likes.toString();
|
this.interactions[0].value = data.likes.toString();
|
||||||
});
|
});
|
||||||
|
|
||||||
this.$youtube.getReturnYoutubeDislike(this.$route.query.v, (data) => {
|
this.$ryd.getDislikes(this.$route.query.v, (data) => {
|
||||||
|
console.log('real data')
|
||||||
|
console.log(data)
|
||||||
this.interactions[1].value = data.dislikes.toString().replace(/\B(?=(\d{3})+(?!\d))/g, ",");
|
this.interactions[1].value = data.dislikes.toString().replace(/\B(?=(\d{3})+(?!\d))/g, ",");
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
103
NUXT/plugins/ryd.js
Normal file
103
NUXT/plugins/ryd.js
Normal file
|
@ -0,0 +1,103 @@
|
||||||
|
//--- Modules/Imports ---//
|
||||||
|
import { Http } from '@capacitor-community/http';
|
||||||
|
import constants from '../static/constants';
|
||||||
|
|
||||||
|
function generateUserID(length = 36) {
|
||||||
|
const charset =
|
||||||
|
"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789";
|
||||||
|
let result = "";
|
||||||
|
if (crypto && crypto.getRandomValues) {
|
||||||
|
const values = new Uint32Array(length);
|
||||||
|
crypto.getRandomValues(values);
|
||||||
|
for (let i = 0; i < length; i++) {
|
||||||
|
result += charset[values[i] % charset.length];
|
||||||
|
}
|
||||||
|
return result;
|
||||||
|
} else {
|
||||||
|
for (let i = 0; i < length; i++) {
|
||||||
|
result += charset[Math.floor(Math.random() * charset.length)];
|
||||||
|
}
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function countLeadingZeroes(uInt8View, limit) {
|
||||||
|
let zeroes = 0;
|
||||||
|
let value = 0;
|
||||||
|
for (let i = 0; i < uInt8View.length; i++) {
|
||||||
|
value = uInt8View[i];
|
||||||
|
if (value === 0) {
|
||||||
|
zeroes += 8;
|
||||||
|
} else {
|
||||||
|
let count = 1;
|
||||||
|
if (value >>> 4 === 0) {
|
||||||
|
count += 4;
|
||||||
|
value <<= 4;
|
||||||
|
}
|
||||||
|
if (value >>> 6 === 0) {
|
||||||
|
count += 2;
|
||||||
|
value <<= 2;
|
||||||
|
}
|
||||||
|
zeroes += count - (value >>> 7);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
if (zeroes >= limit) {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return zeroes;
|
||||||
|
}
|
||||||
|
|
||||||
|
//--- Puzzle Solver from Anarios --//
|
||||||
|
async function solvePuzzle(puzzle) {
|
||||||
|
let challenge = Uint8Array.from(atob(puzzle.challenge), (c) =>
|
||||||
|
c.charCodeAt(0)
|
||||||
|
);
|
||||||
|
let buffer = new ArrayBuffer(20);
|
||||||
|
let uInt8View = new Uint8Array(buffer);
|
||||||
|
let uInt32View = new Uint32Array(buffer);
|
||||||
|
let maxCount = Math.pow(2, puzzle.difficulty) * 5;
|
||||||
|
for (let i = 4; i < 20; i++) {
|
||||||
|
uInt8View[i] = challenge[i - 4];
|
||||||
|
}
|
||||||
|
|
||||||
|
for (let i = 0; i < maxCount; i++) {
|
||||||
|
uInt32View[0] = i;
|
||||||
|
let hash = await crypto.subtle.digest("SHA-512", buffer);
|
||||||
|
let hashUint8 = new Uint8Array(hash);
|
||||||
|
if (countLeadingZeroes(hashUint8) >= puzzle.difficulty) {
|
||||||
|
return {
|
||||||
|
solution: btoa(String.fromCharCode.apply(null, uInt8View.slice(0, 4))),
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
const rydModule = {
|
||||||
|
logs: new Array(),
|
||||||
|
|
||||||
|
//--- Get Dislikes ---//
|
||||||
|
getDislikes(id, callback) {
|
||||||
|
console.log("fetching ryd")
|
||||||
|
Http.request({
|
||||||
|
method: 'GET',
|
||||||
|
url: `https://returnyoutubedislikeapi.com/votes`,
|
||||||
|
params: { videoId: id }
|
||||||
|
})
|
||||||
|
.then((res) => {
|
||||||
|
callback(res.data)
|
||||||
|
})
|
||||||
|
.catch((err) => {
|
||||||
|
callback(err);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
//--- Start ---//
|
||||||
|
export default ({ app }, inject) => {
|
||||||
|
inject('ryd', {...rydModule})
|
||||||
|
}
|
||||||
|
|
Loading…
Reference in a new issue