conflicts resolved

This commit is contained in:
Bnyro
2022-10-07 20:10:39 +02:00
32 changed files with 757 additions and 313 deletions

View File

@@ -16,7 +16,7 @@
<hr />
<div class="video-grid">
<VideoItem v-for="video in videos" :key="video.url" :video="video" />
<VideoItem :is-feed="true" v-for="video in videos" :key="video.url" :video="video" />
</div>
</template>

View File

@@ -0,0 +1,58 @@
<template>
<footer class="text-center py-4 rounded-xl children:(mx-3) w-full mt-10 mb-5">
<a aria-label="GitHub" href="https://github.com/TeamPiped/Piped" target="_blank">
<font-awesome-icon :icon="['fab', 'github']" />
<span class="ml-2" v-t="'actions.source_code'" />
</a>
<a href="https://piped-docs.kavin.rocks/" target="_blank">
<font-awesome-icon :icon="['fa', 'book']" />
<span class="ml-2" v-t="'actions.documentation'" />
</a>
<a href="https://github.com/TeamPiped/Piped#donations" target="_blank">
<font-awesome-icon :icon="['fab', 'bitcoin']" />
<span class="ml-2" v-t="'actions.donations'" />
</a>
<a v-if="statusPageHref" :href="statusPageHref">
<font-awesome-icon :icon="['fa', 'server']" />
<span class="ml-2" v-t="'actions.status_page'" />
</a>
<a v-if="donationHref" :href="donationHref">
<font-awesome-icon :icon="['fa', 'donate']" />
<span class="ml-2" v-t="'actions.instance_donations'" />
</a>
</footer>
</template>
<script>
export default {
data() {
return {
donationHref: null,
statusPageHref: null,
};
},
mounted() {
this.fetchConfig();
},
methods: {
async fetchConfig() {
this.fetchJson(this.apiUrl() + "/config").then(config => {
this.donationHref = config?.donationUrl;
this.statusPageHref = config?.statusPageUrl;
});
},
},
};
</script>
<style>
footer {
@apply bg-light-900;
}
.dark footer {
@apply bg-dark-800;
}
.auto footer {
@apply dark:(bg-dark-800);
}
</style>

View File

@@ -79,7 +79,7 @@
/>
</div>
<SearchSuggestions
v-show="searchText && suggestionsVisible"
v-show="(searchText || showSearchHistory) && suggestionsVisible"
ref="searchSuggestions"
:search-text="searchText"
@searchchange="onSearchTextChange"
@@ -119,6 +119,9 @@ export default {
shouldShowTrending(_this) {
return _this.getPreferenceString("homepage", "trending") != "trending";
},
showSearchHistory() {
return localStorage.getItem("searchHistory") && localStorage.getItem("search_history");
},
},
methods: {
// focus on search bar when Ctrl+k is pressed
@@ -145,6 +148,7 @@ export default {
}
},
onInputFocus() {
if (this.showSearchHistory) this.$refs.searchSuggestions.refreshSuggestions();
this.suggestionsVisible = true;
},
onInputBlur() {

View File

@@ -41,7 +41,6 @@
<option v-t="'titles.feed'" value="feed" />
</select>
</label>
<label class="pref" for="ddlInstanceSelection">
<strong v-text="`${$t('actions.instance_selection')}:`" />
<select
@@ -421,6 +420,8 @@ export default {
minimizeDescription: false,
minimizeRecommendations: false,
watchHistory: false,
searchHistory: false,
hideWatched: false,
selectedLanguage: "en",
languages: [
{ code: "ar", name: "Arabic" },
@@ -555,10 +556,12 @@ export default {
this.minimizeDescription = this.getPreferenceBoolean("minimizeDescription", false);
this.minimizeRecommendations = this.getPreferenceBoolean("minimizeRecommendations", false);
this.watchHistory = this.getPreferenceBoolean("watchHistory", false);
this.searchHistory = this.getPreferenceBoolean("searchHistory", false);
this.selectedLanguage = this.getPreferenceString("hl", await this.defaultLangage);
this.enabledCodecs = this.getPreferenceString("enabledCodecs", "vp9,avc").split(",");
this.disableLBRY = this.getPreferenceBoolean("disableLBRY", false);
this.proxyLBRY = this.getPreferenceBoolean("proxyLBRY", false);
this.hideWatched = this.getPreferenceBoolean("hideWatched", false);
if (this.selectedLanguage != "en") {
try {
this.CountryMap = await import(`../utils/CountryMaps/${this.selectedLanguage}.json`).then(
@@ -612,10 +615,13 @@ export default {
localStorage.setItem("minimizeDescription", this.minimizeDescription);
localStorage.setItem("minimizeRecommendations", this.minimizeRecommendations);
localStorage.setItem("watchHistory", this.watchHistory);
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);
localStorage.setItem("hideWatched", this.hideWatched);
if (shouldReload) window.location.reload();
}

View File

@@ -77,6 +77,7 @@ export default {
mounted() {
if (this.handleRedirect()) return;
this.updateResults();
this.saveQueryToHistory();
},
activated() {
this.handleRedirect();
@@ -138,6 +139,19 @@ export default {
return true;
}
},
saveQueryToHistory() {
if (!this.getPreferenceBoolean("searchHistory", false)) return;
const query = this.$route.query.search_query;
if (!query) return;
const searchHistory = JSON.parse(localStorage.getItem("search_history")) ?? [];
if (searchHistory.includes(query)) {
const index = searchHistory.indexOf(query);
searchHistory.splice(index, 1);
}
searchHistory.unshift(query);
if (searchHistory.length > 10) searchHistory.shift();
localStorage.setItem("search_history", JSON.stringify(searchHistory));
},
},
};
</script>

View File

@@ -47,11 +47,16 @@ export default {
}
},
async refreshSuggestions() {
this.searchSuggestions = (
await this.fetchJson(this.apiUrl() + "/opensearch/suggestions", {
query: this.searchText,
})
)?.[1];
if (!this.searchText) {
if (this.getPreferenceBoolean("searchHistory", false))
this.searchSuggestions = JSON.parse(localStorage.getItem("search_history")) ?? [];
} else {
this.searchSuggestions = (
await this.fetchJson(this.apiUrl() + "/opensearch/suggestions", {
query: this.searchText,
})
)?.[1];
}
this.searchSuggestions.unshift(this.searchText);
this.setSelected(0);
},

View File

@@ -1,5 +1,5 @@
<template>
<div>
<div v-if="showVideo">
<router-link
:to="{
path: '/watch',
@@ -133,6 +133,10 @@ export default {
return {};
},
},
isFeed: {
type: Boolean,
default: false,
},
height: { type: String, default: "118" },
width: { type: String, default: "210" },
hideChannel: { type: Boolean, default: false },
@@ -143,8 +147,12 @@ export default {
data() {
return {
showModal: false,
showVideo: true,
};
},
mounted() {
this.shouldShowVideo();
},
methods: {
removeVideo() {
if (confirm(this.$t("actions.delete_playlist_video_confirm"))) {
@@ -165,6 +173,19 @@ export default {
});
}
},
shouldShowVideo() {
if (!this.isFeed || !this.getPreferenceBoolean("hideWatched", false)) return;
const objectStore = window.db.transaction("watch_history", "readonly").objectStore("watch_history");
const request = objectStore.get(this.video.url.substr(-11));
request.onsuccess = event => {
const video = event.target.result;
if (video && (video.currentTime ?? 0) > video.duration * 0.9) {
this.showVideo = false;
return;
}
};
},
},
computed: {
short() {