summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorDaniel Friesel <derf@finalrewind.org>2019-12-17 20:46:17 +0100
committerDaniel Friesel <derf@finalrewind.org>2019-12-19 19:20:06 +0100
commit69f961a23cb8a2196d5315105eb4a72764625351 (patch)
tree905400f830299c100ce5b76614a6a825ba55914e /lib
parentf895d34f31fbae76d110bce08a5bc52e365b44ba (diff)
disable import and checkin API endpoints in production mode
Diffstat (limited to 'lib')
-rwxr-xr-xlib/Travelynx/Controller/Api.pm22
1 files changed, 22 insertions, 0 deletions
diff --git a/lib/Travelynx/Controller/Api.pm b/lib/Travelynx/Controller/Api.pm
index 42e4774..f541c98 100755
--- a/lib/Travelynx/Controller/Api.pm
+++ b/lib/Travelynx/Controller/Api.pm
@@ -181,6 +181,17 @@ sub travel_v1 {
return;
}
+ if ( $self->app->mode ne 'development' ) {
+ $self->render(
+ json => {
+ success => \0,
+ error =>
+'This feature is incomplete and only available in development mode',
+ },
+ );
+ return;
+ }
+
my $api_token = $payload->{token} // '';
if ( $api_token !~ qr{ ^ (?<id> \d+ ) - (?<token> .* ) $ }x ) {
@@ -361,6 +372,17 @@ sub import_v1 {
return;
}
+ if ( $self->app->mode ne 'development' ) {
+ $self->render(
+ json => {
+ success => \0,
+ error =>
+'This feature is incomplete and only available in development mode',
+ },
+ );
+ return;
+ }
+
my $api_token = $payload->{token} // '';
if ( $api_token !~ qr{ ^ (?<id> \d+ ) - (?<token> .* ) $ }x ) {