mirror of
https://github.com/devfake/flox.git
synced 2024-11-23 18:42:30 +01:00
check for demo
This commit is contained in:
parent
356b0a6028
commit
2d4353005c
@ -6,6 +6,7 @@ use Exception;
|
||||
use Illuminate\Auth\AuthenticationException;
|
||||
use Illuminate\Foundation\Exceptions\Handler as ExceptionHandler;
|
||||
use Symfony\Component\Debug\Exception\FatalErrorException;
|
||||
use Symfony\Component\HttpFoundation\Response;
|
||||
|
||||
class Handler extends ExceptionHandler
|
||||
{
|
||||
@ -65,7 +66,7 @@ class Handler extends ExceptionHandler
|
||||
protected function unauthenticated($request, AuthenticationException $exception)
|
||||
{
|
||||
if ($request->expectsJson()) {
|
||||
return response()->json(['error' => 'Unauthenticated.'], 401);
|
||||
return response()->json(['error' => 'Unauthenticated.'], Response::HTTP_UNAUTHORIZED);
|
||||
}
|
||||
|
||||
return redirect()->guest('login');
|
||||
|
@ -57,6 +57,10 @@
|
||||
*/
|
||||
public function import()
|
||||
{
|
||||
if (isDemo()) {
|
||||
return response('Success', Response::HTTP_OK);
|
||||
}
|
||||
|
||||
increaseTimeLimit();
|
||||
|
||||
$file = Request::file('import');
|
||||
|
@ -67,6 +67,10 @@
|
||||
|
||||
public function refreshAll()
|
||||
{
|
||||
if (isDemo()) {
|
||||
return response('Success', Response::HTTP_OK);
|
||||
}
|
||||
|
||||
$this->itemService->refreshAll();
|
||||
|
||||
return response([], Response::HTTP_OK);
|
||||
@ -80,10 +84,10 @@
|
||||
public function toggleEpisode($id)
|
||||
{
|
||||
if( ! $this->episodeService->toggleSeen($id)) {
|
||||
return response('Server Error', 500);
|
||||
return response('Server Error', Response::HTTP_INTERNAL_SERVER_ERROR);
|
||||
}
|
||||
|
||||
return response('Success', 200);
|
||||
return response('Success', Response::HTTP_OK);
|
||||
}
|
||||
|
||||
public function toggleSeason()
|
||||
|
@ -10,6 +10,7 @@
|
||||
use Illuminate\Support\Facades\Auth;
|
||||
use Illuminate\Support\Facades\Cache;
|
||||
use Illuminate\Support\Facades\Request;
|
||||
use Symfony\Component\HttpFoundation\Response;
|
||||
|
||||
class SettingController {
|
||||
|
||||
@ -82,6 +83,10 @@
|
||||
*/
|
||||
public function updateSettings()
|
||||
{
|
||||
if (isDemo()) {
|
||||
return response('Success', Response::HTTP_OK);
|
||||
}
|
||||
|
||||
Cache::flush();
|
||||
|
||||
$this->setting->first()->update([
|
||||
@ -98,6 +103,10 @@
|
||||
*/
|
||||
public function updateRefresh()
|
||||
{
|
||||
if (isDemo()) {
|
||||
return response('Success', Response::HTTP_OK);
|
||||
}
|
||||
|
||||
$this->setting->first()->update([
|
||||
'refresh_automatically' => Request::input('refresh'),
|
||||
]);
|
||||
@ -108,6 +117,10 @@
|
||||
*/
|
||||
public function updateRemindersSendTo()
|
||||
{
|
||||
if (isDemo()) {
|
||||
return response('Success', Response::HTTP_OK);
|
||||
}
|
||||
|
||||
$this->setting->first()->update([
|
||||
'reminders_send_to' => Request::input('reminders_send_to'),
|
||||
]);
|
||||
@ -118,6 +131,10 @@
|
||||
*/
|
||||
public function updateReminderOptions()
|
||||
{
|
||||
if (isDemo()) {
|
||||
return response('Success', Response::HTTP_OK);
|
||||
}
|
||||
|
||||
$this->setting->first()->update([
|
||||
'daily_reminder' => Request::input('daily'),
|
||||
'weekly_reminder' => Request::input('weekly'),
|
||||
|
@ -5,6 +5,7 @@
|
||||
use Illuminate\Contracts\Auth\Guard;
|
||||
use Illuminate\Support\Facades\Auth;
|
||||
use Illuminate\Support\Facades\Request;
|
||||
use Symfony\Component\HttpFoundation\Response;
|
||||
|
||||
class UserController {
|
||||
|
||||
@ -26,10 +27,10 @@
|
||||
$password = Request::input('password');
|
||||
|
||||
if($this->auth->attempt(['username' => $username, 'password' => $password], true)) {
|
||||
return response('Success', 200);
|
||||
return response('Success', Response::HTTP_OK);
|
||||
}
|
||||
|
||||
return response('Unauthorized', 401);
|
||||
return response('Unauthorized', Response::HTTP_UNAUTHORIZED);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -49,6 +50,10 @@
|
||||
*/
|
||||
public function changeUserData()
|
||||
{
|
||||
if (isDemo()) {
|
||||
return response('Success', Response::HTTP_OK);
|
||||
}
|
||||
|
||||
$username = Request::input('username');
|
||||
$password = Request::input('password');
|
||||
|
||||
@ -60,10 +65,10 @@
|
||||
}
|
||||
|
||||
if($user->save()) {
|
||||
return response('Success', 200);
|
||||
return response('Success', Response::HTTP_OK);
|
||||
}
|
||||
|
||||
return response('Server Error', 500);
|
||||
return response('Server Error', Response::HTTP_INTERNAL_SERVER_ERROR);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -5,6 +5,11 @@
|
||||
set_time_limit(config('app.PHP_TIME_LIMIT'));
|
||||
}
|
||||
|
||||
function isDemo()
|
||||
{
|
||||
return config('app.env') === 'demo';
|
||||
}
|
||||
|
||||
function getFileName($file)
|
||||
{
|
||||
return $file->changed->name ?? $file->name;
|
||||
|
@ -1,6 +1,8 @@
|
||||
<template>
|
||||
|
||||
<div class="settings-box" v-if=" ! loading">
|
||||
<div class="login-error" v-if="config.env === 'demo'"><span>Data cannot be changed in the demo</span></div>
|
||||
|
||||
<a :href="exportLink" class="setting-btn">{{ lang('export button') }}</a>
|
||||
|
||||
<form class="login-form" @submit.prevent="importMovies()">
|
||||
@ -24,6 +26,7 @@
|
||||
|
||||
data() {
|
||||
return {
|
||||
config: window.config,
|
||||
uploadSuccess: false,
|
||||
uploadedFile: null
|
||||
}
|
||||
@ -69,4 +72,4 @@
|
||||
}
|
||||
|
||||
}
|
||||
</script>
|
||||
</script>
|
||||
|
@ -1,7 +1,8 @@
|
||||
<template>
|
||||
|
||||
<div class="settings-box element-ui-checkbox no-select" v-if=" ! loading">
|
||||
|
||||
<div class="login-error" v-if="config.env === 'demo'"><span>Data cannot be changed in the demo</span></div>
|
||||
|
||||
<div class="setting-box">
|
||||
<el-checkbox v-model="genre" @change="updateOptions">{{ lang('display genre') }}</el-checkbox>
|
||||
</div>
|
||||
@ -42,6 +43,7 @@
|
||||
|
||||
data() {
|
||||
return {
|
||||
config: window.config,
|
||||
genre: null,
|
||||
date: null,
|
||||
spoiler: null,
|
||||
@ -65,7 +67,7 @@
|
||||
const data = response.data;
|
||||
|
||||
this.SET_LOADING(false);
|
||||
|
||||
|
||||
this.genre = data.genre;
|
||||
this.date = data.date;
|
||||
this.spoiler = data.spoiler;
|
||||
|
@ -1,7 +1,8 @@
|
||||
<template>
|
||||
|
||||
<div class="settings-box element-ui-checkbox no-select" v-if=" ! loading">
|
||||
|
||||
<div class="login-error" v-if="config.env === 'demo'"><span>Data cannot be changed in the demo</span></div>
|
||||
|
||||
<div class="setting-box">
|
||||
<el-checkbox v-model="refresh" @change="updateRefresh">{{ lang('refresh automatically') }}</el-checkbox>
|
||||
</div>
|
||||
@ -10,7 +11,7 @@
|
||||
<button v-show=" ! refreshAllClicked" @click="refreshAll()" class="setting-btn">{{ lang('refresh all infos') }}</button>
|
||||
<span v-show="showRefreshAllMessage" class="update-check">{{ lang('refresh all triggered') }}</span>
|
||||
</div>
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
</template>
|
||||
@ -30,6 +31,7 @@
|
||||
|
||||
data() {
|
||||
return {
|
||||
config: window.config,
|
||||
refresh: false,
|
||||
refreshAllClicked: false,
|
||||
showRefreshAllMessage: false,
|
||||
@ -56,14 +58,14 @@
|
||||
|
||||
updateRefresh() {
|
||||
this.SET_LOADING(true);
|
||||
|
||||
|
||||
http.patch(`${config.api}/settings/refresh`, {refresh: this.refresh}).then(() => {
|
||||
this.SET_LOADING(false);
|
||||
}, error => {
|
||||
alert(error.message);
|
||||
})
|
||||
},
|
||||
|
||||
|
||||
refreshAll() {
|
||||
this.refreshAllClicked = true;
|
||||
|
||||
|
@ -1,6 +1,8 @@
|
||||
<template>
|
||||
|
||||
<div class="settings-box element-ui-checkbox no-select" v-if=" ! loading">
|
||||
<div class="login-error" v-if="config.env === 'demo'"><span>Data cannot be changed in the demo</span></div>
|
||||
|
||||
<form class="login-form" @submit.prevent="editSetting()">
|
||||
<span class="update-check">{{ lang('reminders send to') }}</span>
|
||||
|
||||
@ -8,7 +10,7 @@
|
||||
<span class="userdata-changed"><span v-if="success">{{ lang('success message') }}</span></span>
|
||||
<input type="submit" :value="lang('save button')">
|
||||
</form>
|
||||
|
||||
|
||||
<div class="setting-box">
|
||||
<el-checkbox v-model="daily" @change="updateReminders">{{ lang('daily reminder') }}</el-checkbox>
|
||||
</div>
|
||||
@ -38,6 +40,7 @@
|
||||
|
||||
data() {
|
||||
return {
|
||||
config: window.config,
|
||||
reminders_send_to: '',
|
||||
success: false,
|
||||
daily: false,
|
||||
@ -78,7 +81,7 @@
|
||||
|
||||
updateReminders() {
|
||||
this.SET_LOADING(true);
|
||||
|
||||
|
||||
const daily = this.daily;
|
||||
const weekly = this.weekly;
|
||||
|
||||
|
@ -1,6 +1,7 @@
|
||||
<template>
|
||||
|
||||
<div class="settings-box" v-if=" ! loading">
|
||||
<div class="login-error" v-if="config.env === 'demo'"><span>Data cannot be changed in the demo</span></div>
|
||||
<form class="login-form" @submit.prevent="editUser()">
|
||||
<input type="text" :placeholder="lang('username')" v-model="username">
|
||||
<input type="password" :placeholder="lang('password')" v-model="password" autocomplete="off">
|
||||
@ -31,6 +32,7 @@
|
||||
|
||||
data() {
|
||||
return {
|
||||
config: window.config,
|
||||
username: '',
|
||||
password: '',
|
||||
success: false
|
||||
@ -72,4 +74,4 @@
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
</script>
|
||||
|
@ -1,9 +1,10 @@
|
||||
import http from 'axios';
|
||||
http.defaults.headers.common['X-CSRF-TOKEN'] = document.querySelector('#token').getAttribute('content');
|
||||
|
||||
const {url, uri, auth, language, posterTmdb, posterSubpageTmdb, backdropTmdb} = document.body.dataset;
|
||||
const {env, url, uri, auth, language, posterTmdb, posterSubpageTmdb, backdropTmdb} = document.body.dataset;
|
||||
|
||||
const config = {
|
||||
env,
|
||||
uri,
|
||||
url,
|
||||
auth,
|
||||
|
@ -9,9 +9,10 @@
|
||||
<title>Flox</title>
|
||||
<link rel="stylesheet" href="{{ url('assets/app.css') }}">
|
||||
<link href="{{ url('assets/favicon.ico?v=3') }}" rel="icon" type="image/x-icon">
|
||||
|
||||
|
||||
</head>
|
||||
<body
|
||||
data-env="{{ config('app.env') }}"
|
||||
data-url="{{ url('/') }}"
|
||||
data-uri="{{ config('app.CLIENT_URI') }}"
|
||||
data-poster-tmdb="{{ config('services.tmdb.poster') }}"
|
||||
@ -32,7 +33,7 @@
|
||||
<site-footer></site-footer>
|
||||
@endif
|
||||
</div>
|
||||
|
||||
|
||||
<script src="{{ url('assets/vendor.js') }}"></script>
|
||||
<script src="{{ url('assets/app.js') }}"></script>
|
||||
|
||||
|
21256
public/vendor/telescope/app-dark.css
vendored
21256
public/vendor/telescope/app-dark.css
vendored
File diff suppressed because it is too large
Load Diff
21256
public/vendor/telescope/app.css
vendored
21256
public/vendor/telescope/app.css
vendored
File diff suppressed because it is too large
Load Diff
70567
public/vendor/telescope/app.js
vendored
70567
public/vendor/telescope/app.js
vendored
File diff suppressed because one or more lines are too long
BIN
public/vendor/telescope/favicon.ico
vendored
BIN
public/vendor/telescope/favicon.ico
vendored
Binary file not shown.
Before Width: | Height: | Size: 26 KiB |
5
public/vendor/telescope/mix-manifest.json
vendored
5
public/vendor/telescope/mix-manifest.json
vendored
@ -1,5 +0,0 @@
|
||||
{
|
||||
"/app.js": "/app.js?id=6722b362321839d2d6da",
|
||||
"/app.css": "/app.css?id=0c1e654d28f1c73326c1",
|
||||
"/app-dark.css": "/app-dark.css?id=13df33880547628477b2"
|
||||
}
|
Loading…
Reference in New Issue
Block a user