mirror of
https://github.com/jeffvli/feishin.git
synced 2026-06-10 06:12:43 +02:00
support secondary public server URL
This commit is contained in:
@@ -5,6 +5,7 @@ import qs from 'qs';
|
||||
import { z } from 'zod';
|
||||
|
||||
import i18n from '/@/i18n/i18n';
|
||||
import { getServerUrl } from '/@/renderer/utils/normalize-server-url';
|
||||
import { ssType } from '/@/shared/api/subsonic/subsonic-types';
|
||||
import { hasFeature } from '/@/shared/api/utils';
|
||||
import { toast } from '/@/shared/components/toast/toast';
|
||||
@@ -398,7 +399,8 @@ export const ssApiClient = (args: {
|
||||
const { params, path: api } = parsePath(path);
|
||||
|
||||
if (server) {
|
||||
baseUrl = `${server.url}/rest`;
|
||||
const serverUrl = getServerUrl(server);
|
||||
baseUrl = serverUrl ? `${serverUrl}/rest` : undefined;
|
||||
const token = server.credential;
|
||||
const params = token.split(/&?\w=/gm);
|
||||
|
||||
|
||||
@@ -9,6 +9,7 @@ import { z } from 'zod';
|
||||
|
||||
import { contract, ssApiClient } from '/@/renderer/api/subsonic/subsonic-api';
|
||||
import { randomString } from '/@/renderer/utils';
|
||||
import { getServerUrl } from '/@/renderer/utils/normalize-server-url';
|
||||
import { ssNormalize } from '/@/shared/api/subsonic/subsonic-normalize';
|
||||
import {
|
||||
AlbumListSortType,
|
||||
@@ -851,11 +852,12 @@ export const SubsonicController: InternalControllerEndpoint = {
|
||||
startIndex: query.startIndex,
|
||||
});
|
||||
},
|
||||
getImageUrl: ({ apiClientProps: { server }, query }) => {
|
||||
getImageUrl: ({ apiClientProps: { server }, baseUrl, query }) => {
|
||||
const { id, size } = query;
|
||||
const imageSize = size;
|
||||
const url = baseUrl || getServerUrl(server);
|
||||
|
||||
if (!server?.url || !server?.credential) {
|
||||
if (!url || !server?.credential) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@@ -865,7 +867,7 @@ export const SubsonicController: InternalControllerEndpoint = {
|
||||
}
|
||||
|
||||
return (
|
||||
`${server.url}/rest/getCoverArt.view` +
|
||||
`${url}/rest/getCoverArt.view` +
|
||||
`?id=${id}` +
|
||||
`&${server.credential}` +
|
||||
'&v=1.13.0' +
|
||||
|
||||
Reference in New Issue
Block a user