Skip to content
This repository was archived by the owner on Dec 24, 2025. It is now read-only.

Commit 439e7ad

Browse files
authored
Merge pull request #26
Library module
2 parents 787d0cb + 89970ad commit 439e7ad

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

49 files changed

+1670
-373
lines changed

.eslintrc.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ module.exports = {
66
'@typescript-eslint/unbound-method': 'off',
77
'@typescript-eslint/no-unsafe-return': 'off',
88
'@typescript-eslint/no-unsafe-argument': 'off',
9+
'@typescript-eslint/no-misused-promises': 'off'
910
},
1011
ignorePatterns: [
1112
'*.yml',

package.json

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -16,18 +16,18 @@
1616
"test": "vitest run --coverage"
1717
},
1818
"dependencies": {
19-
"@apollo/client": "^3.7.9",
19+
"@apollo/client": "^3.7.10",
2020
"@vue/apollo-composable": "^4.0.0-beta.4",
2121
"@vue/apollo-util": "^4.0.0-beta.4",
2222
"@vueuse/core": "^9.13.0",
23+
"@vueuse/integrations": "^9.13.0",
2324
"axios": "^1.3.4",
2425
"bootstrap-icons": "^1.10.3",
25-
"bootstrap-icons-vue": "^1.8.1",
2626
"color": "^4.2.3",
2727
"color-thief-ts": "^1.1.1",
2828
"graphql": "^16.5.0",
2929
"graphql-tag": "^2.12.6",
30-
"graphql-ws": "^5.11.2",
30+
"graphql-ws": "^5.12.0",
3131
"jwt-decode": "^3.1.2",
3232
"react": "^18.2.0",
3333
"socket.io-client": "^4.6.1",
@@ -37,18 +37,18 @@
3737
"yandex-metrika-vue3": "^1.1.6"
3838
},
3939
"devDependencies": {
40-
"@antfu/eslint-config": "^0.35.3",
40+
"@antfu/eslint-config": "^0.36.0",
4141
"@types/color": "^3.0.3",
42-
"@types/node": "^18.14.2",
42+
"@types/node": "^18.15.0",
4343
"@vitejs/plugin-vue": "^4.0.0",
4444
"@vitest/coverage-c8": "^0.29.2",
45-
"@vue/test-utils": "^2.3.0",
45+
"@vue/test-utils": "^2.3.1",
4646
"concurrently": "^7.6.0",
4747
"cross-env": "^7.0.3",
48-
"electron": "^23.1.1",
48+
"electron": "^23.1.3",
4949
"electron-builder": "^23.6.0",
50-
"eslint": "^8.35.0",
51-
"sass": "^1.58.3",
50+
"eslint": "^8.36.0",
51+
"sass": "^1.59.2",
5252
"sass-loader": "^13.0.1",
5353
"ts-node": "^10.9.1",
5454
"typescript": "~4.9.5",

schema.gql

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -56,8 +56,8 @@ type Query {
5656
me: UserObject!
5757
myPlaylist(playlistId: String!): PlaylistObject!
5858
myPlaylists(search: String): [PlaylistObject!]!
59-
myTracks(cursor: String, limit: Float = 50.0): TracksWithCursorObject!
60-
playlistTracks(cursor: String, limit: Float = 50.0, playlistId: String!): TracksWithCursorObject!
59+
myTracks(cursor: String, limit: Float, search: String): TracksWithCursorObject!
60+
playlistTracks(cursor: String, limit: Float, playlistId: String!): TracksWithCursorObject!
6161
publicPlaylist(playlistId: String!): PlaylistObject!
6262
publicPlaylists(search: String): [PlaylistObject!]!
6363
track(trackId: String!): TrackObject!

src/App.vue

Lines changed: 22 additions & 54 deletions
Original file line numberDiff line numberDiff line change
@@ -2,44 +2,39 @@
22
import {
33
breakpointsTailwind,
44
tryOnMounted,
5-
useBreakpoints, useLocalStorage,
6-
watchOnce,
5+
useBreakpoints,
6+
useLocalStorage,
77
whenever,
88
} from '@vueuse/core'
99
import { ref, watch } from 'vue'
1010
import { useRoute } from 'vue-router'
11-
import { useQueue } from '@/core/stores/queue'
1211
import { Platform, platform } from '@/shared/constants/platform'
1312
import TheTitleBar from '@/core/components/TheTitleBar.vue'
1413
import TheSideMenu from '@/core/components/TheSideMenu.vue'
1514
import ThePlayer from '@/player/components/ThePlayer.vue'
1615
import TheIntroLoader from '@/core/components/TheIntroLoader.vue'
17-
import TheQueue from '@/core/components/TheQueue.vue'
16+
import TheQueue from '@/queue/components/TheQueue.vue'
1817
import { useAuthentication } from '@/auth/stores/authentication'
1918
import { useOffline } from '@/core/stores/offline'
2019
import { useMetrika } from '@/core/hooks/metrika'
21-
import { useCurrentTrack } from '@/player/stores/current-track'
2220
import TheBottomMenu from '@/core/components/TheBottomMenu.vue'
2321
import { usePlayer } from '@/player/stores/player'
24-
import { useColors } from '@/core/stores/colors'
22+
import { useColors } from '@/themes/stores/colors'
23+
import { useUrlTrack } from '@/player/hooks/url-track'
2524
import { serializer } from '@/shared/utils/serializer'
25+
import { useCurrentTrack } from '@/player/stores/current-track'
2626
2727
const { greater } = useBreakpoints(breakpointsTailwind)
2828
const greaterSm = greater('sm')
2929
3030
useMetrika()
3131
useColors()
32-
33-
const { check } = useOffline()
34-
tryOnMounted(check)
32+
useCurrentTrack()
33+
useUrlTrack()
3534
3635
const { authenticated } = useAuthentication()
3736
const { loading } = useOffline()
3837
39-
const { queue } = useQueue()
40-
const { trackId } = useCurrentTrack()
41-
watchOnce(queue, () => (trackId.value = queue.value[0]?.id))
42-
4338
const { track } = usePlayer()
4439
4540
const menuShowed = ref(false)
@@ -134,7 +129,7 @@ tryOnMounted(() => {
134129
135130
.app-component {
136131
@include mixins.size(fill);
137-
flex: auto;
132+
flex: 1;
138133
display: flex;
139134
flex-direction: column;
140135
@@ -143,9 +138,9 @@ tryOnMounted(() => {
143138
}
144139
145140
.window {
146-
flex: auto;
147-
overflow: hidden;
141+
flex: 1;
148142
display: flex;
143+
overflow: hidden;
149144
150145
.body,
151146
.loader {
@@ -157,48 +152,36 @@ tryOnMounted(() => {
157152
}
158153
159154
.loader {
160-
flex: auto;
155+
flex: 1;
161156
}
162157
163158
.body {
164-
flex: auto;
159+
flex: 1;
165160
display: flex;
166-
gap: 10px;
167-
overflow: auto;
168161
background-color: rgb(constants.$clr-secondary);
169-
170-
.side-menu {
171-
flex: none;
172-
}
162+
overflow: hidden;
173163
174164
.main-section {
165+
flex: 1;
175166
display: flex;
176-
flex: auto;
177167
flex-direction: column;
178-
gap: 10px;
179168
overflow: hidden;
180169
181170
.page-container {
182-
padding: 0 20px;
183-
overflow: auto;
184-
flex: auto;
171+
flex: 1;
172+
display: flex;
173+
overflow: hidden;
185174
186175
.page {
187176
@include transitions.fade();
188-
189-
&.v-leave-active {
190-
transition: constants.$trn-fast-out;
191-
}
177+
flex: 1;
192178
}
193179
}
194180
195181
.player {
196-
margin-bottom: 10px;
182+
margin: 0 10px 10px 10px;
197183
}
198184
}
199-
200-
.queue {
201-
}
202185
}
203186
}
204187
}
@@ -211,31 +194,16 @@ tryOnMounted(() => {
211194
gap: 0;
212195
213196
.main-section {
214-
gap: 0;
215-
216197
.queue, .side-menu, .page-container {
217198
@include transitions.fade();
218-
219-
&.v-leave-active {
220-
transition: constants.$trn-fast-out;
221-
}
222199
}
223200
224201
.queue, .side-menu {
225202
margin: 10px;
226-
flex: auto;
203+
flex: 1;
227204
border-radius: constants.$cmn-border-radius;
228205
box-shadow: constants.$cmn-shadow-block;
229206
}
230-
231-
.player {
232-
flex: none;
233-
margin: 0 10px 10px;
234-
}
235-
}
236-
237-
.bottom-menu {
238-
flex: none;
239207
}
240208
}
241209
}
@@ -247,7 +215,7 @@ tryOnMounted(() => {
247215
@use 'shared/styles/mixins';
248216
249217
@import 'core/styles/globals';
250-
@import 'core/styles/fonts';
218+
@import 'core/styles/typography';
251219
252220
:root {
253221
--color-primary: 0, 0, 0;

src/auth/stores/authentication.ts

Lines changed: 9 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -39,11 +39,6 @@ export const useAuthentication = createSharedComposable(() => {
3939
})
4040
}
4141

42-
function reset() {
43-
refreshToken.value = undefined
44-
window.location.reload()
45-
}
46-
4742
function redirect() {
4843
const query = new URLSearchParams({
4944
redirect_url: location.origin,
@@ -65,13 +60,9 @@ export const useAuthentication = createSharedComposable(() => {
6560
const authenticationService = useAuthenticationService()
6661
async function rotate() {
6762
if (refreshToken.value) {
68-
const timeout = setTimeout(reset, 5000)
69-
7063
const { access_token, refresh_token }
7164
= await authenticationService.rotate(refreshToken.value)
7265

73-
clearTimeout(timeout)
74-
7566
accessToken.value = access_token
7667
refreshToken.value = refresh_token
7768

@@ -82,27 +73,28 @@ export const useAuthentication = createSharedComposable(() => {
8273
const route = useRoute()
8374
const router = useRouter()
8475

85-
function isUrlClaimable() {
86-
const params = new URLSearchParams(window.location.search)
87-
return params.has('access_token') && params.has('refresh_token')
76+
async function isUrlClaimable() {
77+
await router.isReady()
78+
return route.query.access_token && route.query.refresh_token
8879
}
8980

9081
const authenticated = computed(() => refreshToken.value || isUrlClaimable())
9182

9283
async function claimUrl() {
93-
const params = new URLSearchParams(window.location.search)
94-
accessToken.value = params.get('access_token')!
95-
refreshToken.value = params.get('refresh_token')
84+
await router.isReady()
85+
86+
accessToken.value = route.query.access_token as string
87+
refreshToken.value = route.query.refresh_token as string
9688

9789
await router.replace({
98-
query: omit(route.query, ['access_token', 'refresh_token']),
90+
query: omit(route.query, ['access_token', 'refresh_token', 'state']),
9991
})
10092

10193
schedule()
10294
}
10395

10496
async function login(): Promise<void> {
105-
if (isUrlClaimable())
97+
if (await isUrlClaimable())
10698
await claimUrl()
10799
else if (refreshToken.value)
108100
await rotate()
@@ -125,7 +117,6 @@ export const useAuthentication = createSharedComposable(() => {
125117
onLogout: readonly(onLogout),
126118

127119
getToken,
128-
reset,
129120
login,
130121
logout,
131122
}

src/core/components/TheBottomMenu.vue

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -56,9 +56,9 @@ const items: BottomMenuItem[] = [
5656
</template>
5757

5858
<style lang="scss" scoped>
59-
@use '../src/shared/styles/mixins';
60-
@use '../src/shared/styles/constants';
61-
@use '../src/shared/styles/transitions';
59+
@use '../../shared/styles/mixins';
60+
@use '../../shared/styles/constants';
61+
@use '../../shared/styles/transitions';
6262
6363
.bottom-menu-component {
6464
min-width: max-content;

src/core/components/TheIntroLoader.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
</template>
66

77
<style scoped lang="scss">
8-
@use 'src/shared/styles/mixins';
8+
@use '../../shared/styles/mixins';
99
1010
.intro-loader-component {
1111
--color-osu: #fa94b2;

src/core/components/TheQueue.vue

Lines changed: 0 additions & 15 deletions
This file was deleted.

0 commit comments

Comments
 (0)