diff options
| author | Daniel Friesel <derf@finalrewind.org> | 2019-12-17 20:46:17 +0100 | 
|---|---|---|
| committer | Daniel Friesel <derf@finalrewind.org> | 2019-12-19 19:20:06 +0100 | 
| commit | 69f961a23cb8a2196d5315105eb4a72764625351 (patch) | |
| tree | 905400f830299c100ce5b76614a6a825ba55914e | |
| parent | f895d34f31fbae76d110bce08a5bc52e365b44ba (diff) | |
disable import and checkin API endpoints in production mode
| -rwxr-xr-x | lib/Travelynx/Controller/Api.pm | 22 | ||||
| -rw-r--r-- | templates/account.html.ep | 2 | ||||
| -rw-r--r-- | templates/api_documentation.html.ep | 4 | 
3 files changed, 28 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 ) { diff --git a/templates/account.html.ep b/templates/account.html.ep index be61518..2cc7f35 100644 --- a/templates/account.html.ep +++ b/templates/account.html.ep @@ -170,6 +170,7 @@  					%= end  				</td>  			</tr>--> +			% if (app->mode eq 'development') {  			<tr>  				<th scope="row">Travel</th>  				<td> @@ -216,6 +217,7 @@  					%= end  				</td>  			</tr> +			% }  		</table>  	</div>  </div> diff --git a/templates/api_documentation.html.ep b/templates/api_documentation.html.ep index cf3a57a..2e3e66d 100644 --- a/templates/api_documentation.html.ep +++ b/templates/api_documentation.html.ep @@ -65,6 +65,8 @@  	</div>  </div> +% if (app->mode eq 'development') { +  <h2>Travel</h2>  <div class="row">  	<div class="col s12"> @@ -188,3 +190,5 @@  		</p>  	</div>  </div> + +% } | 
