@ozdao/martyrs 0.2.470 → 0.2.472
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{Media-CR0V1zvB.js → Media-DW8RLbfM.js} +1 -1
- package/dist/{Media-C4Ges_Sd.mjs → Media-y_TX6us_.mjs} +1 -1
- package/dist/_virtual/index.cjs +1 -1
- package/dist/_virtual/index.js +1 -1
- package/dist/auth.server.js +1 -1
- package/dist/auth.server.mjs +1 -1
- package/dist/chats.server.js +1 -1
- package/dist/chats.server.mjs +1 -1
- package/dist/community.server.js +1 -1
- package/dist/community.server.mjs +1 -1
- package/dist/events.server.js +1 -1
- package/dist/events.server.mjs +1 -1
- package/dist/files.server.js +1 -1
- package/dist/files.server.mjs +1 -1
- package/dist/gallery.server.js +1 -1
- package/dist/gallery.server.mjs +1 -1
- package/dist/{index-DQqZReAr.js → index-CVXl1rB5.js} +0 -1
- package/dist/{index-DICZTQ-1.mjs → index-Df8vtZx7.mjs} +0 -1
- package/dist/{main-CsZAG5Wz.js → main-CCfQH-Dd.js} +2 -2
- package/dist/{main-CTcal9qN.mjs → main-CgmHzhq5.mjs} +74 -74
- package/dist/{node_modules/.pnpm/@vue_server-renderer@3.5.13_vue@3.5.13_typescript@5.8.3_ → martyrs}/node_modules/@vue/server-renderer/dist/server-renderer.esm-bundler.cjs +1 -1
- package/dist/martyrs/node_modules/@vue/server-renderer/dist/server-renderer.esm-bundler.cjs.map +1 -0
- package/dist/{node_modules/.pnpm/@vue_server-renderer@3.5.13_vue@3.5.13_typescript@5.8.3_ → martyrs}/node_modules/@vue/server-renderer/dist/server-renderer.esm-bundler.js +1 -1
- package/dist/martyrs/node_modules/@vue/server-renderer/dist/server-renderer.esm-bundler.js.map +1 -0
- package/dist/martyrs/node_modules/@vue/shared/dist/shared.esm-bundler.cjs.map +1 -0
- package/dist/martyrs/node_modules/@vue/shared/dist/shared.esm-bundler.js.map +1 -0
- package/dist/martyrs/node_modules/uuid/dist/esm-browser/regex.cjs +5 -0
- package/dist/martyrs/node_modules/uuid/dist/esm-browser/regex.cjs.map +1 -0
- package/dist/martyrs/node_modules/uuid/dist/esm-browser/regex.js +5 -0
- package/dist/martyrs/node_modules/uuid/dist/esm-browser/regex.js.map +1 -0
- package/dist/{node_modules/.pnpm/uuid@11.1.0 → martyrs}/node_modules/uuid/dist/esm-browser/rng.cjs +4 -4
- package/dist/martyrs/node_modules/uuid/dist/esm-browser/rng.cjs.map +1 -0
- package/dist/martyrs/node_modules/uuid/dist/esm-browser/rng.js +15 -0
- package/dist/martyrs/node_modules/uuid/dist/esm-browser/rng.js.map +1 -0
- package/dist/martyrs/node_modules/uuid/dist/esm-browser/stringify.cjs +17 -0
- package/dist/martyrs/node_modules/uuid/dist/esm-browser/stringify.cjs.map +1 -0
- package/dist/martyrs/node_modules/uuid/dist/esm-browser/stringify.js +17 -0
- package/dist/martyrs/node_modules/uuid/dist/esm-browser/stringify.js.map +1 -0
- package/dist/martyrs/node_modules/uuid/dist/esm-browser/v4.cjs +13 -0
- package/dist/martyrs/node_modules/uuid/dist/esm-browser/v4.cjs.map +1 -0
- package/dist/martyrs/node_modules/uuid/dist/esm-browser/v4.js +13 -0
- package/dist/martyrs/node_modules/uuid/dist/esm-browser/v4.js.map +1 -0
- package/dist/martyrs/node_modules/uuid/dist/esm-browser/validate.cjs +8 -0
- package/dist/martyrs/node_modules/uuid/dist/esm-browser/validate.cjs.map +1 -0
- package/dist/martyrs/node_modules/uuid/dist/esm-browser/validate.js +8 -0
- package/dist/martyrs/node_modules/uuid/dist/esm-browser/validate.js.map +1 -0
- package/dist/martyrs/src/components/Feed/Feed.vue.cjs +2 -2
- package/dist/martyrs/src/components/Feed/Feed.vue.cjs.map +1 -1
- package/dist/martyrs/src/components/Feed/Feed.vue.js +2 -2
- package/dist/martyrs/src/components/Feed/Feed.vue.js.map +1 -1
- package/dist/martyrs/src/components/Menu/{Menu.vue.cjs → Menu.vue2.cjs} +2 -2
- package/dist/martyrs/src/components/Menu/Menu.vue2.cjs.map +1 -0
- package/dist/martyrs/src/components/Menu/{Menu.vue.js → Menu.vue2.js} +2 -2
- package/dist/martyrs/src/components/Menu/Menu.vue2.js.map +1 -0
- package/dist/martyrs/src/components/Skeleton/Skeleton.vue.cjs +5 -5
- package/dist/martyrs/src/components/Skeleton/Skeleton.vue.cjs.map +1 -1
- package/dist/martyrs/src/components/Skeleton/Skeleton.vue.js +5 -5
- package/dist/martyrs/src/components/Skeleton/Skeleton.vue.js.map +1 -1
- package/dist/martyrs/src/components/Tab/{Tab.vue2.cjs → Tab.vue.cjs} +2 -2
- package/dist/martyrs/src/components/Tab/{Tab.vue2.js.map → Tab.vue.cjs.map} +1 -1
- package/dist/martyrs/src/components/Tab/{Tab.vue2.js → Tab.vue.js} +2 -2
- package/dist/martyrs/src/components/Tab/Tab.vue.js.map +1 -0
- package/dist/martyrs/src/components/Tree/Tree.vue.cjs +3 -1
- package/dist/martyrs/src/components/Tree/Tree.vue.cjs.map +1 -1
- package/dist/martyrs/src/components/Tree/Tree.vue.js +3 -1
- package/dist/martyrs/src/components/Tree/Tree.vue.js.map +1 -1
- package/dist/martyrs/src/modules/auth/views/components/layouts/Auth.vue.cjs +1 -1
- package/dist/martyrs/src/modules/auth/views/components/layouts/Auth.vue.js +1 -1
- package/dist/martyrs/src/modules/auth/views/components/pages/EnterPassword.vue.cjs +1 -1
- package/dist/martyrs/src/modules/auth/views/components/pages/EnterPassword.vue.js +1 -1
- package/dist/martyrs/src/modules/auth/views/components/pages/Invite.vue.cjs +1 -1
- package/dist/martyrs/src/modules/auth/views/components/pages/Invite.vue.js +1 -1
- package/dist/martyrs/src/modules/auth/views/components/pages/Profile.vue.cjs +1 -1
- package/dist/martyrs/src/modules/auth/views/components/pages/Profile.vue.js +1 -1
- package/dist/martyrs/src/modules/auth/views/components/pages/ProfileBlogposts.vue.cjs +1 -1
- package/dist/martyrs/src/modules/auth/views/components/pages/ProfileBlogposts.vue.js +1 -1
- package/dist/martyrs/src/modules/auth/views/components/pages/ProfileEdit.vue.cjs +1 -1
- package/dist/martyrs/src/modules/auth/views/components/pages/ProfileEdit.vue.js +1 -1
- package/dist/martyrs/src/modules/auth/views/components/pages/ResetPassword.vue.cjs +1 -1
- package/dist/martyrs/src/modules/auth/views/components/pages/ResetPassword.vue.js +1 -1
- package/dist/martyrs/src/modules/auth/views/components/pages/SignIn.vue.cjs +1 -1
- package/dist/martyrs/src/modules/auth/views/components/pages/SignIn.vue.js +1 -1
- package/dist/martyrs/src/modules/auth/views/components/pages/SignUp.vue.cjs +1 -1
- package/dist/martyrs/src/modules/auth/views/components/pages/SignUp.vue.js +1 -1
- package/dist/martyrs/src/modules/auth/views/store/auth.cjs +1 -0
- package/dist/martyrs/src/modules/auth/views/store/auth.cjs.map +1 -1
- package/dist/martyrs/src/modules/auth/views/store/auth.js +1 -0
- package/dist/martyrs/src/modules/auth/views/store/auth.js.map +1 -1
- package/dist/martyrs/src/modules/constructor/components/sections/Constructor.vue.cjs +1 -1
- package/dist/martyrs/src/modules/constructor/components/sections/Constructor.vue.js +1 -1
- package/dist/martyrs/src/modules/events/components/pages/EventsBackoffice.vue.cjs +1 -1
- package/dist/martyrs/src/modules/events/components/pages/EventsBackoffice.vue.js +1 -1
- package/dist/martyrs/src/modules/globals/views/classes/globals.store.cjs +107 -21
- package/dist/martyrs/src/modules/globals/views/classes/globals.store.cjs.map +1 -1
- package/dist/martyrs/src/modules/globals/views/classes/globals.store.js +107 -21
- package/dist/martyrs/src/modules/globals/views/classes/globals.store.js.map +1 -1
- package/dist/martyrs/src/modules/globals/views/components/partials/Navigation.vue.cjs +10 -14
- package/dist/martyrs/src/modules/globals/views/components/partials/Navigation.vue.cjs.map +1 -1
- package/dist/martyrs/src/modules/globals/views/components/partials/Navigation.vue.js +12 -16
- package/dist/martyrs/src/modules/globals/views/components/partials/Navigation.vue.js.map +1 -1
- package/dist/martyrs/src/modules/globals/views/components/sections/SectionPageTitle.vue.cjs +1 -1
- package/dist/martyrs/src/modules/globals/views/components/sections/SectionPageTitle.vue.js +1 -1
- package/dist/martyrs/src/modules/globals/views/utils/vue-app-renderer.cjs +7 -13
- package/dist/martyrs/src/modules/globals/views/utils/vue-app-renderer.cjs.map +1 -1
- package/dist/martyrs/src/modules/globals/views/utils/vue-app-renderer.js +7 -13
- package/dist/martyrs/src/modules/globals/views/utils/vue-app-renderer.js.map +1 -1
- package/dist/martyrs/src/modules/orders/components/pages/OrderCreate.vue.cjs +6 -7
- package/dist/martyrs/src/modules/orders/components/pages/OrderCreate.vue.cjs.map +1 -1
- package/dist/martyrs/src/modules/orders/components/pages/OrderCreate.vue.js +7 -8
- package/dist/martyrs/src/modules/orders/components/pages/OrderCreate.vue.js.map +1 -1
- package/dist/martyrs/src/modules/orders/components/pages/OrderCreateBackoffice.vue.cjs +1 -1
- package/dist/martyrs/src/modules/orders/components/pages/OrderCreateBackoffice.vue.js +1 -1
- package/dist/martyrs/src/modules/orders/components/pages/Orders.vue.cjs +1 -1
- package/dist/martyrs/src/modules/orders/components/pages/Orders.vue.js +1 -1
- package/dist/martyrs/src/modules/organizations/components/pages/DepartmentEdit.vue.cjs +1 -1
- package/dist/martyrs/src/modules/organizations/components/pages/DepartmentEdit.vue.js +1 -1
- package/dist/martyrs/src/modules/organizations/components/pages/Members.vue.cjs +2 -2
- package/dist/martyrs/src/modules/organizations/components/pages/Members.vue.js +2 -2
- package/dist/martyrs/src/modules/organizations/components/pages/Organization.vue.cjs +2 -2
- package/dist/martyrs/src/modules/organizations/components/pages/Organization.vue.js +2 -2
- package/dist/martyrs/src/modules/organizations/components/pages/OrganizationBackoffice.vue.cjs +1 -1
- package/dist/martyrs/src/modules/organizations/components/pages/OrganizationBackoffice.vue.js +1 -1
- package/dist/martyrs/src/modules/organizations/components/pages/OrganizationEdit.vue.cjs +1 -1
- package/dist/martyrs/src/modules/organizations/components/pages/OrganizationEdit.vue.js +1 -1
- package/dist/martyrs/src/modules/organizations/components/pages/Organizations.vue.cjs +1 -1
- package/dist/martyrs/src/modules/organizations/components/pages/Organizations.vue.js +1 -1
- package/dist/martyrs/src/modules/organizations/components/sections/Organizations.vue.cjs +1 -1
- package/dist/martyrs/src/modules/organizations/components/sections/Organizations.vue.js +1 -1
- package/dist/martyrs/src/modules/products/components/blocks/CardCategory.vue.cjs +11 -5
- package/dist/martyrs/src/modules/products/components/blocks/CardCategory.vue.cjs.map +1 -1
- package/dist/martyrs/src/modules/products/components/blocks/CardCategory.vue.js +12 -6
- package/dist/martyrs/src/modules/products/components/blocks/CardCategory.vue.js.map +1 -1
- package/dist/martyrs/src/modules/products/components/pages/Categories.vue.cjs +34 -13
- package/dist/martyrs/src/modules/products/components/pages/Categories.vue.cjs.map +1 -1
- package/dist/martyrs/src/modules/products/components/pages/Categories.vue.js +35 -14
- package/dist/martyrs/src/modules/products/components/pages/Categories.vue.js.map +1 -1
- package/dist/martyrs/src/modules/products/components/pages/CategoryEdit.vue.cjs +20 -9
- package/dist/martyrs/src/modules/products/components/pages/CategoryEdit.vue.cjs.map +1 -1
- package/dist/martyrs/src/modules/products/components/pages/CategoryEdit.vue.js +21 -10
- package/dist/martyrs/src/modules/products/components/pages/CategoryEdit.vue.js.map +1 -1
- package/dist/martyrs/src/modules/products/components/pages/Leftovers.vue.cjs +1 -1
- package/dist/martyrs/src/modules/products/components/pages/Leftovers.vue.js +1 -1
- package/dist/martyrs/src/modules/products/components/pages/Product.vue.cjs +1 -1
- package/dist/martyrs/src/modules/products/components/pages/Product.vue.js +1 -1
- package/dist/martyrs/src/modules/products/components/pages/ProductEdit.vue.cjs +2 -1
- package/dist/martyrs/src/modules/products/components/pages/ProductEdit.vue.cjs.map +1 -1
- package/dist/martyrs/src/modules/products/components/pages/ProductEdit.vue.js +2 -1
- package/dist/martyrs/src/modules/products/components/pages/ProductEdit.vue.js.map +1 -1
- package/dist/martyrs/src/modules/products/components/pages/Products.vue.cjs +1 -1
- package/dist/martyrs/src/modules/products/components/pages/Products.vue.js +1 -1
- package/dist/martyrs/src/modules/products/components/sections/SectionProduct.vue.cjs +1 -1
- package/dist/martyrs/src/modules/products/components/sections/SectionProduct.vue.js +1 -1
- package/dist/martyrs/src/modules/rents/views/components/pages/GanttChart.vue.cjs +1 -1
- package/dist/martyrs/src/modules/rents/views/components/pages/GanttChart.vue.js +1 -1
- package/dist/martyrs/src/modules/rents/views/components/pages/Rents.vue.cjs +1 -1
- package/dist/martyrs/src/modules/rents/views/components/pages/Rents.vue.js +1 -1
- package/dist/martyrs/src/modules/spots/components/pages/SpotEdit.vue.cjs +1 -1
- package/dist/martyrs/src/modules/spots/components/pages/SpotEdit.vue.js +1 -1
- package/dist/martyrs.cjs.js +1 -1
- package/dist/martyrs.css +1 -1
- package/dist/martyrs.es.js +1 -1
- package/dist/notifications.server.js +35 -2
- package/dist/notifications.server.mjs +35 -2
- package/dist/orders.server.js +3 -3
- package/dist/orders.server.mjs +3 -3
- package/dist/organizations.server.js +1 -1
- package/dist/organizations.server.mjs +1 -1
- package/dist/products.server.js +78 -53
- package/dist/products.server.mjs +78 -53
- package/dist/rents.server.js +1 -1
- package/dist/rents.server.mjs +1 -1
- package/dist/style.css +37 -38
- package/dist/wallet.server.js +1 -1
- package/dist/wallet.server.mjs +1 -1
- package/package.json +2 -1
- package/src/components/Feed/Feed.vue +2 -7
- package/src/components/Skeleton/Skeleton.vue +4 -5
- package/src/components/Tree/Tree.vue +5 -2
- package/src/modules/auth/controllers/middlewares/authJwt.js +1 -1
- package/src/modules/auth/views/store/auth.js +2 -1
- package/src/modules/globals/controllers/classes/globals.crud.js +2 -2
- package/src/modules/globals/views/classes/globals.store.js +119 -31
- package/src/modules/globals/views/components/partials/Navigation.vue +11 -10
- package/src/modules/globals/views/utils/vue-app-renderer.js +7 -16
- package/src/modules/icons/entities/IconMusic.vue +14 -0
- package/src/modules/icons/navigation/IconCheck.vue +31 -0
- package/src/modules/icons/navigation/IconHeart.vue +26 -0
- package/src/modules/icons/navigation/IconPause.vue +31 -0
- package/src/modules/icons/navigation/IconPlay.vue +17 -0
- package/src/modules/icons/navigation/IconRefresh.vue +31 -0
- package/src/modules/icons/navigation/IconShuffle.vue +31 -0
- package/src/modules/icons/navigation/IconVolume.vue +31 -0
- package/src/modules/music/components/SidebarMusic.vue +156 -0
- package/src/modules/music/components/cards/AlbumCard.vue +107 -0
- package/src/modules/music/components/cards/ArtistCard.vue +37 -0
- package/src/modules/music/components/cards/PlaylistCard.vue +100 -0
- package/src/modules/music/components/cards/TrackCard.vue +86 -0
- package/src/modules/music/components/forms/PlaylistForm.vue +156 -0
- package/src/modules/music/components/forms/SearchForm.vue +82 -0
- package/src/modules/music/components/forms/UploadForm.vue +313 -0
- package/src/modules/music/components/layouts/MusicLayout.vue +137 -0
- package/src/modules/music/components/lists/AlbumList.vue +25 -0
- package/src/modules/music/components/lists/ArtistList.vue +25 -0
- package/src/modules/music/components/lists/PlaylistList.vue +25 -0
- package/src/modules/music/components/lists/TrackList.vue +175 -0
- package/src/modules/music/components/pages/AlbumDetail.vue +265 -0
- package/src/modules/music/components/pages/ArtistDetail.vue +247 -0
- package/src/modules/music/components/pages/MusicHome.vue +177 -0
- package/src/modules/music/components/pages/MusicLibrary.vue +192 -0
- package/src/modules/music/components/pages/MusicUpload.vue +44 -0
- package/src/modules/music/components/pages/PlaylistDetail.vue +504 -0
- package/src/modules/music/components/pages/SearchResults.vue +397 -0
- package/src/modules/music/components/pages/TrackDetail.vue +143 -0
- package/src/modules/music/components/player/MusicPlayer.vue +202 -0
- package/src/modules/music/components/player/TrackProgress.vue +110 -0
- package/src/modules/music/components/player/VolumeControl.vue +98 -0
- package/src/modules/music/controllers/album.controller.js +98 -0
- package/src/modules/music/controllers/artist.controller.js +111 -0
- package/src/modules/music/controllers/genre.controller.js +71 -0
- package/src/modules/music/controllers/music.controller.js +174 -0
- package/src/modules/music/controllers/playlist.controller.js +182 -0
- package/src/modules/music/controllers/search.controller.js +103 -0
- package/src/modules/music/controllers/stream.controller.js +106 -0
- package/src/modules/music/models/album.model.js +61 -0
- package/src/modules/music/models/artist.model.js +67 -0
- package/src/modules/music/models/genre.model.js +42 -0
- package/src/modules/music/models/play-history.model.js +51 -0
- package/src/modules/music/models/playlist.model.js +69 -0
- package/src/modules/music/models/track.model.js +94 -0
- package/src/modules/music/music.client.js +186 -0
- package/src/modules/music/music.server.js +114 -0
- package/src/modules/music/policies/music.policies.js +84 -0
- package/src/modules/music/router/music.js +77 -0
- package/src/modules/music/routes/album.routes.js +62 -0
- package/src/modules/music/routes/artist.routes.js +67 -0
- package/src/modules/music/routes/genre.routes.js +60 -0
- package/src/modules/music/routes/music.routes.js +145 -0
- package/src/modules/music/routes/playlist.routes.js +99 -0
- package/src/modules/music/routes/search.routes.js +10 -0
- package/src/modules/music/routes/stream.routes.js +38 -0
- package/src/modules/music/store/albums.js +200 -0
- package/src/modules/music/store/artists.js +180 -0
- package/src/modules/music/store/player.js +397 -0
- package/src/modules/music/store/playlists.js +211 -0
- package/src/modules/music/store/search.js +126 -0
- package/src/modules/music/store/tracks.js +230 -0
- package/src/modules/music/websocket/streaming.handler.js +151 -0
- package/src/modules/notifications/controllers/notifications.controller.js +44 -1
- package/src/modules/notifications/notifications.server.js +0 -1
- package/src/modules/notifications/routes/notifications.routes.js +3 -0
- package/src/modules/orders/components/pages/OrderCreate.vue +0 -2
- package/src/modules/products/components/blocks/CardCategory.vue +5 -4
- package/src/modules/products/components/pages/Categories.vue +38 -20
- package/src/modules/products/components/pages/CategoryEdit.vue +16 -7
- package/src/modules/products/components/pages/ProductEdit.vue +1 -0
- package/src/modules/products/controllers/categories.controller.js +155 -103
- package/dist/martyrs/src/components/Menu/Menu.vue.cjs.map +0 -1
- package/dist/martyrs/src/components/Menu/Menu.vue.js.map +0 -1
- package/dist/martyrs/src/components/Tab/Tab.vue2.cjs.map +0 -1
- package/dist/node_modules/.pnpm/@vue_server-renderer@3.5.13_vue@3.5.13_typescript@5.8.3_/node_modules/@vue/server-renderer/dist/server-renderer.esm-bundler.cjs.map +0 -1
- package/dist/node_modules/.pnpm/@vue_server-renderer@3.5.13_vue@3.5.13_typescript@5.8.3_/node_modules/@vue/server-renderer/dist/server-renderer.esm-bundler.js.map +0 -1
- package/dist/node_modules/.pnpm/@vue_shared@3.5.13/node_modules/@vue/shared/dist/shared.esm-bundler.cjs.map +0 -1
- package/dist/node_modules/.pnpm/@vue_shared@3.5.13/node_modules/@vue/shared/dist/shared.esm-bundler.js.map +0 -1
- package/dist/node_modules/.pnpm/uuid@11.1.0/node_modules/uuid/dist/esm-browser/native.cjs +0 -6
- package/dist/node_modules/.pnpm/uuid@11.1.0/node_modules/uuid/dist/esm-browser/native.cjs.map +0 -1
- package/dist/node_modules/.pnpm/uuid@11.1.0/node_modules/uuid/dist/esm-browser/native.js +0 -6
- package/dist/node_modules/.pnpm/uuid@11.1.0/node_modules/uuid/dist/esm-browser/native.js.map +0 -1
- package/dist/node_modules/.pnpm/uuid@11.1.0/node_modules/uuid/dist/esm-browser/rng.cjs.map +0 -1
- package/dist/node_modules/.pnpm/uuid@11.1.0/node_modules/uuid/dist/esm-browser/rng.js +0 -15
- package/dist/node_modules/.pnpm/uuid@11.1.0/node_modules/uuid/dist/esm-browser/rng.js.map +0 -1
- package/dist/node_modules/.pnpm/uuid@11.1.0/node_modules/uuid/dist/esm-browser/stringify.cjs +0 -11
- package/dist/node_modules/.pnpm/uuid@11.1.0/node_modules/uuid/dist/esm-browser/stringify.cjs.map +0 -1
- package/dist/node_modules/.pnpm/uuid@11.1.0/node_modules/uuid/dist/esm-browser/stringify.js +0 -11
- package/dist/node_modules/.pnpm/uuid@11.1.0/node_modules/uuid/dist/esm-browser/stringify.js.map +0 -1
- package/dist/node_modules/.pnpm/uuid@11.1.0/node_modules/uuid/dist/esm-browser/v4.cjs +0 -21
- package/dist/node_modules/.pnpm/uuid@11.1.0/node_modules/uuid/dist/esm-browser/v4.cjs.map +0 -1
- package/dist/node_modules/.pnpm/uuid@11.1.0/node_modules/uuid/dist/esm-browser/v4.js +0 -21
- package/dist/node_modules/.pnpm/uuid@11.1.0/node_modules/uuid/dist/esm-browser/v4.js.map +0 -1
- /package/dist/{node_modules/.pnpm/@vue_shared@3.5.13 → martyrs}/node_modules/@vue/shared/dist/shared.esm-bundler.cjs +0 -0
- /package/dist/{node_modules/.pnpm/@vue_shared@3.5.13 → martyrs}/node_modules/@vue/shared/dist/shared.esm-bundler.js +0 -0
- /package/dist/{node_modules → martyrs/node_modules}/fast-deep-equal/index.cjs +0 -0
- /package/dist/{node_modules → martyrs/node_modules}/fast-deep-equal/index.cjs.map +0 -0
- /package/dist/{node_modules → martyrs/node_modules}/fast-deep-equal/index.js +0 -0
- /package/dist/{node_modules → martyrs/node_modules}/fast-deep-equal/index.js.map +0 -0
|
@@ -0,0 +1,397 @@
|
|
|
1
|
+
// store/player.js
|
|
2
|
+
import { reactive } from 'vue';
|
|
3
|
+
import globalWebSocket from '@martyrs/src/modules/globals/views/classes/globals.websocket.js';
|
|
4
|
+
|
|
5
|
+
// State
|
|
6
|
+
export const state = reactive({
|
|
7
|
+
currentTrack: null,
|
|
8
|
+
queue: [],
|
|
9
|
+
isPlaying: false,
|
|
10
|
+
volume: 0.7,
|
|
11
|
+
muted: false,
|
|
12
|
+
currentTime: 0,
|
|
13
|
+
duration: 0,
|
|
14
|
+
repeat: 'none', // 'none', 'all', 'one'
|
|
15
|
+
shuffle: false,
|
|
16
|
+
initialQueue: [], // To keep original order when shuffle is toggled
|
|
17
|
+
audioElement: null,
|
|
18
|
+
audioContext: null,
|
|
19
|
+
listeningPartyId: null,
|
|
20
|
+
syncInProgress: false
|
|
21
|
+
});
|
|
22
|
+
|
|
23
|
+
// Actions
|
|
24
|
+
export const actions = {
|
|
25
|
+
initializeAudio() {
|
|
26
|
+
if (typeof window !== 'undefined') {
|
|
27
|
+
if (!state.audioElement) {
|
|
28
|
+
state.audioElement = new Audio();
|
|
29
|
+
state.audioElement.volume = state.volume;
|
|
30
|
+
|
|
31
|
+
// Set up audio context if available
|
|
32
|
+
try {
|
|
33
|
+
const AudioContext = window.AudioContext || window.webkitAudioContext;
|
|
34
|
+
if (AudioContext) {
|
|
35
|
+
state.audioContext = new AudioContext();
|
|
36
|
+
}
|
|
37
|
+
} catch (e) {
|
|
38
|
+
console.error('AudioContext not supported', e);
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
// Add event listeners
|
|
42
|
+
state.audioElement.addEventListener('timeupdate', () => {
|
|
43
|
+
state.currentTime = state.audioElement.currentTime;
|
|
44
|
+
|
|
45
|
+
// Sync playback with listening party every 5 seconds
|
|
46
|
+
if (state.listeningPartyId && !state.syncInProgress && state.isPlaying && state.currentTime % 5 < 0.1) {
|
|
47
|
+
this.syncPartyPlayback();
|
|
48
|
+
}
|
|
49
|
+
});
|
|
50
|
+
|
|
51
|
+
state.audioElement.addEventListener('loadedmetadata', () => {
|
|
52
|
+
state.duration = state.audioElement.duration;
|
|
53
|
+
});
|
|
54
|
+
|
|
55
|
+
state.audioElement.addEventListener('ended', () => {
|
|
56
|
+
this.playNext();
|
|
57
|
+
});
|
|
58
|
+
|
|
59
|
+
state.audioElement.addEventListener('play', () => {
|
|
60
|
+
state.isPlaying = true;
|
|
61
|
+
});
|
|
62
|
+
|
|
63
|
+
state.audioElement.addEventListener('pause', () => {
|
|
64
|
+
state.isPlaying = false;
|
|
65
|
+
});
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
},
|
|
69
|
+
|
|
70
|
+
async playTrack(track) {
|
|
71
|
+
if (!state.audioElement) {
|
|
72
|
+
this.initializeAudio();
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
// If track is already playing, just toggle play/pause
|
|
76
|
+
if (state.currentTrack && state.currentTrack._id === track._id) {
|
|
77
|
+
return this.togglePlay();
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
// Set the current track
|
|
81
|
+
state.currentTrack = track;
|
|
82
|
+
|
|
83
|
+
// Generate stream URL
|
|
84
|
+
const streamUrl = `${process.env.API_URL}/api/stream/${track._id}`;
|
|
85
|
+
|
|
86
|
+
// Set up audio element
|
|
87
|
+
state.audioElement.src = streamUrl;
|
|
88
|
+
state.audioElement.load();
|
|
89
|
+
const playPromise = state.audioElement.play();
|
|
90
|
+
|
|
91
|
+
// Handle autoplay restrictions
|
|
92
|
+
if (playPromise !== undefined) {
|
|
93
|
+
playPromise.catch(error => {
|
|
94
|
+
console.error('Autoplay prevented:', error);
|
|
95
|
+
state.isPlaying = false;
|
|
96
|
+
});
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
// Log play via WebSocket if connected
|
|
100
|
+
if (globalWebSocket.isSocketConnected()) {
|
|
101
|
+
globalWebSocket.send({
|
|
102
|
+
module: 'music-streaming',
|
|
103
|
+
action: 'startPlaying',
|
|
104
|
+
data: {
|
|
105
|
+
trackId: track._id,
|
|
106
|
+
from: 'player',
|
|
107
|
+
deviceInfo: navigator.userAgent
|
|
108
|
+
}
|
|
109
|
+
});
|
|
110
|
+
}
|
|
111
|
+
},
|
|
112
|
+
|
|
113
|
+
togglePlay() {
|
|
114
|
+
if (!state.currentTrack || !state.audioElement) return;
|
|
115
|
+
|
|
116
|
+
if (state.isPlaying) {
|
|
117
|
+
state.audioElement.pause();
|
|
118
|
+
} else {
|
|
119
|
+
state.audioElement.play().catch(error => {
|
|
120
|
+
console.error('Play failed:', error);
|
|
121
|
+
});
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
state.isPlaying = !state.isPlaying;
|
|
125
|
+
|
|
126
|
+
// Sync with listening party if active
|
|
127
|
+
if (state.listeningPartyId) {
|
|
128
|
+
this.syncPartyPlayback();
|
|
129
|
+
}
|
|
130
|
+
},
|
|
131
|
+
|
|
132
|
+
setVolume(volume) {
|
|
133
|
+
state.volume = volume;
|
|
134
|
+
if (state.audioElement) {
|
|
135
|
+
state.audioElement.volume = volume;
|
|
136
|
+
}
|
|
137
|
+
},
|
|
138
|
+
|
|
139
|
+
toggleMute() {
|
|
140
|
+
state.muted = !state.muted;
|
|
141
|
+
if (state.audioElement) {
|
|
142
|
+
state.audioElement.muted = state.muted;
|
|
143
|
+
}
|
|
144
|
+
},
|
|
145
|
+
|
|
146
|
+
seek(time) {
|
|
147
|
+
if (state.audioElement) {
|
|
148
|
+
state.audioElement.currentTime = time;
|
|
149
|
+
state.currentTime = time;
|
|
150
|
+
|
|
151
|
+
// Sync with listening party if active
|
|
152
|
+
if (state.listeningPartyId) {
|
|
153
|
+
this.syncPartyPlayback();
|
|
154
|
+
}
|
|
155
|
+
}
|
|
156
|
+
},
|
|
157
|
+
|
|
158
|
+
// Queue management
|
|
159
|
+
setQueue(tracks, startIndex = 0) {
|
|
160
|
+
state.queue = [...tracks];
|
|
161
|
+
state.initialQueue = [...tracks];
|
|
162
|
+
|
|
163
|
+
if (startIndex > 0 && startIndex < tracks.length) {
|
|
164
|
+
// Rearrange queue to start from the selected track
|
|
165
|
+
const tracksToPlay = state.queue.splice(startIndex);
|
|
166
|
+
state.queue = [...tracksToPlay, ...state.queue];
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
// If shuffle is on, randomize the queue except the first track
|
|
170
|
+
if (state.shuffle && state.queue.length > 1) {
|
|
171
|
+
const firstTrack = state.queue[0];
|
|
172
|
+
const remainingTracks = state.queue.slice(1);
|
|
173
|
+
this.shuffleArray(remainingTracks);
|
|
174
|
+
state.queue = [firstTrack, ...remainingTracks];
|
|
175
|
+
}
|
|
176
|
+
|
|
177
|
+
// Start playing the first track in queue
|
|
178
|
+
if (state.queue.length > 0) {
|
|
179
|
+
this.playTrack(state.queue[0]);
|
|
180
|
+
}
|
|
181
|
+
},
|
|
182
|
+
|
|
183
|
+
addToQueue(track) {
|
|
184
|
+
state.queue.push(track);
|
|
185
|
+
state.initialQueue.push(track);
|
|
186
|
+
|
|
187
|
+
// If nothing is playing, start this track
|
|
188
|
+
if (!state.currentTrack) {
|
|
189
|
+
this.playTrack(track);
|
|
190
|
+
}
|
|
191
|
+
},
|
|
192
|
+
|
|
193
|
+
removeFromQueue(index) {
|
|
194
|
+
if (index >= 0 && index < state.queue.length) {
|
|
195
|
+
state.queue.splice(index, 1);
|
|
196
|
+
}
|
|
197
|
+
},
|
|
198
|
+
|
|
199
|
+
clearQueue() {
|
|
200
|
+
state.queue = [];
|
|
201
|
+
state.initialQueue = [];
|
|
202
|
+
|
|
203
|
+
if (state.audioElement) {
|
|
204
|
+
state.audioElement.pause();
|
|
205
|
+
state.audioElement.src = '';
|
|
206
|
+
}
|
|
207
|
+
|
|
208
|
+
state.currentTrack = null;
|
|
209
|
+
state.isPlaying = false;
|
|
210
|
+
},
|
|
211
|
+
|
|
212
|
+
playNext() {
|
|
213
|
+
if (state.queue.length <= 1) {
|
|
214
|
+
// Only one track or empty queue
|
|
215
|
+
if (state.repeat === 'one' || state.repeat === 'all') {
|
|
216
|
+
// Replay the current track
|
|
217
|
+
this.seek(0);
|
|
218
|
+
state.audioElement.play().catch(e => console.error(e));
|
|
219
|
+
} else {
|
|
220
|
+
// Stop playback
|
|
221
|
+
state.isPlaying = false;
|
|
222
|
+
}
|
|
223
|
+
return;
|
|
224
|
+
}
|
|
225
|
+
|
|
226
|
+
if (state.repeat !== 'one') {
|
|
227
|
+
// Move to next track
|
|
228
|
+
state.queue.shift(); // Remove current track from queue
|
|
229
|
+
|
|
230
|
+
// If queue is empty after removing current track and repeat is on
|
|
231
|
+
if (state.queue.length === 0 && state.repeat === 'all') {
|
|
232
|
+
state.queue = [...state.initialQueue];
|
|
233
|
+
}
|
|
234
|
+
|
|
235
|
+
// Play the next track if available
|
|
236
|
+
if (state.queue.length > 0) {
|
|
237
|
+
this.playTrack(state.queue[0]);
|
|
238
|
+
} else {
|
|
239
|
+
state.currentTrack = null;
|
|
240
|
+
state.isPlaying = false;
|
|
241
|
+
}
|
|
242
|
+
} else {
|
|
243
|
+
// Repeat one - just seek to beginning
|
|
244
|
+
this.seek(0);
|
|
245
|
+
state.audioElement.play().catch(e => console.error(e));
|
|
246
|
+
}
|
|
247
|
+
},
|
|
248
|
+
|
|
249
|
+
playPrevious() {
|
|
250
|
+
// If we're more than 3 seconds into the track, restart it
|
|
251
|
+
if (state.currentTime > 3) {
|
|
252
|
+
this.seek(0);
|
|
253
|
+
return;
|
|
254
|
+
}
|
|
255
|
+
|
|
256
|
+
// Otherwise go to previous track if we have history
|
|
257
|
+
// Implementation depends on how track history is managed
|
|
258
|
+
// For simplicity, let's just go back to the beginning of the current track
|
|
259
|
+
this.seek(0);
|
|
260
|
+
},
|
|
261
|
+
|
|
262
|
+
toggleRepeat() {
|
|
263
|
+
// Cycle through repeat modes: none -> all -> one -> none...
|
|
264
|
+
if (state.repeat === 'none') {
|
|
265
|
+
state.repeat = 'all';
|
|
266
|
+
} else if (state.repeat === 'all') {
|
|
267
|
+
state.repeat = 'one';
|
|
268
|
+
} else {
|
|
269
|
+
state.repeat = 'none';
|
|
270
|
+
}
|
|
271
|
+
},
|
|
272
|
+
|
|
273
|
+
toggleShuffle() {
|
|
274
|
+
state.shuffle = !state.shuffle;
|
|
275
|
+
|
|
276
|
+
if (state.shuffle) {
|
|
277
|
+
// Save the current track
|
|
278
|
+
const currentTrack = state.queue[0];
|
|
279
|
+
|
|
280
|
+
// Shuffle the rest of the queue
|
|
281
|
+
const remainingTracks = state.queue.slice(1);
|
|
282
|
+
this.shuffleArray(remainingTracks);
|
|
283
|
+
|
|
284
|
+
// Reconstruct queue with current track at the front
|
|
285
|
+
state.queue = [currentTrack, ...remainingTracks];
|
|
286
|
+
} else {
|
|
287
|
+
// Restore original order but keep current track at front
|
|
288
|
+
if (state.currentTrack) {
|
|
289
|
+
const currentTrackIndex = state.initialQueue.findIndex(
|
|
290
|
+
track => track._id === state.currentTrack._id
|
|
291
|
+
);
|
|
292
|
+
|
|
293
|
+
if (currentTrackIndex !== -1) {
|
|
294
|
+
const tracksToPlay = state.initialQueue.slice(currentTrackIndex);
|
|
295
|
+
const previousTracks = state.initialQueue.slice(0, currentTrackIndex);
|
|
296
|
+
state.queue = [...tracksToPlay, ...previousTracks];
|
|
297
|
+
} else {
|
|
298
|
+
state.queue = [...state.initialQueue];
|
|
299
|
+
}
|
|
300
|
+
} else {
|
|
301
|
+
state.queue = [...state.initialQueue];
|
|
302
|
+
}
|
|
303
|
+
}
|
|
304
|
+
},
|
|
305
|
+
|
|
306
|
+
shuffleArray(array) {
|
|
307
|
+
for (let i = array.length - 1; i > 0; i--) {
|
|
308
|
+
const j = Math.floor(Math.random() * (i + 1));
|
|
309
|
+
[array[i], array[j]] = [array[j], array[i]];
|
|
310
|
+
}
|
|
311
|
+
return array;
|
|
312
|
+
},
|
|
313
|
+
|
|
314
|
+
// Listening party features
|
|
315
|
+
joinListeningParty(partyId) {
|
|
316
|
+
state.listeningPartyId = partyId;
|
|
317
|
+
|
|
318
|
+
if (globalWebSocket.isSocketConnected()) {
|
|
319
|
+
globalWebSocket.send({
|
|
320
|
+
module: 'music-streaming',
|
|
321
|
+
action: 'joinListeningParty',
|
|
322
|
+
data: { partyId }
|
|
323
|
+
});
|
|
324
|
+
|
|
325
|
+
// Set up event listener for party playback sync
|
|
326
|
+
globalWebSocket.addEventListener('partyPlaybackSync', this.handlePartySync.bind(this), {
|
|
327
|
+
module: 'music-streaming'
|
|
328
|
+
});
|
|
329
|
+
}
|
|
330
|
+
},
|
|
331
|
+
|
|
332
|
+
leaveListeningParty() {
|
|
333
|
+
state.listeningPartyId = null;
|
|
334
|
+
|
|
335
|
+
// Remove event listener for party sync
|
|
336
|
+
if (globalWebSocket.isSocketConnected()) {
|
|
337
|
+
globalWebSocket.removeEventListener('partyPlaybackSync');
|
|
338
|
+
}
|
|
339
|
+
},
|
|
340
|
+
|
|
341
|
+
syncPartyPlayback() {
|
|
342
|
+
if (!state.listeningPartyId || !state.currentTrack || !globalWebSocket.isSocketConnected()) {
|
|
343
|
+
return;
|
|
344
|
+
}
|
|
345
|
+
|
|
346
|
+
globalWebSocket.send({
|
|
347
|
+
module: 'music-streaming',
|
|
348
|
+
action: 'syncPartyPlayback',
|
|
349
|
+
data: {
|
|
350
|
+
trackId: state.currentTrack._id,
|
|
351
|
+
position: state.currentTime,
|
|
352
|
+
isPlaying: state.isPlaying
|
|
353
|
+
}
|
|
354
|
+
});
|
|
355
|
+
},
|
|
356
|
+
|
|
357
|
+
handlePartySync(data) {
|
|
358
|
+
if (!state.listeningPartyId) return;
|
|
359
|
+
|
|
360
|
+
state.syncInProgress = true;
|
|
361
|
+
|
|
362
|
+
// If different track is playing in the party
|
|
363
|
+
if (data.trackId !== (state.currentTrack?._id)) {
|
|
364
|
+
// Find track in queue or load it
|
|
365
|
+
const trackInQueue = state.queue.find(track => track._id === data.trackId);
|
|
366
|
+
|
|
367
|
+
if (trackInQueue) {
|
|
368
|
+
this.playTrack(trackInQueue);
|
|
369
|
+
} else {
|
|
370
|
+
// Need to fetch the track from the API
|
|
371
|
+
fetch(`${process.env.API_URL}/api/tracks/${data.trackId}`)
|
|
372
|
+
.then(response => response.json())
|
|
373
|
+
.then(track => {
|
|
374
|
+
this.playTrack(track);
|
|
375
|
+
})
|
|
376
|
+
.catch(error => {
|
|
377
|
+
console.error('Error fetching party track:', error);
|
|
378
|
+
});
|
|
379
|
+
}
|
|
380
|
+
}
|
|
381
|
+
|
|
382
|
+
// Sync playback position with some tolerance (2 seconds)
|
|
383
|
+
if (Math.abs(state.currentTime - data.position) > 2) {
|
|
384
|
+
this.seek(data.position);
|
|
385
|
+
}
|
|
386
|
+
|
|
387
|
+
// Sync play/pause state
|
|
388
|
+
if (state.isPlaying !== data.isPlaying) {
|
|
389
|
+
this.togglePlay();
|
|
390
|
+
}
|
|
391
|
+
|
|
392
|
+
// Reset sync flag after a short delay
|
|
393
|
+
setTimeout(() => {
|
|
394
|
+
state.syncInProgress = false;
|
|
395
|
+
}, 1000);
|
|
396
|
+
}
|
|
397
|
+
};
|
|
@@ -0,0 +1,211 @@
|
|
|
1
|
+
// store/playlists.js
|
|
2
|
+
import { reactive } from 'vue';
|
|
3
|
+
import Store from '@martyrs/src/modules/globals/views/classes/globals.store';
|
|
4
|
+
|
|
5
|
+
// Create store instance
|
|
6
|
+
const playlistStore = new Store(`${process.env.API_URL}/api/playlists`);
|
|
7
|
+
|
|
8
|
+
// State
|
|
9
|
+
export const state = reactive({
|
|
10
|
+
playlists: [],
|
|
11
|
+
featuredPlaylists: [],
|
|
12
|
+
userPlaylists: [],
|
|
13
|
+
currentPlaylist: null,
|
|
14
|
+
currentPlaylistTracks: [],
|
|
15
|
+
isLoading: false,
|
|
16
|
+
loadingFeatured: false
|
|
17
|
+
});
|
|
18
|
+
|
|
19
|
+
// Actions
|
|
20
|
+
export const actions = {
|
|
21
|
+
async fetchPlaylists(options = {}) {
|
|
22
|
+
state.isLoading = true;
|
|
23
|
+
try {
|
|
24
|
+
const playlists = await playlistStore.read(options);
|
|
25
|
+
state.playlists = playlists;
|
|
26
|
+
return playlists;
|
|
27
|
+
} catch (error) {
|
|
28
|
+
console.error('Error fetching playlists:', error);
|
|
29
|
+
return [];
|
|
30
|
+
} finally {
|
|
31
|
+
state.isLoading = false;
|
|
32
|
+
}
|
|
33
|
+
},
|
|
34
|
+
|
|
35
|
+
async fetchFeaturedPlaylists(limit = 10) {
|
|
36
|
+
state.loadingFeatured = true;
|
|
37
|
+
try {
|
|
38
|
+
// Assuming there's a status field for featured playlists
|
|
39
|
+
const options = {
|
|
40
|
+
status: 'featured',
|
|
41
|
+
isPublic: true,
|
|
42
|
+
limit
|
|
43
|
+
};
|
|
44
|
+
|
|
45
|
+
const playlists = await playlistStore.read(options);
|
|
46
|
+
state.featuredPlaylists = playlists;
|
|
47
|
+
return playlists;
|
|
48
|
+
} catch (error) {
|
|
49
|
+
console.error('Error fetching featured playlists:', error);
|
|
50
|
+
return [];
|
|
51
|
+
} finally {
|
|
52
|
+
state.loadingFeatured = false;
|
|
53
|
+
}
|
|
54
|
+
},
|
|
55
|
+
|
|
56
|
+
async fetchPlaylistByUrl(url) {
|
|
57
|
+
try {
|
|
58
|
+
const response = await fetch(`${process.env.API_URL}/api/playlists/url/${url}`);
|
|
59
|
+
const playlist = await response.json();
|
|
60
|
+
state.currentPlaylist = playlist;
|
|
61
|
+
|
|
62
|
+
// Extract tracks from the playlist
|
|
63
|
+
state.currentPlaylistTracks = playlist.tracks?.map(item => item.track) || [];
|
|
64
|
+
|
|
65
|
+
return playlist;
|
|
66
|
+
} catch (error) {
|
|
67
|
+
console.error('Error fetching playlist by URL:', error);
|
|
68
|
+
return null;
|
|
69
|
+
}
|
|
70
|
+
},
|
|
71
|
+
|
|
72
|
+
async createPlaylist(playlistData) {
|
|
73
|
+
try {
|
|
74
|
+
const createdPlaylist = await playlistStore.create(playlistData);
|
|
75
|
+
// Update local state
|
|
76
|
+
state.playlists.unshift(createdPlaylist);
|
|
77
|
+
state.userPlaylists.unshift(createdPlaylist);
|
|
78
|
+
return createdPlaylist;
|
|
79
|
+
} catch (error) {
|
|
80
|
+
console.error('Error creating playlist:', error);
|
|
81
|
+
throw error;
|
|
82
|
+
}
|
|
83
|
+
},
|
|
84
|
+
|
|
85
|
+
async updatePlaylist(playlistData) {
|
|
86
|
+
try {
|
|
87
|
+
const updatedPlaylist = await playlistStore.update(playlistData);
|
|
88
|
+
|
|
89
|
+
// Update local state
|
|
90
|
+
const index = state.playlists.findIndex(p => p._id === updatedPlaylist._id);
|
|
91
|
+
if (index !== -1) {
|
|
92
|
+
state.playlists[index] = updatedPlaylist;
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
const userIndex = state.userPlaylists.findIndex(p => p._id === updatedPlaylist._id);
|
|
96
|
+
if (userIndex !== -1) {
|
|
97
|
+
state.userPlaylists[userIndex] = updatedPlaylist;
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
if (state.currentPlaylist && state.currentPlaylist._id === updatedPlaylist._id) {
|
|
101
|
+
state.currentPlaylist = updatedPlaylist;
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
return updatedPlaylist;
|
|
105
|
+
} catch (error) {
|
|
106
|
+
console.error('Error updating playlist:', error);
|
|
107
|
+
throw error;
|
|
108
|
+
}
|
|
109
|
+
},
|
|
110
|
+
|
|
111
|
+
async deletePlaylist(playlistId) {
|
|
112
|
+
try {
|
|
113
|
+
await playlistStore.delete({ _id: playlistId });
|
|
114
|
+
|
|
115
|
+
// Update local state
|
|
116
|
+
state.playlists = state.playlists.filter(p => p._id !== playlistId);
|
|
117
|
+
state.userPlaylists = state.userPlaylists.filter(p => p._id !== playlistId);
|
|
118
|
+
|
|
119
|
+
if (state.currentPlaylist && state.currentPlaylist._id === playlistId) {
|
|
120
|
+
state.currentPlaylist = null;
|
|
121
|
+
state.currentPlaylistTracks = [];
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
return true;
|
|
125
|
+
} catch (error) {
|
|
126
|
+
console.error('Error deleting playlist:', error);
|
|
127
|
+
throw error;
|
|
128
|
+
}
|
|
129
|
+
},
|
|
130
|
+
|
|
131
|
+
async fetchUserPlaylists(userId) {
|
|
132
|
+
try {
|
|
133
|
+
const response = await fetch(`${process.env.API_URL}/api/playlists/user/${userId || ''}`);
|
|
134
|
+
const playlists = await response.json();
|
|
135
|
+
state.userPlaylists = playlists;
|
|
136
|
+
return playlists;
|
|
137
|
+
} catch (error) {
|
|
138
|
+
console.error('Error fetching user playlists:', error);
|
|
139
|
+
return [];
|
|
140
|
+
}
|
|
141
|
+
},
|
|
142
|
+
|
|
143
|
+
async addTrackToPlaylist(playlistId, trackId) {
|
|
144
|
+
try {
|
|
145
|
+
const response = await fetch(`${process.env.API_URL}/api/playlists/${playlistId}/tracks/${trackId}`, {
|
|
146
|
+
method: 'POST',
|
|
147
|
+
headers: {
|
|
148
|
+
'Content-Type': 'application/json'
|
|
149
|
+
}
|
|
150
|
+
});
|
|
151
|
+
|
|
152
|
+
const updatedPlaylist = await response.json();
|
|
153
|
+
|
|
154
|
+
// Update local state
|
|
155
|
+
if (state.currentPlaylist && state.currentPlaylist._id === playlistId) {
|
|
156
|
+
state.currentPlaylist = updatedPlaylist;
|
|
157
|
+
// Update tracks list
|
|
158
|
+
const track = updatedPlaylist.tracks.find(item => item.track._id === trackId)?.track;
|
|
159
|
+
if (track && !state.currentPlaylistTracks.some(t => t._id === trackId)) {
|
|
160
|
+
state.currentPlaylistTracks.push(track);
|
|
161
|
+
}
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
return updatedPlaylist;
|
|
165
|
+
} catch (error) {
|
|
166
|
+
console.error('Error adding track to playlist:', error);
|
|
167
|
+
throw error;
|
|
168
|
+
}
|
|
169
|
+
},
|
|
170
|
+
|
|
171
|
+
async removeTrackFromPlaylist(playlistId, trackId) {
|
|
172
|
+
try {
|
|
173
|
+
const response = await fetch(`${process.env.API_URL}/api/playlists/${playlistId}/tracks/${trackId}`, {
|
|
174
|
+
method: 'DELETE'
|
|
175
|
+
});
|
|
176
|
+
|
|
177
|
+
const updatedPlaylist = await response.json();
|
|
178
|
+
|
|
179
|
+
// Update local state
|
|
180
|
+
if (state.currentPlaylist && state.currentPlaylist._id === playlistId) {
|
|
181
|
+
state.currentPlaylist = updatedPlaylist;
|
|
182
|
+
state.currentPlaylistTracks = state.currentPlaylistTracks.filter(track => track._id !== trackId);
|
|
183
|
+
}
|
|
184
|
+
|
|
185
|
+
return updatedPlaylist;
|
|
186
|
+
} catch (error) {
|
|
187
|
+
console.error('Error removing track from playlist:', error);
|
|
188
|
+
throw error;
|
|
189
|
+
}
|
|
190
|
+
},
|
|
191
|
+
|
|
192
|
+
async addCollaborator(playlistId, userId) {
|
|
193
|
+
try {
|
|
194
|
+
const response = await fetch(`${process.env.API_URL}/api/playlists/${playlistId}/collaborators/${userId}`, {
|
|
195
|
+
method: 'POST'
|
|
196
|
+
});
|
|
197
|
+
|
|
198
|
+
const updatedPlaylist = await response.json();
|
|
199
|
+
|
|
200
|
+
// Update local state
|
|
201
|
+
if (state.currentPlaylist && state.currentPlaylist._id === playlistId) {
|
|
202
|
+
state.currentPlaylist = updatedPlaylist;
|
|
203
|
+
}
|
|
204
|
+
|
|
205
|
+
return updatedPlaylist;
|
|
206
|
+
} catch (error) {
|
|
207
|
+
console.error('Error adding collaborator to playlist:', error);
|
|
208
|
+
throw error;
|
|
209
|
+
}
|
|
210
|
+
}
|
|
211
|
+
};
|