From b457eb5c70f0e629944768077c08f693e6e5e838 Mon Sep 17 00:00:00 2001
From: Kavin <20838718+FireMasterK@users.noreply.github.com>
Date: Wed, 19 Jul 2023 01:40:12 +0100
Subject: [PATCH] Implement support for DeArrow.
---
src/components/FeedPage.vue | 19 ++++++++++++++++++-
src/components/PreferencesPage.vue | 15 +++++++++++++++
src/components/VideoItem.vue | 20 ++++++++++++++------
src/locales/en.json | 4 +++-
4 files changed, 50 insertions(+), 8 deletions(-)
diff --git a/src/components/FeedPage.vue b/src/components/FeedPage.vue
index fde456db..3bc5d690 100644
--- a/src/components/FeedPage.vue
+++ b/src/components/FeedPage.vue
@@ -137,8 +137,20 @@ export default {
},
loadMoreVideos() {
this.currentVideoCount = Math.min(this.currentVideoCount + this.videoStep, this.videosStore.length);
- if (this.videos.length != this.videosStore.length)
+ if (this.videos.length != this.videosStore.length) {
+ const videoIds = this.videosStore
+ .slice(this.videos.length, this.currentVideoCount)
+ .map(video => video.url.substr(-11))
+ .sort();
+ if (this.getPreferenceBoolean("dearrow", false))
+ this.fetchDeArrowContent(videoIds).then(json => {
+ Object.keys(json).forEach(key => {
+ const video = this.videosStore.find(video => video.url.substr(-11) == key);
+ video.dearrow = json[key];
+ });
+ });
this.videos = this.videosStore.slice(0, this.currentVideoCount);
+ }
},
handleScroll() {
if (window.innerHeight + window.scrollY >= document.body.offsetHeight - window.innerHeight) {
@@ -158,6 +170,11 @@ export default {
onFilterChange() {
this.setPreference("feedFilter", this.selectedFilter);
},
+ fetchDeArrowContent(videoIds) {
+ return this.fetchJson(this.apiUrl() + "/dearrow", {
+ videoIds: videoIds.join(","),
+ });
+ },
},
};
diff --git a/src/components/PreferencesPage.vue b/src/components/PreferencesPage.vue
index 06ee1192..ff2f6a14 100644
--- a/src/components/PreferencesPage.vue
+++ b/src/components/PreferencesPage.vue
@@ -252,6 +252,16 @@
/>
+
+
+
+ sponsor.ajay.app
+
+
+