Skip to content

🎧 Your Personal Streaming Service

Remove unused localStorage config

Deluand38f8544d59f
diff --git a/ui/src/App.js b/ui/src/App.js
index d6d0249a9..370870d60 100644
--- a/ui/src/App.js
+++ b/ui/src/App.js
@@ -26,70 +26,54 @@ const i18nProvider = polyglotI18nProvider(
const history = createHashHistory()
-const App = () => {
- try {
- const appConfig = JSON.parse(window.__APP_CONFIG__)
-
- // This flags to the login process that it should create the first account instead
- if (appConfig.firstTime) {
- localStorage.setItem('initialAccountCreation', 'true')
- }
- localStorage.setItem('baseURL', appConfig.baseURL)
- } catch (e) {}
-
- return (
- <Provider
- store={createAdminStore({
- authProvider,
- dataProvider,
- history,
- customReducers: {
- queue: playQueueReducer,
- albumView: albumViewReducer,
- theme: themeReducer
- }
- })}
+const App = () => (
+ <Provider
+ store={createAdminStore({
+ authProvider,
+ dataProvider,
+ history,
+ customReducers: {
+ queue: playQueueReducer,
+ albumView: albumViewReducer,
+ theme: themeReducer
+ }
+ })}
+ >
+ <Admin
+ dataProvider={dataProvider}
+ authProvider={authProvider}
+ i18nProvider={i18nProvider}
+ customRoutes={customRoutes}
+ history={history}
+ layout={Layout}
+ loginPage={Login}
>
- <Admin
- dataProvider={dataProvider}
- authProvider={authProvider}
- i18nProvider={i18nProvider}
- customRoutes={customRoutes}
- history={history}
- layout={Layout}
- loginPage={Login}
- >
- {(permissions) => [
+ {(permissions) => [
+ <Resource name="artist" {...artist} options={{ subMenu: 'library' }} />,
+ <Resource name="album" {...album} options={{ subMenu: 'library' }} />,
+ <Resource name="song" {...song} options={{ subMenu: 'library' }} />,
+ <Resource name="albumSong" />,
+ permissions === 'admin' ? (
+ <Resource name="user" {...user} options={{ subMenu: 'settings' }} />
+ ) : null,
+ <Resource
+ name="player"
+ {...player}
+ options={{ subMenu: 'settings' }}
+ />,
+ permissions === 'admin' ? (
<Resource
- name="artist"
- {...artist}
- options={{ subMenu: 'library' }}
- />,
- <Resource name="album" {...album} options={{ subMenu: 'library' }} />,
- <Resource name="song" {...song} options={{ subMenu: 'library' }} />,
- <Resource name="albumSong" />,
- permissions === 'admin' ? (
- <Resource name="user" {...user} options={{ subMenu: 'settings' }} />
- ) : null,
- <Resource
- name="player"
- {...player}
+ name="transcoding"
+ {...transcoding}
options={{ subMenu: 'settings' }}
- />,
- permissions === 'admin' ? (
- <Resource
- name="transcoding"
- {...transcoding}
- options={{ subMenu: 'settings' }}
- />
- ) : (
- <Resource name="transcoding" />
- ),
- <Player />
- ]}
- </Admin>
- </Provider>
- )
-}
+ />
+ ) : (
+ <Resource name="transcoding" />
+ ),
+ <Player />
+ ]}
+ </Admin>
+ </Provider>
+)
export default App
diff --git a/ui/src/authProvider.js b/ui/src/authProvider.js
index 58ff2ea6a..f6f8d752b 100644
--- a/ui/src/authProvider.js
+++ b/ui/src/authProvider.js
@@ -24,7 +24,6 @@ const authProvider = {
.then((response) => {
// Validate token
jwtDecode(response.token)
- localStorage.removeItem('initialAccountCreation')
localStorage.setItem('token', response.token)
localStorage.setItem('name', response.name)
localStorage.setItem('username', response.username)
@@ -35,6 +34,8 @@ const authProvider = {
'subsonic-token',
generateSubsonicToken(password, salt)
)
+ // Avoid going to create admin dialog after logout/login without a refresh
+ config.firstTime = false
return response
})
.catch((error) => {
diff --git a/ui/src/dataProvider.js b/ui/src/dataProvider.js
index 7e7b15c76..9a9a06784 100644
--- a/ui/src/dataProvider.js
+++ b/ui/src/dataProvider.js
@@ -1,6 +1,7 @@
import { fetchUtils } from 'react-admin'
import jsonServerProvider from 'ra-data-json-server'
import baseUrl from './utils/baseUrl'
+import config from './config'
const restUrl = '/app/api'
const customAuthorizationHeader = 'X-ND-Authorization'
@@ -19,7 +20,8 @@ const httpClient = (url, options = {}) => {
const token = response.headers.get(customAuthorizationHeader)
if (token) {
localStorage.setItem('token', token)
- localStorage.removeItem('initialAccountCreation')
+ // Avoid going to create admin dialog after logout/login without a refresh
+ config.firstTime = false
}
return response
})