mirror of
https://codeberg.org/Hyperpipe/Hyperpipe
synced 2025-06-28 05:08:00 +02:00
parent
5449523f2a
commit
7905394b26
7 changed files with 143 additions and 134 deletions
|
@ -29,7 +29,7 @@ const Genres = defineAsyncComponent(() => import('@/components/Genres.vue')),
|
||||||
Prefs = defineAsyncComponent(() => import('@/components/Prefs.vue'));
|
Prefs = defineAsyncComponent(() => import('@/components/Prefs.vue'));
|
||||||
|
|
||||||
/* Composables */
|
/* Composables */
|
||||||
import { useStore } from '@/scripts/util.js';
|
import { useStore, useUnwrap } from '@/scripts/util.js';
|
||||||
import { useSetupDB, useUpdatePlaylist } from '@/scripts/db.js';
|
import { useSetupDB, useUpdatePlaylist } from '@/scripts/db.js';
|
||||||
|
|
||||||
/* Stores */
|
/* Stores */
|
||||||
|
@ -62,8 +62,7 @@ function parseUrl() {
|
||||||
results.getExplore();
|
results.getExplore();
|
||||||
break;
|
break;
|
||||||
case 'search':
|
case 'search':
|
||||||
nav.state.search = loc[2];
|
nav.state.search = useUnwrap(loc[2]);
|
||||||
console.log(nav.state.search);
|
|
||||||
break;
|
break;
|
||||||
case 'watch':
|
case 'watch':
|
||||||
player.state.status = 'circle';
|
player.state.status = 'circle';
|
||||||
|
|
|
@ -48,7 +48,7 @@ function set(page) {
|
||||||
:data-active="nav.state.page == 'explore'"
|
:data-active="nav.state.page == 'explore'"
|
||||||
@click="set('explore')"></span>
|
@click="set('explore')"></span>
|
||||||
<span
|
<span
|
||||||
class="nav-ico bi bi-graph-down clickable"
|
class="nav-ico bi bi-graph-up-arrow clickable"
|
||||||
:data-active="nav.state.page == 'charts'"
|
:data-active="nav.state.page == 'charts'"
|
||||||
@click="set('charts')"></span>
|
@click="set('charts')"></span>
|
||||||
<span
|
<span
|
||||||
|
|
|
@ -6,7 +6,7 @@ import SongItem from './SongItem.vue';
|
||||||
import AlbumItem from './AlbumItem.vue';
|
import AlbumItem from './AlbumItem.vue';
|
||||||
|
|
||||||
import { getJsonPiped, getPipedQuery } from '@/scripts/fetch.js';
|
import { getJsonPiped, getPipedQuery } from '@/scripts/fetch.js';
|
||||||
import { useRoute } from '@/scripts/util.js';
|
import { useRoute, useWrap } from '@/scripts/util.js';
|
||||||
import { useCreatePlaylist } from '@/scripts/db.js';
|
import { useCreatePlaylist } from '@/scripts/db.js';
|
||||||
|
|
||||||
import { useResults, useArtist } from '@/stores/results.js';
|
import { useResults, useArtist } from '@/stores/results.js';
|
||||||
|
@ -74,7 +74,7 @@ const shuffleAdd = () => {
|
||||||
},
|
},
|
||||||
getSearch = q => {
|
getSearch = q => {
|
||||||
if (q) {
|
if (q) {
|
||||||
const pq = q.split(' ').join('+');
|
const pq = useWrap(q);
|
||||||
|
|
||||||
history.pushState({}, '', `/search/${pq + getPipedQuery()}`);
|
history.pushState({}, '', `/search/${pq + getPipedQuery()}`);
|
||||||
|
|
||||||
|
|
|
@ -10,6 +10,14 @@ export function useRoute(l) {
|
||||||
history.pushState({}, '', l);
|
history.pushState({}, '', l);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export function useWrap(txt) {
|
||||||
|
return encodeURIComponent(txt).replaceAll('%20', '+');
|
||||||
|
}
|
||||||
|
|
||||||
|
export function useUnwrap(txt) {
|
||||||
|
return decodeURIComponent(txt).replaceAll('+', ' ');
|
||||||
|
}
|
||||||
|
|
||||||
export function useStore() {
|
export function useStore() {
|
||||||
try {
|
try {
|
||||||
return window.localStorage;
|
return window.localStorage;
|
||||||
|
|
|
@ -31,8 +31,10 @@ export const useData = defineStore('data', () => {
|
||||||
|
|
||||||
state.art = json.thumbnailUrl;
|
state.art = json.thumbnailUrl;
|
||||||
state.description = json.description;
|
state.description = json.description;
|
||||||
state.title = json.title;
|
state.title = json.title.replaceAll('&', '&');
|
||||||
state.artist = json.uploader.replace(' - Topic', '');
|
state.artist = json.uploader
|
||||||
|
.replace(' - Topic', '')
|
||||||
|
.replaceAll('&', '&');
|
||||||
state.artistUrl = json.uploaderUrl;
|
state.artistUrl = json.uploaderUrl;
|
||||||
player.state.duration = json.duration;
|
player.state.duration = json.duration;
|
||||||
player.state.hls = json.hls;
|
player.state.hls = json.hls;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue