fix lint errors in home.vue / index.listenbrainz.vue

This commit is contained in:
Hazelnoot 2024-10-26 12:58:07 -04:00
parent 75fc3de405
commit d2a4d6d9e0
5 changed files with 101 additions and 71 deletions

36
locales/index.d.ts vendored
View file

@ -5353,6 +5353,10 @@ export interface Locale extends ILocale {
* *
*/ */
"silenceDescription": string; "silenceDescription": string;
/**
* New
*/
"new": string;
}; };
"_initialAccountSetting": { "_initialAccountSetting": {
/** /**
@ -8442,6 +8446,10 @@ export interface Locale extends ILocale {
* *
*/ */
"pleaseLogin": string; "pleaseLogin": string;
/**
* Allowed
*/
"allowed": string;
}; };
"_antennaSources": { "_antennaSources": {
/** /**
@ -10603,6 +10611,30 @@ export interface Locale extends ILocale {
* Mutuals * Mutuals
*/ */
"mutuals": string; "mutuals": string;
/**
* Private account
*/
"isLocked": string;
/**
* Administrator
*/
"isAdmin": string;
/**
* Bot user
*/
"isBot": string;
/**
* Open
*/
"open": string;
/**
* Destination address
*/
"emailDestination": string;
/**
* Date
*/
"date": string;
/** /**
* Quoted. * Quoted.
*/ */
@ -10964,6 +10996,10 @@ export interface Locale extends ILocale {
* Blocking you * Blocking you
*/ */
"blockingYou": string; "blockingYou": string;
/**
* Show warning when opening external URLs
*/
"warnExternalUrl": string;
"_mfm": { "_mfm": {
/** /**
* This is not a widespread feature, it may not display properly on most other fedi software, including other Misskey forks * This is not a widespread feature, it may not display properly on most other fedi software, including other Misskey forks

View file

@ -300,7 +300,7 @@ export const packedUserDetailedNotMeOnlySchema = {
nullable: true, optional: false, nullable: true, optional: false,
example: '2018-03-12', example: '2018-03-12',
}, },
ListenBrainz: { listenbrainz: {
type: 'string', type: 'string',
nullable: true, nullable: true,
optional: false, optional: false,

View file

@ -215,9 +215,9 @@ import { getStaticImageUrl } from '@/scripts/media-proxy.js';
import { infoImageUrl } from '@/instance.js'; import { infoImageUrl } from '@/instance.js';
const MkNote = defineAsyncComponent(() => const MkNote = defineAsyncComponent(() =>
(defaultStore.state.noteDesign === 'misskey') ? import('@/components/MkNote.vue') : defaultStore.state.noteDesign === 'sharkey'
(defaultStore.state.noteDesign === 'sharkey') ? import('@/components/SkNote.vue') : ? import('@/components/SkNote.vue')
null : import('@/components/MkNote.vue'),
); );
function calcAge(birthdate: string): number { function calcAge(birthdate: string): number {
@ -237,7 +237,7 @@ function calcAge(birthdate: string): number {
const XFiles = defineAsyncComponent(() => import('./index.files.vue')); const XFiles = defineAsyncComponent(() => import('./index.files.vue'));
const XActivity = defineAsyncComponent(() => import('./index.activity.vue')); const XActivity = defineAsyncComponent(() => import('./index.activity.vue'));
const XListenBrainz = defineAsyncComponent(() => import("./index.listenbrainz.vue")); const XListenBrainz = defineAsyncComponent(() => import('./index.listenbrainz.vue'));
//const XTimeline = defineAsyncComponent(() => import('./index.timeline.vue')); //const XTimeline = defineAsyncComponent(() => import('./index.timeline.vue'));
const props = withDefaults(defineProps<{ const props = withDefaults(defineProps<{
@ -269,7 +269,7 @@ if (props.user.listenbrainz) {
const response = await fetch(`https://api.listenbrainz.org/1/user/${props.user.listenbrainz}/playing-now`, { const response = await fetch(`https://api.listenbrainz.org/1/user/${props.user.listenbrainz}/playing-now`, {
method: 'GET', method: 'GET',
headers: { headers: {
'Content-Type': 'application/json' 'Content-Type': 'application/json',
}, },
}); });
const data = await response.json(); const data = await response.json();
@ -286,11 +286,11 @@ const background = computed(() => {
if (props.user.backgroundUrl == null) return {}; if (props.user.backgroundUrl == null) return {};
if (defaultStore.state.disableShowingAnimatedImages) { if (defaultStore.state.disableShowingAnimatedImages) {
return { return {
'--backgroundImageStatic': `url('${getStaticImageUrl(props.user.backgroundUrl)}')` '--backgroundImageStatic': `url('${getStaticImageUrl(props.user.backgroundUrl)}')`,
}; };
} else { } else {
return { return {
'--backgroundImageStatic': `url('${props.user.backgroundUrl}')` '--backgroundImageStatic': `url('${props.user.backgroundUrl}')`,
}; };
} }
}); });
@ -303,7 +303,7 @@ const pagination = {
endpoint: 'users/featured-notes' as const, endpoint: 'users/featured-notes' as const,
limit: 10, limit: 10,
params: computed(() => ({ params: computed(() => ({
userId: props.user.id userId: props.user.id,
})), })),
}; };

View file

@ -4,19 +4,18 @@ SPDX-License-Identifier: AGPL-3.0-only
--> -->
<template> <template>
<MkContainer :foldable="true" :expanded="!collapsed"> <MkContainer :foldable="true" :expanded="!collapsed">
<template #header <template #header>
><i <i
class="ph-headphones ph-bold ph-lg" class="ph-headphones ph-bold ph-lg"
style="margin-right: 0.5em" style="margin-right: 0.5em"
></i ></i>Music
>Music</template </template>
>
<div style="padding: 8px"> <div style="padding: 8px">
<div class="flex"> <div class="flex">
<a :href="listenbrainz.musicbrainzurl"> <a :href="listenbrainz.musicbrainzurl">
<img class="image" :src="listenbrainz.img" :alt="listenbrainz.title" /> <img class="image" :src="listenbrainz.img" :alt="listenbrainz.title"/>
<div class="flex flex-col items-start"> <div class="flex flex-col items-start">
<p class="text-sm font-bold">Now Playing: {{ listenbrainz.title }}</p> <p class="text-sm font-bold">Now Playing: {{ listenbrainz.title }}</p>
<p class="text-xs font-medium">{{ listenbrainz.artist }}</p> <p class="text-xs font-medium">{{ listenbrainz.artist }}</p>
@ -29,17 +28,15 @@ SPDX-License-Identifier: AGPL-3.0-only
</a> </a>
</div> </div>
</div> </div>
</MkContainer> </MkContainer>
</template> </template>
<script lang="ts" setup> <script lang="ts" setup>
/* eslint-disable no-mixed-spaces-and-tabs */ import * as misskey from 'misskey-js';
import {} from "vue"; import MkContainer from '@/components/MkContainer.vue';
import * as misskey from "misskey-js";
import MkContainer from "@/components/MkContainer.vue";
const props = withDefaults( const props = withDefaults(
defineProps<{ defineProps<{
user: misskey.entities.User; user: misskey.entities.UserDetailed;
collapsed?: boolean; collapsed?: boolean;
}>(), { }>(), {
collapsed: false, collapsed: false,
@ -51,7 +48,7 @@ if (props.user.listenbrainz) {
const response = await fetch(`https://api.listenbrainz.org/1/metadata/lookup/?artist_name=${artist}&recording_name=${title}`, { const response = await fetch(`https://api.listenbrainz.org/1/metadata/lookup/?artist_name=${artist}&recording_name=${title}`, {
method: 'GET', method: 'GET',
headers: { headers: {
'Content-Type': 'application/json' 'Content-Type': 'application/json',
}, },
}); });
const data = await response.json(); const data = await response.json();
@ -68,7 +65,7 @@ if (props.user.listenbrainz) {
const response = await fetch(`https://api.listenbrainz.org/1/user/${props.user.listenbrainz}/playing-now`, { const response = await fetch(`https://api.listenbrainz.org/1/user/${props.user.listenbrainz}/playing-now`, {
method: 'GET', method: 'GET',
headers: { headers: {
'Content-Type': 'application/json' 'Content-Type': 'application/json',
}, },
}); });
const data = await response.json(); const data = await response.json();
@ -76,22 +73,20 @@ if (props.user.listenbrainz) {
const title: string = data.payload.listens[0].track_metadata.track_name; const title: string = data.payload.listens[0].track_metadata.track_name;
const artist: string = data.payload.listens[0].track_metadata.artist_name; const artist: string = data.payload.listens[0].track_metadata.artist_name;
const lastlisten: string = data.payload.listens[0].playing_now; const lastlisten: string = data.payload.listens[0].playing_now;
const img: string = 'https://coverartarchive.org/img/big_logo.svg'; const img = 'https://coverartarchive.org/img/big_logo.svg';
await getLMData(title, artist).then((data) => { await getLMData(title, artist).then((lmData) => {
if (!data) { if (!lmData) {
listenbrainz.title = title; listenbrainz.title = title;
listenbrainz.img = img; listenbrainz.img = img;
listenbrainz.artist = artist; listenbrainz.artist = artist;
listenbrainz.lastlisten = lastlisten; listenbrainz.lastlisten = lastlisten;
return;
} else { } else {
listenbrainz.title = data[0]; listenbrainz.title = lmData[0];
listenbrainz.img = data[2]; listenbrainz.img = lmData[2];
listenbrainz.artist = data[1]; listenbrainz.artist = lmData[1];
listenbrainz.lastlisten = lastlisten; listenbrainz.lastlisten = lastlisten;
listenbrainz.musicbrainzurl = data[3]; listenbrainz.musicbrainzurl = lmData[3];
listenbrainz.listenbrainzurl = data[4]; listenbrainz.listenbrainzurl = lmData[4];
return;
} }
}); });
} }
@ -121,8 +116,7 @@ if (props.user.listenbrainz) {
} }
.text-sm { .text-sm {
font-size: 0.875rem; font-size: 0.875rem;
margin: 0; margin: 0 0 0.3rem;
margin-bottom: 0.3rem;
} }
.font-bold { .font-bold {
font-weight: 700; font-weight: 700;

View file

@ -3939,7 +3939,7 @@ export type components = {
/** @example 2018-03-12 */ /** @example 2018-03-12 */
birthday: string | null; birthday: string | null;
/** @example Steve */ /** @example Steve */
ListenBrainz: string | null; listenbrainz: string | null;
/** @example ja-JP */ /** @example ja-JP */
lang: string | null; lang: string | null;
fields: { fields: {