mirror of
https://github.com/wkulhanek/bonob.git
synced 2025-12-22 09:53:32 +01:00
ref
This commit is contained in:
@@ -30,6 +30,7 @@ import logger from "./logger";
|
||||
import { assertSystem, BUrn } from "./burn";
|
||||
import { artist } from "./smapi";
|
||||
import { axiosImageFetcher, ImageFetcher } from "./images";
|
||||
import { asURLSearchParams } from "./utils";
|
||||
|
||||
|
||||
export const t = (password: string, s: string) =>
|
||||
@@ -331,16 +332,6 @@ export function appendMimeTypeToClientFor(mimeTypes: string[]) {
|
||||
mimeTypes.includes(track.mimeType) ? `bonob+${track.mimeType}` : "bonob";
|
||||
}
|
||||
|
||||
export const asURLSearchParams = (q: any) => {
|
||||
const urlSearchParams = new URLSearchParams();
|
||||
Object.keys(q).forEach((k) => {
|
||||
_.flatten([q[k]]).forEach((v) => {
|
||||
urlSearchParams.append(k, `${v}`);
|
||||
});
|
||||
});
|
||||
return urlSearchParams;
|
||||
};
|
||||
|
||||
const AlbumQueryTypeToSubsonicType: Record<AlbumQueryType, string> = {
|
||||
alphabeticalByArtist: "alphabeticalByArtist",
|
||||
alphabeticalByName: "alphabeticalByName",
|
||||
|
||||
14
src/utils.ts
14
src/utils.ts
@@ -1,3 +1,5 @@
|
||||
import { flatten } from "underscore";
|
||||
|
||||
export const BROWSER_HEADERS = {
|
||||
accept:
|
||||
"text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8",
|
||||
@@ -8,6 +10,18 @@ export const BROWSER_HEADERS = {
|
||||
"Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:86.0) Gecko/20100101 Firefox/86.0",
|
||||
};
|
||||
|
||||
|
||||
export const asURLSearchParams = (q: any) => {
|
||||
const urlSearchParams = new URLSearchParams();
|
||||
Object.keys(q).forEach((k) => {
|
||||
flatten([q[k]]).forEach((v) => {
|
||||
urlSearchParams.append(k, `${v}`);
|
||||
});
|
||||
});
|
||||
return urlSearchParams;
|
||||
};
|
||||
|
||||
|
||||
export function takeWithRepeats<T>(things:T[], count: number) {
|
||||
const result = [];
|
||||
for(let i = 0; i < count; i++) {
|
||||
|
||||
Reference in New Issue
Block a user