mirror of
https://github.com/janishutz/MusicPlayerV2.git
synced 2025-11-25 21:14:22 +00:00
some more stubs, remove old app
This commit is contained in:
@@ -1,11 +1,50 @@
|
||||
import express from 'express';
|
||||
import expressSession from 'express-session';
|
||||
import crypto from 'node:crypto';
|
||||
|
||||
// TODO: Use also express-session to make it work with getSessionID and session referencing
|
||||
const checkAuth = ( request: express.Request ) => {
|
||||
return true;
|
||||
}
|
||||
|
||||
export interface AuthSDKConfig {
|
||||
token: string;
|
||||
name: string;
|
||||
client: string;
|
||||
backendURL: string;
|
||||
failReturnURL: string;
|
||||
useSecureCookie?: boolean;
|
||||
}
|
||||
|
||||
declare module 'express-session' {
|
||||
interface SessionData {
|
||||
isAuth: boolean;
|
||||
uid: string;
|
||||
username: string;
|
||||
email: string;
|
||||
additionalData: object;
|
||||
}
|
||||
}
|
||||
|
||||
const routes = ( app: express.Application,
|
||||
check_user: ( uid: string ) => Promise<boolean>,
|
||||
save_user: ( uid: string, email: string, username: string ) => Promise<boolean>,
|
||||
conf?: AuthSDKConfig
|
||||
): undefined => {
|
||||
|
||||
}
|
||||
|
||||
const getUserData = ( request: express.Request ) => {
|
||||
if ( !request.session.uid ) {
|
||||
request.session.uid = crypto.randomUUID();
|
||||
request.session.username = 'FOSS-Version';
|
||||
request.session.email = 'example@example.com';
|
||||
}
|
||||
return { 'email': request.session.email, 'username': request.session.username, 'uid': request.session.uid, 'id': request.session.id };
|
||||
}
|
||||
|
||||
export default {
|
||||
checkAuth
|
||||
checkAuth,
|
||||
routes,
|
||||
getUserData
|
||||
}
|
||||
@@ -3,9 +3,14 @@ const getSubscriptions = ( uid: string ) => {
|
||||
'id': 'com.janishutz.MusicPlayer.subscription',
|
||||
'expires': new Date().getTime() + 200000,
|
||||
'status': true
|
||||
} ]
|
||||
} ];
|
||||
}
|
||||
|
||||
const configure = ( config: object ) => {
|
||||
|
||||
}
|
||||
|
||||
export default {
|
||||
getSubscriptions
|
||||
getSubscriptions,
|
||||
configure
|
||||
}
|
||||
Reference in New Issue
Block a user