summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authordakkar <dakkar@thenautilus.net>2018-03-03 14:06:46 +0000
committerdakkar <dakkar@thenautilus.net>2018-03-03 14:06:46 +0000
commit20217564e033ce57b6ceb59e0a6c6be9ad7860d3 (patch)
tree0ff1e8776b81abfab4e7d591b371930cf73bbbf9
parenthelper to call ultramarine (diff)
downloadUltramarine-20217564e033ce57b6ceb59e0a6c6be9ad7860d3.tar.gz
Ultramarine-20217564e033ce57b6ceb59e0a6c6be9ad7860d3.tar.bz2
Ultramarine-20217564e033ce57b6ceb59e0a6c6be9ad7860d3.zip
allow both POST and GET
-rw-r--r--lib/Ultramarine/Controller.pm614
1 files changed, 10 insertions, 4 deletions
diff --git a/lib/Ultramarine/Controller.pm6 b/lib/Ultramarine/Controller.pm6
index f5cbd64..5e18b48 100644
--- a/lib/Ultramarine/Controller.pm6
+++ b/lib/Ultramarine/Controller.pm6
@@ -51,8 +51,11 @@ class Ultramarine::Controller {
# middlewares, so our serialised won't be seen by the
# "unauthorised" response
before $!authorisation;
- post -> 'ping' { respond [] }
- post -> 'getLicense' {
+
+ post my $ping = -> 'ping' { respond [] }
+ get $ping;
+
+ post my $getLicense = -> 'getLicense' {
my $expires = $.license.expires-at.DateTime.truncated-to('second');
respond [
:status<ok>,
@@ -63,7 +66,9 @@ class Ultramarine::Controller {
],
],
}
- post -> 'getMusicFolders' {
+ get $getLicense;
+
+ post my $getMusicFolders = -> 'getMusicFolders' {
respond [
:status<ok>,
musicFolders => [
@@ -71,8 +76,9 @@ class Ultramarine::Controller {
]
],
}
+ get $getMusicFolders;
# this is clearly not a Subsonic method
- post -> 'dakkarList' {
+ get -> 'dakkarList' {
await $.collection.is-ready;
respond [
:status<ok>,