mirror of
https://github.com/janishutz/MusicPlayerV2.git
synced 2025-11-25 13:04:23 +00:00
plan sdk stubs
This commit is contained in:
@@ -12,6 +12,8 @@ import type { Room, Song } from './definitions';
|
||||
import storeSDK from 'store.janishutz.com-sdk';
|
||||
import bodyParser from 'body-parser';
|
||||
|
||||
const isFossVersion = true;
|
||||
|
||||
declare let __dirname: string | undefined
|
||||
if ( typeof( __dirname ) === 'undefined' ) {
|
||||
__dirname = path.resolve( path.dirname( '' ) );
|
||||
@@ -27,30 +29,35 @@ const run = () => {
|
||||
credentials: true,
|
||||
origin: true
|
||||
} ) );
|
||||
// storeSDK.configure( JSON.parse( '' + fs.readFileSync( path.join( __dirname + '/config/store-sdk.config.testing.json' ) ) ) );
|
||||
storeSDK.configure( JSON.parse( '' + fs.readFileSync( path.join( __dirname + '/config/store-sdk.config.secret.json' ) ) ) );
|
||||
|
||||
if ( !isFossVersion ) {
|
||||
// storeSDK.configure( JSON.parse( '' + fs.readFileSync( path.join( __dirname + '/config/store-sdk.config.testing.json' ) ) ) );
|
||||
storeSDK.configure( JSON.parse( '' + fs.readFileSync( path.join( __dirname + '/config/store-sdk.config.secret.json' ) ) ) );
|
||||
}
|
||||
|
||||
const httpServer = createServer( app );
|
||||
|
||||
// Load id.janishutz.com SDK and allow signing in
|
||||
sdk.routes( app, ( uid: string ) => {
|
||||
return new Promise( ( resolve, reject ) => {
|
||||
account.checkUser( uid ).then( stat => {
|
||||
resolve( stat );
|
||||
} ).catch( e => {
|
||||
reject( e );
|
||||
if ( !isFossVersion ) {
|
||||
// Load id.janishutz.com SDK and allow signing in
|
||||
sdk.routes( app, ( uid: string ) => {
|
||||
return new Promise( ( resolve, reject ) => {
|
||||
account.checkUser( uid ).then( stat => {
|
||||
resolve( stat );
|
||||
} ).catch( e => {
|
||||
reject( e );
|
||||
} );
|
||||
} );
|
||||
} );
|
||||
},
|
||||
( uid: string, email: string, username: string ) => {
|
||||
return new Promise( ( resolve, reject ) => {
|
||||
account.createUser( uid, username, email ).then( stat => {
|
||||
resolve( stat );
|
||||
} ).catch( e => {
|
||||
reject( e );
|
||||
},
|
||||
( uid: string, email: string, username: string ) => {
|
||||
return new Promise( ( resolve, reject ) => {
|
||||
account.createUser( uid, username, email ).then( stat => {
|
||||
resolve( stat );
|
||||
} ).catch( e => {
|
||||
reject( e );
|
||||
} );
|
||||
} );
|
||||
} );
|
||||
}, sdkConfig );
|
||||
}, sdkConfig );
|
||||
}
|
||||
|
||||
// Websocket for events
|
||||
interface SocketData {
|
||||
|
||||
11
backend/src/sdk/sdk-stub.ts
Normal file
11
backend/src/sdk/sdk-stub.ts
Normal file
@@ -0,0 +1,11 @@
|
||||
import express from 'express';
|
||||
|
||||
// TODO: Use also express-session to make it work with getSessionID and session referencing
|
||||
const checkAuth = ( request: express.Request ) => {
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
export default {
|
||||
checkAuth
|
||||
}
|
||||
11
backend/src/sdk/store-sdk-stub.ts
Normal file
11
backend/src/sdk/store-sdk-stub.ts
Normal file
@@ -0,0 +1,11 @@
|
||||
const getSubscriptions = ( uid: string ) => {
|
||||
return [ {
|
||||
'id': 'com.janishutz.MusicPlayer.subscription',
|
||||
'expires': new Date().getTime() + 200000,
|
||||
'status': true
|
||||
} ]
|
||||
}
|
||||
|
||||
export default {
|
||||
getSubscriptions
|
||||
}
|
||||
Reference in New Issue
Block a user