some more stubs, remove old app

This commit is contained in:
2024-10-02 15:56:05 +02:00
parent da01326777
commit a2f6757d84
61 changed files with 116 additions and 33479 deletions

View File

@@ -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
}

View File

@@ -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
}