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\Auth\AuthenticationException;
|
||||||
use Illuminate\Foundation\Exceptions\Handler as ExceptionHandler;
|
use Illuminate\Foundation\Exceptions\Handler as ExceptionHandler;
|
||||||
use Symfony\Component\Debug\Exception\FatalErrorException;
|
use Symfony\Component\Debug\Exception\FatalErrorException;
|
||||||
|
use Symfony\Component\HttpFoundation\Response;
|
||||||
|
|
||||||
class Handler extends ExceptionHandler
|
class Handler extends ExceptionHandler
|
||||||
{
|
{
|
||||||
@ -65,7 +66,7 @@ class Handler extends ExceptionHandler
|
|||||||
protected function unauthenticated($request, AuthenticationException $exception)
|
protected function unauthenticated($request, AuthenticationException $exception)
|
||||||
{
|
{
|
||||||
if ($request->expectsJson()) {
|
if ($request->expectsJson()) {
|
||||||
return response()->json(['error' => 'Unauthenticated.'], 401);
|
return response()->json(['error' => 'Unauthenticated.'], Response::HTTP_UNAUTHORIZED);
|
||||||
}
|
}
|
||||||
|
|
||||||
return redirect()->guest('login');
|
return redirect()->guest('login');
|
||||||
|
@ -57,6 +57,10 @@
|
|||||||
*/
|
*/
|
||||||
public function import()
|
public function import()
|
||||||
{
|
{
|
||||||
|
if (isDemo()) {
|
||||||
|
return response('Success', Response::HTTP_OK);
|
||||||
|
}
|
||||||
|
|
||||||
increaseTimeLimit();
|
increaseTimeLimit();
|
||||||
|
|
||||||
$file = Request::file('import');
|
$file = Request::file('import');
|
||||||
|
@ -67,6 +67,10 @@
|
|||||||
|
|
||||||
public function refreshAll()
|
public function refreshAll()
|
||||||
{
|
{
|
||||||
|
if (isDemo()) {
|
||||||
|
return response('Success', Response::HTTP_OK);
|
||||||
|
}
|
||||||
|
|
||||||
$this->itemService->refreshAll();
|
$this->itemService->refreshAll();
|
||||||
|
|
||||||
return response([], Response::HTTP_OK);
|
return response([], Response::HTTP_OK);
|
||||||
@ -80,10 +84,10 @@
|
|||||||
public function toggleEpisode($id)
|
public function toggleEpisode($id)
|
||||||
{
|
{
|
||||||
if( ! $this->episodeService->toggleSeen($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()
|
public function toggleSeason()
|
||||||
|
@ -10,6 +10,7 @@
|
|||||||
use Illuminate\Support\Facades\Auth;
|
use Illuminate\Support\Facades\Auth;
|
||||||
use Illuminate\Support\Facades\Cache;
|
use Illuminate\Support\Facades\Cache;
|
||||||
use Illuminate\Support\Facades\Request;
|
use Illuminate\Support\Facades\Request;
|
||||||
|
use Symfony\Component\HttpFoundation\Response;
|
||||||
|
|
||||||
class SettingController {
|
class SettingController {
|
||||||
|
|
||||||
@ -82,6 +83,10 @@
|
|||||||
*/
|
*/
|
||||||
public function updateSettings()
|
public function updateSettings()
|
||||||
{
|
{
|
||||||
|
if (isDemo()) {
|
||||||
|
return response('Success', Response::HTTP_OK);
|
||||||
|
}
|
||||||
|
|
||||||
Cache::flush();
|
Cache::flush();
|
||||||
|
|
||||||
$this->setting->first()->update([
|
$this->setting->first()->update([
|
||||||
@ -98,6 +103,10 @@
|
|||||||
*/
|
*/
|
||||||
public function updateRefresh()
|
public function updateRefresh()
|
||||||
{
|
{
|
||||||
|
if (isDemo()) {
|
||||||
|
return response('Success', Response::HTTP_OK);
|
||||||
|
}
|
||||||
|
|
||||||
$this->setting->first()->update([
|
$this->setting->first()->update([
|
||||||
'refresh_automatically' => Request::input('refresh'),
|
'refresh_automatically' => Request::input('refresh'),
|
||||||
]);
|
]);
|
||||||
@ -108,6 +117,10 @@
|
|||||||
*/
|
*/
|
||||||
public function updateRemindersSendTo()
|
public function updateRemindersSendTo()
|
||||||
{
|
{
|
||||||
|
if (isDemo()) {
|
||||||
|
return response('Success', Response::HTTP_OK);
|
||||||
|
}
|
||||||
|
|
||||||
$this->setting->first()->update([
|
$this->setting->first()->update([
|
||||||
'reminders_send_to' => Request::input('reminders_send_to'),
|
'reminders_send_to' => Request::input('reminders_send_to'),
|
||||||
]);
|
]);
|
||||||
@ -118,6 +131,10 @@
|
|||||||
*/
|
*/
|
||||||
public function updateReminderOptions()
|
public function updateReminderOptions()
|
||||||
{
|
{
|
||||||
|
if (isDemo()) {
|
||||||
|
return response('Success', Response::HTTP_OK);
|
||||||
|
}
|
||||||
|
|
||||||
$this->setting->first()->update([
|
$this->setting->first()->update([
|
||||||
'daily_reminder' => Request::input('daily'),
|
'daily_reminder' => Request::input('daily'),
|
||||||
'weekly_reminder' => Request::input('weekly'),
|
'weekly_reminder' => Request::input('weekly'),
|
||||||
|
@ -5,6 +5,7 @@
|
|||||||
use Illuminate\Contracts\Auth\Guard;
|
use Illuminate\Contracts\Auth\Guard;
|
||||||
use Illuminate\Support\Facades\Auth;
|
use Illuminate\Support\Facades\Auth;
|
||||||
use Illuminate\Support\Facades\Request;
|
use Illuminate\Support\Facades\Request;
|
||||||
|
use Symfony\Component\HttpFoundation\Response;
|
||||||
|
|
||||||
class UserController {
|
class UserController {
|
||||||
|
|
||||||
@ -26,10 +27,10 @@
|
|||||||
$password = Request::input('password');
|
$password = Request::input('password');
|
||||||
|
|
||||||
if($this->auth->attempt(['username' => $username, 'password' => $password], true)) {
|
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()
|
public function changeUserData()
|
||||||
{
|
{
|
||||||
|
if (isDemo()) {
|
||||||
|
return response('Success', Response::HTTP_OK);
|
||||||
|
}
|
||||||
|
|
||||||
$username = Request::input('username');
|
$username = Request::input('username');
|
||||||
$password = Request::input('password');
|
$password = Request::input('password');
|
||||||
|
|
||||||
@ -60,10 +65,10 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
if($user->save()) {
|
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'));
|
set_time_limit(config('app.PHP_TIME_LIMIT'));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function isDemo()
|
||||||
|
{
|
||||||
|
return config('app.env') === 'demo';
|
||||||
|
}
|
||||||
|
|
||||||
function getFileName($file)
|
function getFileName($file)
|
||||||
{
|
{
|
||||||
return $file->changed->name ?? $file->name;
|
return $file->changed->name ?? $file->name;
|
||||||
|
@ -1,6 +1,8 @@
|
|||||||
<template>
|
<template>
|
||||||
|
|
||||||
<div class="settings-box" v-if=" ! loading">
|
<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>
|
<a :href="exportLink" class="setting-btn">{{ lang('export button') }}</a>
|
||||||
|
|
||||||
<form class="login-form" @submit.prevent="importMovies()">
|
<form class="login-form" @submit.prevent="importMovies()">
|
||||||
@ -24,6 +26,7 @@
|
|||||||
|
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
|
config: window.config,
|
||||||
uploadSuccess: false,
|
uploadSuccess: false,
|
||||||
uploadedFile: null
|
uploadedFile: null
|
||||||
}
|
}
|
||||||
@ -69,4 +72,4 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
@ -1,7 +1,8 @@
|
|||||||
<template>
|
<template>
|
||||||
|
|
||||||
<div class="settings-box element-ui-checkbox no-select" v-if=" ! loading">
|
<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">
|
<div class="setting-box">
|
||||||
<el-checkbox v-model="genre" @change="updateOptions">{{ lang('display genre') }}</el-checkbox>
|
<el-checkbox v-model="genre" @change="updateOptions">{{ lang('display genre') }}</el-checkbox>
|
||||||
</div>
|
</div>
|
||||||
@ -42,6 +43,7 @@
|
|||||||
|
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
|
config: window.config,
|
||||||
genre: null,
|
genre: null,
|
||||||
date: null,
|
date: null,
|
||||||
spoiler: null,
|
spoiler: null,
|
||||||
@ -65,7 +67,7 @@
|
|||||||
const data = response.data;
|
const data = response.data;
|
||||||
|
|
||||||
this.SET_LOADING(false);
|
this.SET_LOADING(false);
|
||||||
|
|
||||||
this.genre = data.genre;
|
this.genre = data.genre;
|
||||||
this.date = data.date;
|
this.date = data.date;
|
||||||
this.spoiler = data.spoiler;
|
this.spoiler = data.spoiler;
|
||||||
|
@ -1,7 +1,8 @@
|
|||||||
<template>
|
<template>
|
||||||
|
|
||||||
<div class="settings-box element-ui-checkbox no-select" v-if=" ! loading">
|
<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">
|
<div class="setting-box">
|
||||||
<el-checkbox v-model="refresh" @change="updateRefresh">{{ lang('refresh automatically') }}</el-checkbox>
|
<el-checkbox v-model="refresh" @change="updateRefresh">{{ lang('refresh automatically') }}</el-checkbox>
|
||||||
</div>
|
</div>
|
||||||
@ -10,7 +11,7 @@
|
|||||||
<button v-show=" ! refreshAllClicked" @click="refreshAll()" class="setting-btn">{{ lang('refresh all infos') }}</button>
|
<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>
|
<span v-show="showRefreshAllMessage" class="update-check">{{ lang('refresh all triggered') }}</span>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
</template>
|
</template>
|
||||||
@ -30,6 +31,7 @@
|
|||||||
|
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
|
config: window.config,
|
||||||
refresh: false,
|
refresh: false,
|
||||||
refreshAllClicked: false,
|
refreshAllClicked: false,
|
||||||
showRefreshAllMessage: false,
|
showRefreshAllMessage: false,
|
||||||
@ -56,14 +58,14 @@
|
|||||||
|
|
||||||
updateRefresh() {
|
updateRefresh() {
|
||||||
this.SET_LOADING(true);
|
this.SET_LOADING(true);
|
||||||
|
|
||||||
http.patch(`${config.api}/settings/refresh`, {refresh: this.refresh}).then(() => {
|
http.patch(`${config.api}/settings/refresh`, {refresh: this.refresh}).then(() => {
|
||||||
this.SET_LOADING(false);
|
this.SET_LOADING(false);
|
||||||
}, error => {
|
}, error => {
|
||||||
alert(error.message);
|
alert(error.message);
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
|
|
||||||
refreshAll() {
|
refreshAll() {
|
||||||
this.refreshAllClicked = true;
|
this.refreshAllClicked = true;
|
||||||
|
|
||||||
|
@ -1,6 +1,8 @@
|
|||||||
<template>
|
<template>
|
||||||
|
|
||||||
<div class="settings-box element-ui-checkbox no-select" v-if=" ! loading">
|
<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()">
|
<form class="login-form" @submit.prevent="editSetting()">
|
||||||
<span class="update-check">{{ lang('reminders send to') }}</span>
|
<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>
|
<span class="userdata-changed"><span v-if="success">{{ lang('success message') }}</span></span>
|
||||||
<input type="submit" :value="lang('save button')">
|
<input type="submit" :value="lang('save button')">
|
||||||
</form>
|
</form>
|
||||||
|
|
||||||
<div class="setting-box">
|
<div class="setting-box">
|
||||||
<el-checkbox v-model="daily" @change="updateReminders">{{ lang('daily reminder') }}</el-checkbox>
|
<el-checkbox v-model="daily" @change="updateReminders">{{ lang('daily reminder') }}</el-checkbox>
|
||||||
</div>
|
</div>
|
||||||
@ -38,6 +40,7 @@
|
|||||||
|
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
|
config: window.config,
|
||||||
reminders_send_to: '',
|
reminders_send_to: '',
|
||||||
success: false,
|
success: false,
|
||||||
daily: false,
|
daily: false,
|
||||||
@ -78,7 +81,7 @@
|
|||||||
|
|
||||||
updateReminders() {
|
updateReminders() {
|
||||||
this.SET_LOADING(true);
|
this.SET_LOADING(true);
|
||||||
|
|
||||||
const daily = this.daily;
|
const daily = this.daily;
|
||||||
const weekly = this.weekly;
|
const weekly = this.weekly;
|
||||||
|
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
<template>
|
<template>
|
||||||
|
|
||||||
<div class="settings-box" v-if=" ! loading">
|
<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()">
|
<form class="login-form" @submit.prevent="editUser()">
|
||||||
<input type="text" :placeholder="lang('username')" v-model="username">
|
<input type="text" :placeholder="lang('username')" v-model="username">
|
||||||
<input type="password" :placeholder="lang('password')" v-model="password" autocomplete="off">
|
<input type="password" :placeholder="lang('password')" v-model="password" autocomplete="off">
|
||||||
@ -31,6 +32,7 @@
|
|||||||
|
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
|
config: window.config,
|
||||||
username: '',
|
username: '',
|
||||||
password: '',
|
password: '',
|
||||||
success: false
|
success: false
|
||||||
@ -72,4 +74,4 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
@ -1,9 +1,10 @@
|
|||||||
import http from 'axios';
|
import http from 'axios';
|
||||||
http.defaults.headers.common['X-CSRF-TOKEN'] = document.querySelector('#token').getAttribute('content');
|
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 = {
|
const config = {
|
||||||
|
env,
|
||||||
uri,
|
uri,
|
||||||
url,
|
url,
|
||||||
auth,
|
auth,
|
||||||
|
@ -9,9 +9,10 @@
|
|||||||
<title>Flox</title>
|
<title>Flox</title>
|
||||||
<link rel="stylesheet" href="{{ url('assets/app.css') }}">
|
<link rel="stylesheet" href="{{ url('assets/app.css') }}">
|
||||||
<link href="{{ url('assets/favicon.ico?v=3') }}" rel="icon" type="image/x-icon">
|
<link href="{{ url('assets/favicon.ico?v=3') }}" rel="icon" type="image/x-icon">
|
||||||
|
|
||||||
</head>
|
</head>
|
||||||
<body
|
<body
|
||||||
|
data-env="{{ config('app.env') }}"
|
||||||
data-url="{{ url('/') }}"
|
data-url="{{ url('/') }}"
|
||||||
data-uri="{{ config('app.CLIENT_URI') }}"
|
data-uri="{{ config('app.CLIENT_URI') }}"
|
||||||
data-poster-tmdb="{{ config('services.tmdb.poster') }}"
|
data-poster-tmdb="{{ config('services.tmdb.poster') }}"
|
||||||
@ -32,7 +33,7 @@
|
|||||||
<site-footer></site-footer>
|
<site-footer></site-footer>
|
||||||
@endif
|
@endif
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<script src="{{ url('assets/vendor.js') }}"></script>
|
<script src="{{ url('assets/vendor.js') }}"></script>
|
||||||
<script src="{{ url('assets/app.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