mirror of
https://codeberg.org/Hyperpipe/Hyperpipe
synced 2025-06-27 20:58:01 +02:00
Added getJsonHyp method
This commit is contained in:
parent
dc969e44ee
commit
4f5887aca0
4 changed files with 20 additions and 16 deletions
10
src/App.vue
10
src/App.vue
|
@ -17,7 +17,7 @@ import Artist from '@/components/Artist.vue';
|
|||
import Prefs from '@/components/Prefs.vue';
|
||||
|
||||
/* Composables */
|
||||
import { getJson, getJsonPiped } from '@/scripts/fetch.js';
|
||||
import { getJsonHyp, getJsonPiped } from '@/scripts/fetch.js';
|
||||
import { useLazyLoad, useStore, useRoute } from '@/scripts/util.js';
|
||||
import { useSetupDB, useUpdatePlaylist } from '@/scripts/db.js';
|
||||
|
||||
|
@ -121,7 +121,7 @@ function playNext(u) {
|
|||
}
|
||||
|
||||
async function getExplore() {
|
||||
const json = await getJson('https://hyperpipeapi.onrender.com/explore');
|
||||
const json = await getJsonHyp('/explore');
|
||||
|
||||
console.log(json);
|
||||
|
||||
|
@ -178,7 +178,7 @@ async function getArtist(e) {
|
|||
|
||||
e = e.replace('/channel/', '');
|
||||
|
||||
const json = await getJson('https://hyperpipeapi.onrender.com/channel/' + e);
|
||||
const json = await getJsonHyp('/channel/' + e);
|
||||
|
||||
console.log(json);
|
||||
|
||||
|
@ -203,9 +203,7 @@ async function getNext(hash) {
|
|||
!data.state.urls.filter(s => s.url == data.state.url)[0] ||
|
||||
data.state.urls.length == 1)
|
||||
) {
|
||||
const json = await getJson(
|
||||
'https://hyperpipeapi.onrender.com/next/' + hash,
|
||||
);
|
||||
const json = await getJsonHyp('/next/' + hash);
|
||||
|
||||
data.state.lyrics = json.lyricsId;
|
||||
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
<script setup>
|
||||
import { ref, watch } from 'vue';
|
||||
|
||||
import { getJson } from '@/scripts/fetch.js';
|
||||
import { getJsonHyp } from '@/scripts/fetch.js';
|
||||
import { useData } from '@/stores/player.js';
|
||||
|
||||
import TextModal from './TextModal.vue';
|
||||
|
@ -15,22 +15,17 @@ function get() {
|
|||
status.value = false;
|
||||
|
||||
if (data.state.lyrics && data.state.urls === data.state.urls[0]?.url) {
|
||||
getJson(
|
||||
'https://hyperpipeapi.onrender.com/browse/' + data.state.lyrics,
|
||||
).then(res => {
|
||||
getJsonHyp('/browse/' + data.state.lyrics).then(res => {
|
||||
text.value = res.text;
|
||||
source.value = res.source;
|
||||
status.value = true;
|
||||
});
|
||||
} else if (data.state.urls[0]?.url) {
|
||||
getJson(
|
||||
'https://hyperpipeapi.onrender.com/next/' +
|
||||
data.state.urls[0]?.url.replace('/watch?v=', ''),
|
||||
getJsonHyp(
|
||||
'/next/' + data.state.urls[0]?.url.replace('/watch?v=', ''),
|
||||
).then(next => {
|
||||
if (next.lyricsId) {
|
||||
getJson(
|
||||
'https://hyperpipeapi.onrender.com/browse/' + next.lyricsId,
|
||||
).then(res => {
|
||||
getJsonHyp('/browse/' + next.lyricsId).then(res => {
|
||||
text.value = res.text;
|
||||
source.value = res.source;
|
||||
status.value = true;
|
||||
|
|
|
@ -39,3 +39,9 @@ export async function getJsonPiped(path) {
|
|||
|
||||
return await getJson('https://' + root + path);
|
||||
}
|
||||
|
||||
export async function getJsonHyp(path) {
|
||||
const root = useStore().getItem('api') || 'hyperpipeapi.onrender.com';
|
||||
|
||||
return await getJson('https://' + root + path);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue