mirror of
https://github.com/janishutz/MusicPlayerV2.git
synced 2025-11-25 04:54:23 +00:00
Finish up migration, currently not setup for foss version
This commit is contained in:
@@ -13,12 +13,12 @@
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import {
|
||||
ref
|
||||
} from 'vue';
|
||||
import {
|
||||
RouterView
|
||||
} from 'vue-router';
|
||||
import {
|
||||
ref
|
||||
} from 'vue';
|
||||
|
||||
const theme = ref( 'light_mode' );
|
||||
|
||||
|
||||
@@ -1,11 +1,13 @@
|
||||
import App from './App.vue';
|
||||
import {
|
||||
createApp
|
||||
} from 'vue';
|
||||
import {
|
||||
createPinia
|
||||
} from 'pinia';
|
||||
import App from './App.vue';
|
||||
import router from './router';
|
||||
import sdk from '@janishutz/login-sdk-browser';
|
||||
|
||||
|
||||
const app = createApp( App );
|
||||
|
||||
@@ -14,5 +16,11 @@ app.use( router );
|
||||
|
||||
// localStorage.setItem( 'url', 'http://localhost:8082' );
|
||||
localStorage.setItem( 'url', 'https://music-api.janishutz.com' );
|
||||
sdk.setUp(
|
||||
'jh-music',
|
||||
String( localStorage.getItem( 'url' ) ),
|
||||
'/app',
|
||||
false // Set to false for deploy to actual backend
|
||||
);
|
||||
|
||||
app.mount( '#app' );
|
||||
|
||||
@@ -6,10 +6,9 @@ import {
|
||||
// FOSS-VERSION: To enable the UI to be used with the FOSS version, change "isUserAuth" to true, you will be "logged in"
|
||||
export const useUserStore = defineStore( 'user', {
|
||||
'state': () => ( {
|
||||
'isUserAuth': true,
|
||||
'isUserAuth': false,
|
||||
'hasSubscribed': false,
|
||||
'isUsingKeyboard': false,
|
||||
'username': '',
|
||||
'isFOSSVersion': false
|
||||
} ),
|
||||
'getters': {
|
||||
@@ -23,9 +22,6 @@ export const useUserStore = defineStore( 'user', {
|
||||
setSubscriptionStatus ( status: boolean ) {
|
||||
this.hasSubscribed = status;
|
||||
},
|
||||
setUsername ( username: string ) {
|
||||
this.username = username;
|
||||
},
|
||||
setKeyboardUsageStatus ( status: boolean ) {
|
||||
this.isUsingKeyboard = status;
|
||||
}
|
||||
|
||||
@@ -24,36 +24,24 @@
|
||||
|
||||
<script setup lang="ts">
|
||||
// TODO: Make possible to install and use without account, if using FOSS version
|
||||
import router from '@/router';
|
||||
import {
|
||||
RouterLink
|
||||
} from 'vue-router';
|
||||
import {
|
||||
useUserStore
|
||||
} from '@/stores/userStore';
|
||||
import notificationsModule from '@/components/notificationsModule.vue';
|
||||
import {
|
||||
ref
|
||||
} from 'vue';
|
||||
import router from '@/router';
|
||||
import sdk from '@janishutz/login-sdk-browser';
|
||||
import {
|
||||
useUserStore
|
||||
} from '@/stores/userStore';
|
||||
|
||||
const notifications = ref( notificationsModule );
|
||||
const isTryingToSignIn = ref( true );
|
||||
|
||||
interface JanishutzIDSDK {
|
||||
'setLoginSDKURL': ( url: string ) => undefined;
|
||||
'createSession': () => undefined;
|
||||
'verifySession': () => Promise<JHIDSessionStatus>
|
||||
}
|
||||
|
||||
interface JHIDSessionStatus {
|
||||
'status': boolean;
|
||||
'username': string;
|
||||
}
|
||||
|
||||
let sdk: JanishutzIDSDK;
|
||||
|
||||
const login = () => {
|
||||
sdk.createSession();
|
||||
sdk.login();
|
||||
};
|
||||
|
||||
const store = useUserStore();
|
||||
@@ -62,11 +50,10 @@
|
||||
router.push( localStorage.getItem( 'redirect' ) ?? '/app' );
|
||||
localStorage.removeItem( 'redirect' );
|
||||
} else {
|
||||
if ( typeof sdk !== 'undefined' ) {
|
||||
sdk.verifySession().then( res => {
|
||||
if ( res.status ) {
|
||||
sdk.verifyFull()
|
||||
.then( res => {
|
||||
if ( res ) {
|
||||
store.isUserAuth = true;
|
||||
store.username = res.username;
|
||||
|
||||
if ( localStorage.getItem( 'close-tab' ) ) {
|
||||
localStorage.removeItem( 'close-tab' );
|
||||
@@ -80,7 +67,6 @@
|
||||
isTryingToSignIn.value = false;
|
||||
}
|
||||
} );
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user