diff --git a/lib/Controller/StationApiController.php b/lib/Controller/StationApiController.php index d5c176c..56e81ae 100644 --- a/lib/Controller/StationApiController.php +++ b/lib/Controller/StationApiController.php @@ -50,9 +50,9 @@ class StationApiController extends ApiController { * @NoCSRFRequired * @NoAdminRequired */ - public function create(string $stationuuid, string $name, string $favicon, string $url_resolved): DataResponse { + public function create(string $stationuuid, string $name, string $favicon, string $urlresolved): DataResponse { return new DataResponse($this->service->create($stationuuid, $name, - $favicon, $url_resolved, $this->userId)); + $favicon, $urlresolved, $this->userId)); } /** @@ -62,8 +62,8 @@ class StationApiController extends ApiController { */ public function update(int $id, string $title, string $content): DataResponse { - return $this->handleNotFound(function () use ($id, $stationuuid, $name, $favicon, $url_resolved) { - return $this->service->update($id, $stationuuid, $name, $favicon, $url_resolved, $this->userId); + return $this->handleNotFound(function () use ($id, $stationuuid, $name, $favicon, $urlresolved) { + return $this->service->update($id, $stationuuid, $name, $favicon, $urlresolved, $this->userId); }); } diff --git a/lib/Controller/StationController.php b/lib/Controller/StationController.php index 21960dd..fa28069 100644 --- a/lib/Controller/StationController.php +++ b/lib/Controller/StationController.php @@ -42,18 +42,18 @@ class StationController extends Controller { /** * @NoAdminRequired */ - public function create(string $stationuuid, string $name, string $favicon, string $url_resolved): DataResponse { + public function create(string $stationuuid, string $name, string $favicon, string $urlresolved = "lol"): DataResponse { return new DataResponse($this->service->create($stationuuid, $name, - $favicon, $url_resolved, $this->userId)); + $favicon, $urlresolved, $this->userId)); } /** * @NoAdminRequired */ public function update(int $id, string $stationuuid, - string $name, string $favicon, string $url_resolved): DataResponse { - return $this->handleNotFound(function () use ($id, $stationuuid, $name, $favicon, $url_resolved) { - return $this->service->update($id, $stationuuid, $name, $favicon, $url_resolved, $this->userId); + string $name, string $favicon, string $urlresolved): DataResponse { + return $this->handleNotFound(function () use ($id, $stationuuid, $name, $favicon, $urlresolved) { + return $this->service->update($id, $stationuuid, $name, $favicon, $urlresolved, $this->userId); }); } diff --git a/lib/Db/Station.php b/lib/Db/Station.php index d3620e0..506dfd0 100644 --- a/lib/Db/Station.php +++ b/lib/Db/Station.php @@ -10,7 +10,7 @@ class Station extends Entity implements JsonSerializable { protected $stationuuid; protected $name; protected $favicon; - protected $url_resolved; + protected $urlresolved; protected $userId; public function jsonSerialize(): array { @@ -19,7 +19,7 @@ class Station extends Entity implements JsonSerializable { 'stationuuid' => $this->stationuuid, 'name' => $this->name, 'favicon' => $this->favicon, - 'url_resolved' => $this->url_resolved + 'url_resolved' => $this->urlresolved ]; } } diff --git a/lib/Migration/Version000000Date20181013124731.php b/lib/Migration/Version000000Date20181013124731.php index b71988a..2072016 100644 --- a/lib/Migration/Version000000Date20181013124731.php +++ b/lib/Migration/Version000000Date20181013124731.php @@ -29,24 +29,15 @@ class Version000000Date20181013124731 extends SimpleMigrationStep { ]); $table->addColumn('stationuuid', 'string', [ 'notnull' => true, - 'length' => 200, ]); $table->addColumn('user_id', 'string', [ 'notnull' => true, - 'length' => 200, ]); $table->addColumn('name', 'text', [ 'notnull' => true, - 'length' => 200, - ]); - $table->addColumn('favicon', 'text', [ - 'notnull' => true, - 'length' => 200, - ]); - $table->addColumn('url_resolved', 'text', [ - 'notnull' => true, - 'length' => 200, ]); + $table->addColumn('favicon', 'text'); + $table->addColumn('urlresolved', 'text'); $table->setPrimaryKey(['id']); $table->addIndex(['user_id'], 'radio_user_id_index'); diff --git a/lib/Service/StationService.php b/lib/Service/StationService.php index 7cfdb72..15b1947 100644 --- a/lib/Service/StationService.php +++ b/lib/Service/StationService.php @@ -45,23 +45,23 @@ class StationService { } } - public function create($stationuuid, $name, $favicon, $url_resolved, $userId) { + public function create($stationuuid, $name, $favicon, $urlresolved, $userId) { $station = new Station(); $station->setStationuuid($stationuuid); $station->setName($name); $station->setFavicon($favicon); - $station->setUrl_resolved($url_resolved); + $station->setUrlresolved($urlresolved); $station->setUserId($userId); return $this->mapper->insert($station); } - public function update($id, $stationuuid, $name, $userId) { + public function update($id, $stationuuid, $name, $favicon, $urlresolved, $userId) { try { $station = $this->mapper->find($id, $userId); $station->setStationuuid($stationuuid); $station->setName($name); $station->setFavicon($favicon); - $station->setUrl_resolved($url_resolved); + $station->setUrlresolved($urlresolved); return $this->mapper->update($station); } catch (Exception $e) { $this->handleException($e); diff --git a/package-lock.json b/package-lock.json index 51792ab..42d6616 100644 --- a/package-lock.json +++ b/package-lock.json @@ -7179,11 +7179,6 @@ "integrity": "sha1-R+Y/evVa+m+S4VAOaQ64uFKcCZo=", "dev": true }, - "jquery": { - "version": "3.5.1", - "resolved": "https://registry.npmjs.org/jquery/-/jquery-3.5.1.tgz", - "integrity": "sha512-XwIBPqcMn57FxfT+Go5pzySnm4KWkT1Tv7gjrpT1srtf8Weynl6R273VJ5GjkRb51IzMp5nbaPjJXMWeju2MKg==" - }, "js-base64": { "version": "2.6.2", "resolved": "https://registry.npmjs.org/js-base64/-/js-base64-2.6.2.tgz", diff --git a/package.json b/package.json index e73520f..ef69d8f 100644 --- a/package.json +++ b/package.json @@ -36,7 +36,6 @@ "@nextcloud/router": "^1.2.0", "@nextcloud/vue": "^2.7.0", "howler": "^2.2.1", - "jquery": "^3.5.1", "music-metadata": "^7.4.1", "vue": "^2.6.12", "vue-blurhash": "^0.1.2", diff --git a/src/components/Main.vue b/src/components/Main.vue index a5b9258..129e47e 100644 --- a/src/components/Main.vue +++ b/src/components/Main.vue @@ -52,6 +52,7 @@ export default { offset: 0, pageLoading: false, blurHashes: require('../assets/blurHashes.json'), + favorites: null, }), computed: { player() { @@ -75,6 +76,7 @@ export default { }, created() { this.loadSettings() + this.loadFavorites() }, mounted() { this.onRoute() @@ -106,6 +108,7 @@ export default { * @param {Object} station Station object */ doPlay(station) { + const vm = this if (audioPlayer !== null) { audioPlayer.fade(vm.player.volume, 0, 500) @@ -168,6 +171,8 @@ export default { if (menuState === 'SEARCH') { const searchQuery = vm.$route.params.query queryURI = queryBase + '/byname/' + searchQuery + } else if (menuState === 'FAVORITES') { + queryURI = generateUrl('/apps/radio/stations') } await axios.get(queryURI, { @@ -205,6 +210,12 @@ export default { loadSettings() { this.$store.dispatch('getVolumeState') }, + async loadFavorites() { + await axios.get(generateUrl('/apps/radio/stations')) + .then(function(response) { + this.favorites = response.data + }) + }, }, }