fix settingscontroller bug, add more props to db backend
This commit is contained in:
parent
ff3a745441
commit
05d6634d0c
@ -44,20 +44,29 @@ class FavoriteController extends Controller {
|
|||||||
/**
|
/**
|
||||||
* @NoAdminRequired
|
* @NoAdminRequired
|
||||||
*/
|
*/
|
||||||
public function create(string $stationuuid, string $name, string $favicon, string $urlresolved): DataResponse {
|
public function create(string $stationuuid, string $name, string $favicon, string $urlresolved,
|
||||||
return new DataResponse($this->service->create($stationuuid, $name,
|
string $bitrate, string $country, string $language, string $homepage,
|
||||||
$favicon, $urlresolved, $this->userId));
|
string $codec, string $tags): DataResponse {
|
||||||
}
|
return new DataResponse($this->service->create($stationuuid, $name,
|
||||||
|
$favicon, $urlresolved, $bitrate, $country, $language, $homepage, $codec,
|
||||||
|
$tags, $this->userId));
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @NoAdminRequired
|
* @NoAdminRequired
|
||||||
*/
|
*/
|
||||||
public function update(int $id, string $stationuuid,
|
public function update(int $id, string $stationuuid,
|
||||||
string $name, string $favicon, string $urlresolved): DataResponse {
|
string $name, string $favicon, string $urlresolved,
|
||||||
return $this->handleNotFound(function () use ($id, $stationuuid, $name, $favicon, $urlresolved) {
|
string $bitrate, string $country, string $language, string $homepage,
|
||||||
return $this->service->update($id, $stationuuid, $name, $favicon, $urlresolved, $this->userId);
|
string $codec, string $tags): DataResponse {
|
||||||
});
|
return $this->handleNotFound(function () use ($id, $stationuuid, $name,
|
||||||
}
|
$favicon, $urlresolved, $bitrate, $country, $language, $homepage, $codec,
|
||||||
|
$tags) {
|
||||||
|
return $this->service->update($id, $stationuuid, $name, $favicon,
|
||||||
|
$urlresolved, $bitrate, $country, $language, $homepage, $codec,
|
||||||
|
$tags, $this->userId);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @NoAdminRequired
|
* @NoAdminRequired
|
||||||
|
@ -44,18 +44,26 @@ class RecentController extends Controller {
|
|||||||
/**
|
/**
|
||||||
* @NoAdminRequired
|
* @NoAdminRequired
|
||||||
*/
|
*/
|
||||||
public function create(string $stationuuid, string $name, string $favicon, string $urlresolved): DataResponse {
|
public function create(string $stationuuid, string $name, string $favicon, string $urlresolved,
|
||||||
|
string $bitrate, string $country, string $language, string $homepage,
|
||||||
|
string $codec, string $tags): DataResponse {
|
||||||
return new DataResponse($this->service->create($stationuuid, $name,
|
return new DataResponse($this->service->create($stationuuid, $name,
|
||||||
$favicon, $urlresolved, $this->userId));
|
$favicon, $urlresolved, $bitrate, $country, $language, $homepage, $codec,
|
||||||
|
$tags, $this->userId));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @NoAdminRequired
|
* @NoAdminRequired
|
||||||
*/
|
*/
|
||||||
public function update(int $id, string $stationuuid,
|
public function update(int $id, string $stationuuid, string $name,
|
||||||
string $name, string $favicon, string $urlresolved): DataResponse {
|
string $favicon, string $urlresolved, string $bitrate, string $country,
|
||||||
return $this->handleNotFound(function () use ($id, $stationuuid, $name, $favicon, $urlresolved) {
|
string $language, string $homepage, string $codec, string $tags): DataResponse {
|
||||||
return $this->service->update($id, $stationuuid, $name, $favicon, $urlresolved, $this->userId);
|
return $this->handleNotFound(function () use ($id, $stationuuid, $name,
|
||||||
|
$favicon, $urlresolved, $bitrate, $country, $language, $homepage, $codec,
|
||||||
|
$tags) {
|
||||||
|
return $this->service->update($id, $stationuuid, $name, $favicon,
|
||||||
|
$urlresolved, $bitrate, $country, $language, $homepage, $codec,
|
||||||
|
$tags, $this->userId);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -79,7 +79,7 @@ class SettingsController extends ApiController {
|
|||||||
*/
|
*/
|
||||||
public function setMenuState($menuState = ""): JSONResponse {
|
public function setMenuState($menuState = ""): JSONResponse {
|
||||||
if ($menuState == 'SEARCH') {
|
if ($menuState == 'SEARCH') {
|
||||||
return true;
|
return new JSONResponse(['status' => 'success'], Http::STATUS_OK);
|
||||||
};
|
};
|
||||||
$legalArguments = ['TOP', 'RECENT', 'NEW', 'FAVORITES', 'CATEGORIES'];
|
$legalArguments = ['TOP', 'RECENT', 'NEW', 'FAVORITES', 'CATEGORIES'];
|
||||||
if (!in_array($menuState, $legalArguments)) {
|
if (!in_array($menuState, $legalArguments)) {
|
||||||
|
@ -27,6 +27,12 @@ class RecentMapper extends QBMapper {
|
|||||||
->addSelect('name')
|
->addSelect('name')
|
||||||
->addSelect('favicon')
|
->addSelect('favicon')
|
||||||
->addSelect('urlresolved')
|
->addSelect('urlresolved')
|
||||||
|
->addSelect('bitrate')
|
||||||
|
->addSelect('country')
|
||||||
|
->addSelect('language')
|
||||||
|
->addSelect('homepage')
|
||||||
|
->addSelect('codec')
|
||||||
|
->addSelect('tags')
|
||||||
->from('recent')
|
->from('recent')
|
||||||
->orderBy('id', 'DESC')
|
->orderBy('id', 'DESC')
|
||||||
->where($qb->expr()->eq('id', $qb->createNamedParameter($id, IQueryBuilder::PARAM_INT)))
|
->where($qb->expr()->eq('id', $qb->createNamedParameter($id, IQueryBuilder::PARAM_INT)))
|
||||||
@ -45,6 +51,12 @@ class RecentMapper extends QBMapper {
|
|||||||
->addSelect('name')
|
->addSelect('name')
|
||||||
->addSelect('favicon')
|
->addSelect('favicon')
|
||||||
->addSelect('urlresolved')
|
->addSelect('urlresolved')
|
||||||
|
->addSelect('bitrate')
|
||||||
|
->addSelect('country')
|
||||||
|
->addSelect('language')
|
||||||
|
->addSelect('homepage')
|
||||||
|
->addSelect('codec')
|
||||||
|
->addSelect('tags')
|
||||||
->from('recent')
|
->from('recent')
|
||||||
->orderBy('id', 'DESC')
|
->orderBy('id', 'DESC')
|
||||||
->where($qb->expr()->eq('user_id', $qb->createNamedParameter($userId)));
|
->where($qb->expr()->eq('user_id', $qb->createNamedParameter($userId)));
|
||||||
|
@ -11,6 +11,12 @@ class Station extends Entity implements JsonSerializable {
|
|||||||
protected $name;
|
protected $name;
|
||||||
protected $favicon;
|
protected $favicon;
|
||||||
protected $urlresolved;
|
protected $urlresolved;
|
||||||
|
protected $bitrate;
|
||||||
|
protected $country;
|
||||||
|
protected $language;
|
||||||
|
protected $homepage;
|
||||||
|
protected $codec;
|
||||||
|
protected $tags;
|
||||||
protected $userId;
|
protected $userId;
|
||||||
|
|
||||||
public function jsonSerialize(): array {
|
public function jsonSerialize(): array {
|
||||||
@ -19,7 +25,13 @@ class Station extends Entity implements JsonSerializable {
|
|||||||
'stationuuid' => $this->stationuuid,
|
'stationuuid' => $this->stationuuid,
|
||||||
'name' => $this->name,
|
'name' => $this->name,
|
||||||
'favicon' => $this->favicon,
|
'favicon' => $this->favicon,
|
||||||
'urlresolved' => $this->urlresolved
|
'urlresolved' => $this->urlresolved,
|
||||||
|
'bitrate' => $this->bitrate,
|
||||||
|
'country' => $this->country,
|
||||||
|
'language' => $this->language,
|
||||||
|
'homepage' => $this->homepage,
|
||||||
|
'codec' => $this->codec,
|
||||||
|
'tags' => $this->tags
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -38,6 +38,12 @@ class Version000000Date20181013124731 extends SimpleMigrationStep {
|
|||||||
]);
|
]);
|
||||||
$table->addColumn('favicon', 'text');
|
$table->addColumn('favicon', 'text');
|
||||||
$table->addColumn('urlresolved', 'text');
|
$table->addColumn('urlresolved', 'text');
|
||||||
|
$table->addColumn('bitrate', 'text');
|
||||||
|
$table->addColumn('country', 'text');
|
||||||
|
$table->addColumn('language', 'text');
|
||||||
|
$table->addColumn('homepage', 'text');
|
||||||
|
$table->addColumn('codec', 'text');
|
||||||
|
$table->addColumn('tags', 'text');
|
||||||
|
|
||||||
$table->setPrimaryKey(['id']);
|
$table->setPrimaryKey(['id']);
|
||||||
$table->addIndex(['user_id'], 'favorites_user_id_index');
|
$table->addIndex(['user_id'], 'favorites_user_id_index');
|
||||||
@ -60,6 +66,12 @@ class Version000000Date20181013124731 extends SimpleMigrationStep {
|
|||||||
]);
|
]);
|
||||||
$table->addColumn('favicon', 'text');
|
$table->addColumn('favicon', 'text');
|
||||||
$table->addColumn('urlresolved', 'text');
|
$table->addColumn('urlresolved', 'text');
|
||||||
|
$table->addColumn('bitrate', 'text');
|
||||||
|
$table->addColumn('country', 'text');
|
||||||
|
$table->addColumn('language', 'text');
|
||||||
|
$table->addColumn('homepage', 'text');
|
||||||
|
$table->addColumn('codec', 'text');
|
||||||
|
$table->addColumn('tags', 'text');
|
||||||
|
|
||||||
$table->setPrimaryKey(['id']);
|
$table->setPrimaryKey(['id']);
|
||||||
$table->addIndex(['user_id'], 'recent_user_id_index');
|
$table->addIndex(['user_id'], 'recent_user_id_index');
|
||||||
|
@ -45,23 +45,37 @@ class FavoriteService {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public function create($stationuuid, $name, $favicon, $urlresolved, $userId) {
|
public function create($stationuuid, $name, $favicon, $urlresolved,
|
||||||
|
$bitrate, $country, $language, $homepage, $codec, $tags, $userId) {
|
||||||
$station = new Station();
|
$station = new Station();
|
||||||
$station->setStationuuid($stationuuid);
|
$station->setStationuuid($stationuuid);
|
||||||
$station->setName($name);
|
$station->setName($name);
|
||||||
$station->setFavicon($favicon);
|
$station->setFavicon($favicon);
|
||||||
$station->setUrlresolved($urlresolved);
|
$station->setUrlresolved($urlresolved);
|
||||||
|
$station->setBitrate($bitrate);
|
||||||
|
$station->setCountry($country);
|
||||||
|
$station->setLanguage($language);
|
||||||
|
$station->setHomepage($homepage);
|
||||||
|
$station->setCodec($codec);
|
||||||
|
$station->setTags($tags);
|
||||||
$station->setUserId($userId);
|
$station->setUserId($userId);
|
||||||
return $this->mapper->insert($station);
|
return $this->mapper->insert($station);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function update($id, $stationuuid, $name, $favicon, $urlresolved, $userId) {
|
public function update($id, $stationuuid, $name, $favicon, $urlresolved,
|
||||||
|
$bitrate, $country, $language, $homepage, $codec, $tags, $userId) {
|
||||||
try {
|
try {
|
||||||
$station = $this->mapper->find($id, $userId);
|
$station = $this->mapper->find($id, $userId);
|
||||||
$station->setStationuuid($stationuuid);
|
$station->setStationuuid($stationuuid);
|
||||||
$station->setName($name);
|
$station->setName($name);
|
||||||
$station->setFavicon($favicon);
|
$station->setFavicon($favicon);
|
||||||
$station->setUrlresolved($urlresolved);
|
$station->setUrlresolved($urlresolved);
|
||||||
|
$station->setBitrate($bitrate);
|
||||||
|
$station->setCountry($country);
|
||||||
|
$station->setLanguage($language);
|
||||||
|
$station->setHomepage($homepage);
|
||||||
|
$station->setCodec($codec);
|
||||||
|
$station->setTags($tags);
|
||||||
return $this->mapper->update($station);
|
return $this->mapper->update($station);
|
||||||
} catch (Exception $e) {
|
} catch (Exception $e) {
|
||||||
$this->handleException($e);
|
$this->handleException($e);
|
||||||
|
@ -45,23 +45,37 @@ class RecentService {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public function create($stationuuid, $name, $favicon, $urlresolved, $userId) {
|
public function create($stationuuid, $name, $favicon, $urlresolved,
|
||||||
|
$bitrate, $country, $language, $homepage, $codec, $tags, $userId) {
|
||||||
$station = new Station();
|
$station = new Station();
|
||||||
$station->setStationuuid($stationuuid);
|
$station->setStationuuid($stationuuid);
|
||||||
$station->setName($name);
|
$station->setName($name);
|
||||||
$station->setFavicon($favicon);
|
$station->setFavicon($favicon);
|
||||||
$station->setUrlresolved($urlresolved);
|
$station->setUrlresolved($urlresolved);
|
||||||
|
$station->setBitrate($bitrate);
|
||||||
|
$station->setCountry($country);
|
||||||
|
$station->setLanguage($language);
|
||||||
|
$station->setHomepage($homepage);
|
||||||
|
$station->setCodec($codec);
|
||||||
|
$station->setTags($tags);
|
||||||
$station->setUserId($userId);
|
$station->setUserId($userId);
|
||||||
return $this->mapper->insert($station);
|
return $this->mapper->insert($station);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function update($id, $stationuuid, $name, $favicon, $urlresolved, $userId) {
|
public function update($id, $stationuuid, $name, $favicon, $urlresolved,
|
||||||
|
$bitrate, $country, $language, $homepage, $codec, $tags, $userId) {
|
||||||
try {
|
try {
|
||||||
$station = $this->mapper->find($id, $userId);
|
$station = $this->mapper->find($id, $userId);
|
||||||
$station->setStationuuid($stationuuid);
|
$station->setStationuuid($stationuuid);
|
||||||
$station->setName($name);
|
$station->setName($name);
|
||||||
$station->setFavicon($favicon);
|
$station->setFavicon($favicon);
|
||||||
$station->setUrlresolved($urlresolved);
|
$station->setUrlresolved($urlresolved);
|
||||||
|
$station->setBitrate($bitrate);
|
||||||
|
$station->setCountry($country);
|
||||||
|
$station->setLanguage($language);
|
||||||
|
$station->setHomepage($homepage);
|
||||||
|
$station->setCodec($codec);
|
||||||
|
$station->setTags($tags);
|
||||||
return $this->mapper->update($station);
|
return $this->mapper->update($station);
|
||||||
} catch (Exception $e) {
|
} catch (Exception $e) {
|
||||||
$this->handleException($e);
|
$this->handleException($e);
|
||||||
|
@ -55,7 +55,7 @@ export default {
|
|||||||
targetUrl: generateUrl('/apps/radio/#/favorites'),
|
targetUrl: generateUrl('/apps/radio/#/favorites'),
|
||||||
avatarUrl: n.favicon,
|
avatarUrl: n.favicon,
|
||||||
mainText: n.name,
|
mainText: n.name,
|
||||||
subText: n.tags,
|
subText: n.tags.replaceAll(',', ', '),
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
|
@ -61,7 +61,7 @@ export default {
|
|||||||
blurHashes: require('../assets/blurHashes.json'),
|
blurHashes: require('../assets/blurHashes.json'),
|
||||||
favorites: [],
|
favorites: [],
|
||||||
showSidebar: false,
|
showSidebar: false,
|
||||||
sidebarStation: [],
|
sidebarStation: {},
|
||||||
}),
|
}),
|
||||||
computed: {
|
computed: {
|
||||||
player() {
|
player() {
|
||||||
@ -161,10 +161,16 @@ export default {
|
|||||||
}
|
}
|
||||||
const stationMap = {
|
const stationMap = {
|
||||||
id: -1,
|
id: -1,
|
||||||
name: station.name,
|
name: station.name.toString(),
|
||||||
urlresolved: stationSrc,
|
urlresolved: stationSrc.toString(),
|
||||||
favicon: station.favicon,
|
favicon: station.favicon.toString(),
|
||||||
stationuuid: station.stationuuid,
|
stationuuid: station.stationuuid.toString(),
|
||||||
|
bitrate: station.bitrate.toString(),
|
||||||
|
country: station.country.toString(),
|
||||||
|
language: station.language.toString(),
|
||||||
|
homepage: station.homepage.toString(),
|
||||||
|
codec: station.codec.toString(),
|
||||||
|
tags: station.tags.toString(),
|
||||||
}
|
}
|
||||||
await axios
|
await axios
|
||||||
.post(generateUrl('/apps/radio/api/favorites'), stationMap)
|
.post(generateUrl('/apps/radio/api/favorites'), stationMap)
|
||||||
@ -246,10 +252,16 @@ export default {
|
|||||||
}
|
}
|
||||||
const stationMap = {
|
const stationMap = {
|
||||||
id: -1,
|
id: -1,
|
||||||
name: station.name,
|
name: station.name.toString(),
|
||||||
urlresolved: stationSrc,
|
urlresolved: stationSrc.toString(),
|
||||||
favicon: station.favicon,
|
favicon: station.favicon.toString(),
|
||||||
stationuuid: station.stationuuid,
|
stationuuid: station.stationuuid.toString(),
|
||||||
|
bitrate: station.bitrate.toString(),
|
||||||
|
country: station.country.toString(),
|
||||||
|
language: station.language.toString(),
|
||||||
|
homepage: station.homepage.toString(),
|
||||||
|
codec: station.codec.toString(),
|
||||||
|
tags: station.tags.toString(),
|
||||||
}
|
}
|
||||||
await axios
|
await axios
|
||||||
.post(generateUrl('/apps/radio/api/recent'), stationMap)
|
.post(generateUrl('/apps/radio/api/recent'), stationMap)
|
||||||
@ -390,27 +402,10 @@ export default {
|
|||||||
|
|
||||||
<style>
|
<style>
|
||||||
|
|
||||||
/* Make breadcrumbs sticky and intransparent.
|
|
||||||
Move them to the right and show navigation
|
|
||||||
toggle on smaller screens */
|
|
||||||
|
|
||||||
.breadcrumbs {
|
|
||||||
background-color: var(--color-main-background-translucent);
|
|
||||||
z-index: 60;
|
|
||||||
position: sticky;
|
|
||||||
position: -webkit-sticky;
|
|
||||||
top: 50px;
|
|
||||||
padding-bottom: 5px;
|
|
||||||
margin-left: 35px;
|
|
||||||
}
|
|
||||||
|
|
||||||
@media only screen and (min-width: 1024px) {
|
@media only screen and (min-width: 1024px) {
|
||||||
.app-navigation-toggle {
|
.app-navigation-toggle {
|
||||||
display: none;
|
display: none;
|
||||||
}
|
}
|
||||||
.breadcrumbs {
|
|
||||||
margin-left: 0px;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
</style>
|
</style>
|
||||||
|
@ -79,8 +79,10 @@ export default {
|
|||||||
default() { return false },
|
default() { return false },
|
||||||
},
|
},
|
||||||
sidebarStation: {
|
sidebarStation: {
|
||||||
type: Array,
|
type: Object,
|
||||||
default() { return [] },
|
default() {
|
||||||
|
return {}
|
||||||
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
computed: {
|
computed: {
|
||||||
@ -103,6 +105,7 @@ export default {
|
|||||||
this.$emit('toggleSidebar')
|
this.$emit('toggleSidebar')
|
||||||
},
|
},
|
||||||
copyLink() {
|
copyLink() {
|
||||||
|
console.log(this.sidebarStation.favicon)
|
||||||
this.$copyText(this.urlResolved).then(
|
this.$copyText(this.urlResolved).then(
|
||||||
function() {
|
function() {
|
||||||
showSuccess(t('radio', 'Link copied to clipboard'))
|
showSuccess(t('radio', 'Link copied to clipboard'))
|
||||||
|
Loading…
Reference in New Issue
Block a user