mirror of
https://github.com/wkulhanek/bonob.git
synced 2025-12-22 01:43:29 +01:00
Adding some css, fix message on log in failure
This commit is contained in:
@@ -22,10 +22,6 @@ export type AuthFailure = {
|
||||
message: string;
|
||||
};
|
||||
|
||||
export interface MusicService {
|
||||
generateToken(credentials: Credentials): Promise<AuthSuccess | AuthFailure>;
|
||||
login(authToken: string): Promise<MusicLibrary>;
|
||||
}
|
||||
|
||||
export type Artist = {
|
||||
id: string;
|
||||
@@ -64,6 +60,10 @@ export type ArtistQuery = Paging
|
||||
export type AlbumQuery = Paging & {
|
||||
artistId?: string
|
||||
}
|
||||
export interface MusicService {
|
||||
generateToken(credentials: Credentials): Promise<AuthSuccess | AuthFailure>;
|
||||
login(authToken: string): Promise<MusicLibrary>;
|
||||
}
|
||||
|
||||
export interface MusicLibrary {
|
||||
artists(q: ArtistQuery): Promise<Result<Artist>>;
|
||||
|
||||
@@ -1,5 +1,15 @@
|
||||
import { Md5 } from "ts-md5/dist/md5";
|
||||
import { Credentials, MusicService, Album, Artist, Result, slice2, asResult, AlbumQuery, ArtistQuery } from "./music_service";
|
||||
import {
|
||||
Credentials,
|
||||
MusicService,
|
||||
Album,
|
||||
Artist,
|
||||
Result,
|
||||
slice2,
|
||||
asResult,
|
||||
AlbumQuery,
|
||||
ArtistQuery,
|
||||
} from "./music_service";
|
||||
import X2JS from "x2js";
|
||||
|
||||
import axios from "axios";
|
||||
@@ -85,7 +95,7 @@ export class Navidrome implements MusicService {
|
||||
).toString("base64"),
|
||||
userId: credentials.username,
|
||||
nickname: credentials.username,
|
||||
}));
|
||||
})).catch(e => ({ message: `${e}` }));
|
||||
|
||||
parseToken = (token: string): Credentials =>
|
||||
JSON.parse(
|
||||
@@ -112,7 +122,7 @@ export class Navidrome implements MusicService {
|
||||
name: id,
|
||||
}),
|
||||
albums: (_: AlbumQuery): Promise<Result<Album>> => {
|
||||
return Promise.resolve({ results: [], total: 0});
|
||||
return Promise.resolve({ results: [], total: 0 });
|
||||
},
|
||||
});
|
||||
}
|
||||
|
||||
@@ -83,11 +83,11 @@ function server(
|
||||
if (isSuccess(authResult)) {
|
||||
linkCodes.associate(linkCode, authResult);
|
||||
res.render("success", {
|
||||
message: `Login successful`,
|
||||
message: `Login successful!`,
|
||||
});
|
||||
} else {
|
||||
res.status(403).render("failure", {
|
||||
message: `Login failed, ${authResult.message}!`,
|
||||
message: `Login failed! ${authResult.message}!`,
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user