Compare commits

..

3 Commits

Author SHA1 Message Date
Kode
43f9b76ff3 Merge branch '2.x' into 2.5.0 2022-03-18 16:42:02 +00:00
Kode
ffcfef8d1c Merge branch '2.x' into 2.5.0 2022-03-18 16:36:30 +00:00
Kode
03edaea99a Initial start of adding an API 2022-03-18 16:33:46 +00:00
13206 changed files with 390259 additions and 868134 deletions

View File

@@ -9,13 +9,6 @@ LOG_CHANNEL=daily
DB_CONNECTION=sqlite
DB_DATABASE=app.sqlite
#DB_CONNECTION=<mysql | pgsql>
#DB_HOST=<hostname | ip>
#DB_PORT=<port number>
#DB_DATABASE=<database>
#DB_USERNAME=<user>
#DB_PASSWORD=<password>
BROADCAST_DRIVER=log
CACHE_DRIVER=file
QUEUE_CONNECTION=sync

View File

@@ -1,3 +0,0 @@
huebee.js
jquery-ui.min.js
bootstrap.js

View File

@@ -1,13 +0,0 @@
{
"extends": ["airbnb-base", "prettier"],
"plugins": ["prettier"],
"rules": {
"prettier/prettier": ["error"]
},
"env": {
"browser": true
},
"globals": {
"$": true
}
}

View File

@@ -1,16 +0,0 @@
name: Issue & PR Tracker
on:
issues:
types: [opened,reopened,labeled,unlabeled,closed]
pull_request_target:
types: [opened,reopened,review_requested,review_request_removed,labeled,unlabeled,closed]
pull_request_review:
types: [submitted,edited,dismissed]
jobs:
manage-project:
permissions:
issues: write
uses: linuxserver/github-workflows/.github/workflows/issue-pr-tracker.yml@v1
secrets: inherit

View File

@@ -1,13 +0,0 @@
name: Mark stale issues and pull requests
on:
schedule:
- cron: '35 15 * * *'
workflow_dispatch:
jobs:
stale:
permissions:
issues: write
pull-requests: write
uses: linuxserver/github-workflows/.github/workflows/issues-cron.yml@v1
secrets: inherit

View File

@@ -1,59 +0,0 @@
name: Tests (PHP)
on: [pull_request]
jobs:
tests:
name: Run tests
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v1
- name: Setup PHP, with composer and extensions
uses: shivammathur/setup-php@v2 #https://github.com/shivammathur/setup-php
with:
php-version: '8.3'
extensions: mbstring, dom, fileinfo, mysql, libxml, xml, xmlwriter, dom, tokenizer, filter, json, phar, pcre, openssl, pdo, intl, curl
- name: Cache composer dependencies
uses: actions/cache@v1
with:
path: vendor
key: composer-${{ hashFiles('composer.lock') }}
#- name: Run composer install
# run: composer install -n --prefer-dist
# env:
# APP_ENV: testing
- name: Prepare Laravel Application
run: |
cp .env.example .env
php artisan key:generate
- name: Cache yarn dependencies
uses: actions/cache@v1
with:
path: node_modules
key: yarn-${{ hashFiles('yarn.lock') }}
- name: Run yarn
run: yarn && yarn dev
- name: Run ESLint
run: yarn lint
- name: Run tests
run: php artisan test
env:
APP_ENV: testing
- name: Php code sniffer
run: ./vendor/bin/phpcs --config-set ignore_warnings_on_exit 1
- name: Upload artifacts
uses: actions/upload-artifact@master
if: failure()
with:
name: Logs
path: ./storage/logs

2
.gitignore vendored
View File

@@ -3,7 +3,6 @@
/public/hot
/public/storage
/storage/*.key
/storage/debugbar
/.idea
/.vagrant
Homestead.json
@@ -28,4 +27,3 @@ yarn-error.log
.VolumeIcon.icns
storage/app/public/avatars/*
.env
.phpunit.result.cache

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@@ -2,199 +2,126 @@
namespace App;
use GuzzleHttp\Exception\GuzzleException;
use Illuminate\Database\Eloquent\Builder;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Support\Collection;
use Illuminate\Support\Facades\Log;
/**
* App\Application
*
* @property string $appid
* @property string $name
* @property string|null $sha
* @property string|null $icon
* @property string|null $website
* @property string|null $license
* @property string|null $description
* @property int $enhanced
* @property string $tile_background
* @property \Illuminate\Support\Carbon|null $created_at
* @property \Illuminate\Support\Carbon|null $updated_at
* @property string|null $class
* @method static Builder|Application newModelQuery()
* @method static Builder|Application newQuery()
* @method static Builder|Application query()
* @method static Builder|Application whereAppid($value)
* @method static Builder|Application whereClass($value)
* @method static Builder|Application whereCreatedAt($value)
* @method static Builder|Application whereDescription($value)
* @method static Builder|Application whereEnhanced($value)
* @method static Builder|Application whereIcon($value)
* @method static Builder|Application whereLicense($value)
* @method static Builder|Application whereName($value)
* @method static Builder|Application whereSha($value)
* @method static Builder|Application whereTileBackground($value)
* @method static Builder|Application whereUpdatedAt($value)
* @method static Builder|Application whereWebsite($value)
*/
class Application extends Model
{
/**
* @var bool
*/
public $incrementing = false;
/**
* @var string
*/
protected $primaryKey = 'appid';
/**
* @return mixed
*/
//
public function icon()
{
if (! file_exists(storage_path('app/public/'.$this->icon))) {
if(!file_exists(storage_path('app/public/'.$this->icon))) {
$img_src = app_path('SupportedApps/'.$this->name.'/'.str_replace('icons/', '', $this->icon));
$img_dest = storage_path('app/public/'.$this->icon);
//die("i: ".$img_src);
@copy($img_src, $img_dest);
}
return $this->icon;
}
public function iconView(): string
public function iconView()
{
return asset('storage/'.$this->icon);
}
public function defaultColour(): string
public function defaultColour()
{
// check if light or dark
if ($this->tile_background == 'light') {
return '#fafbfc';
}
if($this->tile_background == 'light') return '#fafbfc';
return '#161b1f';
}
public function class(): string
public function class()
{
$name = $this->name;
$name = preg_replace('/[^\p{L}\p{N}]/u', '', $name);
return \App\SupportedApps::class.'\\'.$name.'\\'.$name;
}
/**
* @param $name
*/
public static function classFromName($name): string
{
$name = preg_replace('/[^\p{L}\p{N}]/u', '', $name);
$class = \App\SupportedApps::class.'\\'.$name.'\\'.$name;
$name = preg_replace('/[^\p{L}\p{N}]/u', '', $name);
$class = '\App\SupportedApps\\'.$name.'\\'.$name;
return $class;
}
public static function apps(): Collection
public static function classFromName($name)
{
$name = preg_replace('/[^\p{L}\p{N}]/u', '', $name);
$class = '\App\SupportedApps\\'.$name.'\\'.$name;
return $class;
}
public static function apps()
{
$json = json_decode(file_get_contents(storage_path('app/supportedapps.json'))) ?? [];
$apps = collect($json->apps);
return $apps->sortBy('name', SORT_NATURAL | SORT_FLAG_CASE);
$sorted = $apps->sortBy('name', SORT_NATURAL|SORT_FLAG_CASE);
return $sorted;
}
public static function autocomplete(): array
public static function autocomplete()
{
$apps = self::apps();
$list = [];
foreach ($apps as $app) {
$list[] = (object) [
foreach($apps as $app) {
$list[] = (object)[
'label' => $app->name,
'value' => $app->appid,
'value' => $app->appid
];
}
return $list;
}
/**
* @param $appid
* @return mixed|null
* @throws GuzzleException
*/
public static function getApp($appid)
{
Log::debug("Get app triggered for: $appid");
$localapp = self::where('appid', $appid)->first();
$localapp = Application::where('appid', $appid)->first();
$app = self::single($appid);
$application = ($localapp) ? $localapp : new self;
$application = ($localapp) ? $localapp : new Application;
// Files missing? || app not in db || old sha version
if (! file_exists(app_path('SupportedApps/'.className($app->name))) ||
! $localapp ||
$localapp->sha !== $app->sha
) {
$gotFiles = SupportedApps::getFiles($app);
if ($gotFiles) {
if(!file_exists(app_path('SupportedApps/'.className($app->name)))) {
SupportedApps::getFiles($app);
SupportedApps::saveApp($app, $application);
} else {
// check if there has been an update for this app
if($localapp) {
if($localapp->sha !== $app->sha) {
SupportedApps::getFiles($app);
$app = SupportedApps::saveApp($app, $application);
}
} else {
SupportedApps::getFiles($app);
$app = SupportedApps::saveApp($app, $application);
}
}
return $app;
}
/**
* @param $appid
* @return mixed|null
*/
public static function single($appid)
{
$apps = self::apps();
$app = $apps->where('appid', $appid)->first();
if ($app === null) {
// Try in db for Private App
$appModel = self::where('appid', $appid)->first();
if ($appModel) {
$app = json_decode($appModel->toJson());
}
}
if ($app === null) {
return null;
}
$classname = preg_replace('/[^\p{L}\p{N}]/u', '', $app->name);
$app->class = \App\SupportedApps::class.'\\'.$classname.'\\'.$classname;
if ($app === null) return null;
$classname = preg_replace('/[^\p{L}\p{N}]/u', '', $app->name);
$app->class = '\App\SupportedApps\\'.$classname.'\\'.$classname;
return $app;
}
public static function applist(): array
public static function applist()
{
$list = [];
$list['null'] = 'None';
$apps = self::apps();
foreach ($apps as $app) {
foreach($apps as $app) {
$list[$app->appid] = $app->name;
}
// Check for private apps in the db
$appsListFromDB = self::all(['appid', 'name']);
foreach ($appsListFromDB as $app) {
// Already existing keys are overwritten,
// only private apps should be added at the end
$list[$app->appid] = $app->name;
}
return $list;
}
}

View File

@@ -2,10 +2,9 @@
namespace App\Console\Commands;
use Illuminate\Console\Command;
use App\Application;
use App\SupportedApps;
use Illuminate\Console\Command;
use Illuminate\Support\Facades\Storage;
class RegisterApp extends Command
{
@@ -14,7 +13,7 @@ class RegisterApp extends Command
*
* @var string
*/
protected $signature = 'register:app {folder} {--remove}';
protected $signature = 'register:app {folder}';
/**
* The console command description.
@@ -35,68 +34,46 @@ class RegisterApp extends Command
/**
* Execute the console command.
*
* @return mixed
*/
public function handle(): void
public function handle()
{
$folder = $this->argument('folder');
if ($folder == 'all') {
if($folder == 'all') {
$apps = scandir(app_path('SupportedApps'));
foreach ($apps as $folder) {
if ($folder == '.' || $folder == '..') {
continue;
}
foreach($apps as $folder) {
if($folder == '.' || $folder == '..') continue;
$this->addApp($folder);
}
} else {
$this->addApp($folder, $this->option('remove'));
$this->addApp($folder);
}
}
/**
* @param $folder
*/
public function addApp($folder, bool $remove = false): void
public function addApp($folder)
{
$json = app_path('SupportedApps/'.$folder.'/app.json');
if (!file_exists($json)) {
$this->error('Could not find ' . $json);
return;
}
$app = json_decode(file_get_contents($json));
if (!isset($app->appid)) {
$this->error('No App ID for - ' . $folder);
return;
}
$exists = Application::find($app->appid);
if ($exists) {
if ($remove) {
$exists->delete();
$this->info('Application Removed - ' . $app->name . ' - ' . $app->appid);
return;
if(file_exists($json)) {
$app = json_decode(file_get_contents($json));
if(isset($app->appid)) {
$exists = Application::find($app->appid);
if($exists) {
$this->error('Application already registered - '.$exists->name." - ".$exists->appid);
} else {
// Doesn't exist so add it
SupportedApps::saveApp($app, new Application);
$this->info("Application Added - ".$app->name." - ".$app->appid);
}
} else {
$this->error('No App ID for - '.$folder);
}
$this->error('Application already registered - ' . $exists->name . ' - ' . $exists->appid);
return;
} else {
$this->error('Could not find '.$json);
}
// Doesn't exist so add it
SupportedApps::saveApp($app, new Application);
$this->saveIcon($folder, $app->icon);
$this->info('Application Added - ' . $app->name . ' - ' . $app->appid);
}
/**
* @param $appFolder
* @param $icon
*/
private function saveIcon($appFolder, $icon): void
{
$iconPath = app_path('SupportedApps/' . $appFolder . '/' . $icon);
$contents = file_get_contents($iconPath);
Storage::disk('public')->put('icons/'.$icon, $contents);
}
}

View File

@@ -8,9 +8,21 @@ use Illuminate\Foundation\Console\Kernel as ConsoleKernel;
class Kernel extends ConsoleKernel
{
/**
* Define the application's command schedule.
* The Artisan commands provided by your application.
*
* @var array
*/
protected function schedule(Schedule $schedule): void
protected $commands = [
//
];
/**
* Define the application's command schedule.
*
* @param \Illuminate\Console\Scheduling\Schedule $schedule
* @return void
*/
protected function schedule(Schedule $schedule)
{
// $schedule->command('inspire')
// ->hourly();
@@ -18,8 +30,10 @@ class Kernel extends ConsoleKernel
/**
* Register the commands for the application.
*
* @return void
*/
protected function commands(): void
protected function commands()
{
$this->load(__DIR__.'/Commands');

View File

@@ -1,12 +1,12 @@
<?php
<?php namespace App;
namespace App;
use GuzzleHttp\Exception\GuzzleException;
use GuzzleHttp\Client;
interface EnhancedApps
{
public function test();
public function livestats();
public function url($endpoint);
}
}

View File

@@ -8,9 +8,18 @@ use Throwable;
class Handler extends ExceptionHandler
{
/**
* The list of the inputs that are never flashed to the session on validation exceptions.
* A list of the exception types that are not reported.
*
* @var array<int, string>
* @var array
*/
protected $dontReport = [
//
];
/**
* A list of the inputs that are never flashed for validation exceptions.
*
* @var array
*/
protected $dontFlash = [
'current_password',
@@ -20,8 +29,10 @@ class Handler extends ExceptionHandler
/**
* Register the exception handling callbacks for the application.
*
* @return void
*/
public function register(): void
public function register()
{
$this->reportable(function (Throwable $e) {
//

View File

@@ -2,137 +2,78 @@
use Illuminate\Support\Str;
/**
* @param $bytes
* @param bool $is_drive_size
* @param string $beforeunit
* @param string $afterunit
* @return string
*/
function format_bytes($bytes, bool $is_drive_size = true, string $beforeunit = '', string $afterunit = ''): string
function format_bytes($bytes, $is_drive_size = true, $beforeunit = '', $afterunit = '')
{
$btype = ($is_drive_size === true) ? 1000 : 1024;
$labels = ['B', 'KB', 'MB', 'GB', 'TB'];
// use 1000 rather than 1024 to simulate HD size not real size
for ($x = 0; $bytes >= $btype && $x < (count($labels) - 1); $bytes /= $btype, $x++) ;
if ($labels[$x] == 'TB') {
return round($bytes, 3) . $beforeunit . $labels[$x] . $afterunit;
} elseif ($labels[$x] == 'GB') {
return round($bytes, 2) . $beforeunit . $labels[$x] . $afterunit;
} elseif ($labels[$x] == 'MB') {
return round($bytes, 2) . $beforeunit . $labels[$x] . $afterunit;
} else {
return round($bytes, 0) . $beforeunit . $labels[$x] . $afterunit;
}
$btype = ($is_drive_size === true) ? 1000 : 1024;
$labels = array('B','KB','MB','GB','TB');
for($x = 0; $bytes >= $btype && $x < (count($labels) - 1); $bytes /= $btype, $x++); // use 1000 rather than 1024 to simulate HD size not real size
if($labels[$x] == "TB") return(round($bytes, 3).$beforeunit.$labels[$x].$afterunit);
elseif($labels[$x] == "GB") return(round($bytes, 2).$beforeunit.$labels[$x].$afterunit);
elseif($labels[$x] == "MB") return(round($bytes, 2).$beforeunit.$labels[$x].$afterunit);
else return(round($bytes, 0).$beforeunit.$labels[$x].$afterunit);
}
/**
* @param $title
* @param string $separator
* @param string $language
* @return string
*/
function str_slug($title, string $separator = '-', string $language = 'en'): string
function str_slug($title, $separator = '-', $language = 'en')
{
return Str::slug($title, $separator, $language);
}
if (!function_exists('str_is')) {
if (! function_exists('str_is')) {
/**
* Determine if a given string matches a given pattern.
*
* @param string|array $pattern
* @param string $value
* @param string|array $pattern
* @param string $value
* @return bool
*
* @deprecated Str::is() should be used directly instead. Will be removed in Laravel 6.0.
*/
function str_is($pattern, string $value): bool
function str_is($pattern, $value)
{
return Str::is($pattern, $value);
}
}
/**
* @param $hex
* @return float|int
*/
function get_brightness($hex)
{
function get_brightness($hex) {
// returns brightness value from 0 to 255
// strip off any leading #
// $hex = str_replace('#', '', $hex);
$hex = preg_replace("/[^0-9A-Fa-f]/", '', $hex);
if (strlen($hex) == 3) {
$hex = $hex[0] . $hex[0] . $hex[1] . $hex[1] . $hex[2] . $hex[2];
$hex = str_replace('#', '', $hex);
if(strlen($hex) == 3) {
$hex = $hex[0].$hex[0].$hex[1].$hex[1].$hex[2].$hex[2];
}
$c_r = hexdec(substr($hex, 0, 2));
$c_g = hexdec(substr($hex, 2, 2));
$c_b = hexdec(substr($hex, 4, 2));
return (($c_r * 299) + ($c_g * 587) + ($c_b * 114)) / 1000;
}
/**
* @param $hex
* @return string
*/
function title_color($hex): string
function title_color($hex)
{
if (get_brightness($hex) > 130) {
if(get_brightness($hex) > 130) {
return ' black';
} else {
return ' white';
}
}
/**
* @return string
*/
function getLinkTargetAttribute(): string
function getLinkTargetAttribute()
{
$target = \App\Setting::fetch('window_target');
if ($target === 'current') {
if($target === 'current') {
return '';
} else {
return ' target="' . $target . '"';
}
}
/**
* @param $name
* @return array|string|string[]|null
*/
function className($name)
{
return preg_replace('/[^\p{L}\p{N}]/u', '', $name);
$name = preg_replace('/[^\p{L}\p{N}]/u', '', $name);
return $name;
}
/**
* @param string $file
* @param string $extension
* @return bool
*/
function isImage(string $file, string $extension): bool
{
$allowedExtensions = ['jpg', 'jpeg', 'png', 'bmp', 'gif', 'svg', 'webp'];
if (!in_array($extension, $allowedExtensions)) {
return false;
}
$tempFileName = @tempnam("/tmp", "image-check-");
$handle = fopen($tempFileName, "w");
fwrite($handle, $file);
fclose($handle);
if ($extension == 'svg') {
return 'image/svg+xml' === mime_content_type($tempFileName);
}
$size = @getimagesize($tempFileName);
return is_array($size) && str_starts_with($size['mime'], 'image');
}

View File

@@ -0,0 +1,105 @@
<?php
namespace App\Http\Controllers;
use Illuminate\Http\Request;
use App\Item;
use App\SettingUser;
use App\User;
class ApiItemController extends Controller
{
protected $api_key;
protected $user;
function __construct(Request $request) {
$this->middleware('apikey');
$key = $request->input('api_key');
if ($key) {
$details = SettingUser::where('setting_id', 12)->where('uservalue', $key)->first();
$this->api_key = $key;
$this->user = User::find($details->user_id);
}
}
/**
* Display a listing of the resource.
*
* @return \Illuminate\Http\Response
*/
public function index()
{
return $this->user->items;
}
/**
* Show the form for creating a new resource.
*
* @return \Illuminate\Http\Response
*/
public function create()
{
}
/**
* Store a newly created resource in storage.
*
* @param \Illuminate\Http\Request $request
* @return \Illuminate\Http\Response
*/
public function store(Request $request)
{
$request->merge([
'user_id' => $this->user->id
]);
// die(print_r($request->all()));
Item::create($request->all());
}
/**
* Display the specified resource.
*
* @param int $id
* @return \Illuminate\Http\Response
*/
public function show($id)
{
//
}
/**
* Show the form for editing the specified resource.
*
* @param int $id
* @return \Illuminate\Http\Response
*/
public function edit($id)
{
//
}
/**
* Update the specified resource in storage.
*
* @param \Illuminate\Http\Request $request
* @param int $id
* @return \Illuminate\Http\Response
*/
public function update(Request $request, $id)
{
//
}
/**
* Remove the specified resource from storage.
*
* @param int $id
* @return \Illuminate\Http\Response
*/
public function destroy($id)
{
//
}
}

View File

@@ -3,18 +3,12 @@
namespace App\Http\Controllers\Auth;
use App\Http\Controllers\Controller;
use App\User;
use Illuminate\Contracts\Foundation\Application;
use Illuminate\Contracts\View\Factory;
use Illuminate\Contracts\View\View;
use Illuminate\Foundation\Auth\AuthenticatesUsers;
use Illuminate\Http\RedirectResponse;
use App\User;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Auth;
use Illuminate\Support\Facades\Session;
use Illuminate\Support\Facades\URL;
use Illuminate\Validation\ValidationException;
use Symfony\Component\HttpFoundation\Response;
class LoginController extends Controller
{
@@ -36,7 +30,7 @@ class LoginController extends Controller
*
* @var string
*/
protected string $redirectTo = '/';
protected $redirectTo = '/';
/**
* Create a new controller instance.
@@ -46,10 +40,10 @@ class LoginController extends Controller
public function __construct()
{
Session::put('backUrl', URL::previous());
$this->middleware('guest')->except(['logout','autologin']);
$this->middleware('guest')->except('logout');
}
public function username(): string
public function username()
{
return 'username';
}
@@ -57,10 +51,12 @@ class LoginController extends Controller
/**
* Handle a login request to the application.
*
* @param \Illuminate\Http\Request $request
* @return \Illuminate\Http\RedirectResponse|\Illuminate\Http\Response|\Illuminate\Http\JsonResponse
*
* @throws ValidationException
* @throws \Illuminate\Validation\ValidationException
*/
public function login(Request $request): Response
public function login(Request $request)
{
$current_user = User::currentUser();
$request->merge(['username' => $current_user->username, 'remember' => true]);
@@ -92,57 +88,39 @@ class LoginController extends Controller
{
}
public function setUser(User $user): RedirectResponse
public function setUser(User $user)
{
Auth::logout();
session(['current_user' => $user]);
return redirect()->route('dash');
}
/**
* @param $uuid
*/
public function autologin($uuid): RedirectResponse
public function autologin($uuid)
{
Auth::logout();
$user = User::where('autologin', $uuid)->first();
if (!$user) {
return redirect()->route('dash');
}
Auth::login($user, true);
session(['current_user' => $user]);
return redirect()->route('dash');
}
/**
* Show the application's login form.
*
* @return Application|Factory|View
* @return \Illuminate\Http\Response
*/
public function showLoginForm(): \Illuminate\View\View
public function showLoginForm()
{
return view('auth.login');
}
/**
* @param $user
*/
protected function authenticated(Request $request, $user): RedirectResponse
protected function authenticated(Request $request, $user)
{
return back();
}
/**
* @return mixed|string
*/
public function redirectTo()
{
return Session::get('url.intended') ? Session::get('url.intended') : $this->redirectTo;
}
}

View File

@@ -2,10 +2,10 @@
namespace App\Http\Controllers\Auth;
use App\Http\Controllers\Controller;
use App\User;
use Illuminate\Foundation\Auth\RegistersUsers;
use App\Http\Controllers\Controller;
use Illuminate\Support\Facades\Validator;
use Illuminate\Foundation\Auth\RegistersUsers;
class RegisterController extends Controller
{
@@ -27,7 +27,7 @@ class RegisterController extends Controller
*
* @var string
*/
protected string $redirectTo = '/';
protected $redirectTo = '/';
/**
* Create a new controller instance.
@@ -41,8 +41,11 @@ class RegisterController extends Controller
/**
* Get a validator for an incoming registration request.
*
* @param array $data
* @return \Illuminate\Contracts\Validation\Validator
*/
protected function validator(array $data): \Illuminate\Contracts\Validation\Validator
protected function validator(array $data)
{
return Validator::make($data, [
'name' => 'required|string|max:255',
@@ -53,8 +56,11 @@ class RegisterController extends Controller
/**
* Create a new user instance after a valid registration.
*
* @param array $data
* @return \App\User
*/
protected function create(array $data): User
protected function create(array $data)
{
return User::create([
'name' => $data['name'],

View File

@@ -25,7 +25,7 @@ class ResetPasswordController extends Controller
*
* @var string
*/
protected string $redirectTo = '/';
protected $redirectTo = '/';
/**
* Create a new controller instance.

View File

@@ -2,14 +2,16 @@
namespace App\Http\Controllers;
use App\User;
use Illuminate\Foundation\Auth\Access\AuthorizesRequests;
use Illuminate\Foundation\Validation\ValidatesRequests;
use Illuminate\Foundation\Bus\DispatchesJobs;
use Illuminate\Routing\Controller as BaseController;
use Illuminate\Foundation\Validation\ValidatesRequests;
use Illuminate\Foundation\Auth\Access\AuthorizesRequests;
use Illuminate\Support\Facades\Auth;
use App\User;
class Controller extends BaseController
{
use AuthorizesRequests, ValidatesRequests;
use AuthorizesRequests, DispatchesJobs, ValidatesRequests;
protected $user;
@@ -20,6 +22,7 @@ class Controller extends BaseController
//print_r($this->user);
return $next($request);
});
}
public function user()

View File

@@ -1,51 +0,0 @@
<?php
namespace App\Http\Controllers;
use App\Item;
use App\User;
use Illuminate\Contracts\Container\BindingResolutionException;
use Illuminate\Http\JsonResponse;
use Illuminate\Http\Request;
use Illuminate\Http\Response;
use Illuminate\Support\Facades\RateLimiter;
class HealthController extends Controller
{
private static function getUsers(): int
{
return User::count();
}
private static function getItems(): int
{
return Item::select('id')
->where('deleted_at', null)
->where('type', '0')
->count();
}
/**
* Handle the incoming request.
*
* @return JsonResponse|Response
* @throws BindingResolutionException
*/
public function __invoke(Request $request)
{
$REQUESTS_MAX_PER_MIN = 30;
$STATUS_TOO_MANY_REQUESTS = 429;
if (RateLimiter::remaining('health', $REQUESTS_MAX_PER_MIN) < 1) {
return response()->make('Too many attempts.', $STATUS_TOO_MANY_REQUESTS);
}
RateLimiter::hit('health');
return response()->json([
'status' => 'ok',
'items' => self::getItems(),
'users' => self::getUsers(),
]);
}
}

View File

@@ -2,7 +2,7 @@
namespace App\Http\Controllers;
use Illuminate\Http\RedirectResponse;
use Illuminate\Http\Request;
class HomeController extends Controller
{
@@ -13,14 +13,15 @@ class HomeController extends Controller
*/
public function __construct()
{
parent::__construct();
$this->middleware('auth');
}
/**
* Show the application dashboard.
*
* @return \Illuminate\Http\Response
*/
public function index(): RedirectResponse
public function index()
{
return redirect()->route('dash');
}

View File

@@ -1,28 +0,0 @@
<?php
namespace App\Http\Controllers;
use Illuminate\Http\Request;
use Illuminate\View\View;
class ImportController extends Controller
{
/**
* Instantiate a new controller instance.
*
* @return void
*/
public function __construct()
{
parent::__construct();
$this->middleware('allowed');
}
/**
* Handle the incoming request.
*/
public function __invoke(Request $request): View
{
return view('items.import');
}
}

View File

@@ -2,81 +2,59 @@
namespace App\Http\Controllers;
use Artisan;
use App\Application;
use App\Item;
use App\Jobs\ProcessApps;
use App\Setting;
use App\User;
use GuzzleHttp\Client;
use GuzzleHttp\Exception\ConnectException;
use GuzzleHttp\Exception\GuzzleException;
use GuzzleHttp\Exception\ServerException;
use Illuminate\Contracts\View\View;
use Illuminate\Database\Eloquent\Collection;
use Illuminate\Http\RedirectResponse;
use GrahamCampbell\GitHub\Facades\GitHub;
use Illuminate\Http\Request;
use Illuminate\Routing\Redirector;
use Illuminate\Support\Facades\Log;
use Illuminate\Support\Facades\Storage;
use Illuminate\Support\Facades\URL;
use Illuminate\Validation\ValidationException;
use Psr\Http\Message\ResponseInterface;
use Psr\Http\Message\StreamInterface;
use App\SupportedApps;
use App\Jobs\ProcessApps;
use App\Search;
use Illuminate\Support\Facades\Route;
use GuzzleHttp\Exception\GuzzleException;
use GuzzleHttp\Client;
use Illuminate\Support\Facades\Log;
class ItemController extends Controller
{
public function __construct()
{
parent::__construct();
$this->middleware('allowed');
}
/**
/**
* Display a listing of the resource on the dashboard.
*
* @return \Illuminate\Http\Response
*/
public function dash(): View
public function dash()
{
$treat_tags_as = \App\Setting::fetch('treat_tags_as');
$data['apps'] = Item::whereHas('parents', function ($query) {
$query->where('id', 0);
})->orWhere('type', 1)->pinned()->orderBy('order', 'asc')->get();
$data["treat_tags_as"] = $treat_tags_as;
if ($treat_tags_as == 'categories') {
$data['categories'] = Item::whereHas('children')->with('children', function ($query) {
$query->pinned()->orderBy('order', 'asc');
})->pinned()->orderBy('order', 'asc')->get();
} elseif ($treat_tags_as == 'tags') {
$data['apps'] = Item::with('parents')->where('type', 0)->pinned()->orderBy('order', 'asc')->get();
$data['all_apps'] = Item::where('type', 0)->orderBy('order', 'asc')->get();
$data['taglist'] = Item::where('id', 0)->orWhere(function($query) {
$query->where('type', 1)->pinned();
})->orderBy('order', 'asc')->get();
} else {
$data['apps'] = Item::whereHas('parents', function ($query) {
$query->where('id', 0);
})->orWhere('type', 1)->pinned()->orderBy('order', 'asc')->get();
$data['all_apps'] = Item::whereHas('parents', function ($query) {
$query->where('id', 0);
})->orWhere(function ($query) {
$query->where('type', 1)->whereNot('id', 0);
})->orderBy('order', 'asc')->get();
}
$data['all_apps'] = Item::whereHas('parents', function ($query) {
$query->where('id', 0);
})->orWhere('type', 1)->orderBy('order', 'asc')->get();
//$data['all_apps'] = Item::doesntHave('parents')->get();
// die(print_r($data));
//die(print_r($data['apps']));
return view('welcome', $data);
}
/**
/**
* Set order on the dashboard.
*
* @return void
* @return \Illuminate\Http\Response
*/
public function setOrder(Request $request)
{
$order = array_filter($request->input('order'));
foreach ($order as $o => $id) {
foreach($order as $o => $id) {
$item = Item::find($id);
$item->order = $o;
$item->save();
@@ -86,108 +64,105 @@ class ItemController extends Controller
/**
* Pin item on the dashboard.
*
* @param $id
* @return \Illuminate\Http\Response
*/
public function pin($id): RedirectResponse
public function pin($id)
{
$item = Item::findOrFail($id);
$item->pinned = true;
$item->save();
$route = route('dash', []);
return redirect($route);
}
/**
/**
* Unpin item on the dashboard.
*
* @param $id
* @return \Illuminate\Http\Response
*/
public function unpin($id): RedirectResponse
public function unpin($id)
{
$item = Item::findOrFail($id);
$item->pinned = false;
$item->save();
$route = route('dash', []);
return redirect($route);
}
/**
/**
* Unpin item on the dashboard.
*
* @return RedirectResponse|View
* @return \Illuminate\Http\Response
*/
public function pinToggle($id, $ajax = false, $tag = false)
public function pinToggle($id, $ajax=false, $tag=false)
{
$item = Item::findOrFail($id);
$new = !(((bool)$item->pinned === true));
$new = ((bool)$item->pinned === true) ? false : true;
$item->pinned = $new;
$item->save();
if ($ajax) {
$item = Item::whereId($tag)->first();
$data['apps'] = new Collection;
if ((int)$tag === 0) {
$tags = Item::where('type', 1)->pinned()->orderBy('order', 'asc')->get();
$data['apps'] = $data['apps']->merge($tags);
if($ajax) {
if(is_numeric($tag) && $tag > 0) {
$item = Item::whereId($tag)->first();
$data['apps'] = $item->children()->pinned()->orderBy('order', 'asc')->get();
} else {
$data['apps'] = Item::pinned()->orderBy('order', 'asc')->get();
}
$apps = $item->children()->pinned()->orderBy('order', 'asc')->get();
$data['apps'] = $data['apps']->merge($apps);
$data['ajax'] = true;
return view('sortable', $data);
} else {
$route = route('dash', []);
return redirect($route);
}
}
/**
* Display a listing of the resource.
*
* @return \Illuminate\Http\Response
*/
public function index(Request $request): View
public function index(Request $request)
{
$trash = (bool)$request->input('trash');
$data['apps'] = Item::ofType('item')->orderBy('title', 'asc')->get();
$data['trash'] = Item::ofType('item')->onlyTrashed()->get();
if ($trash) {
if($trash) {
return view('items.trash', $data);
} else {
return view('items.list', $data);
}
}
/**
* Show the form for creating a new resource.
*
* @return \Illuminate\Http\Response
*/
public function create(): View
public function create()
{
//
$data['tags'] = Item::ofType('tag')->orderBy('title', 'asc')->pluck('title', 'id');
$data['tags']->prepend(__('app.dashboard'), 0);
$data['current_tags'] = '0';
return view('items.create', $data);
}
/**
* Show the form for editing the specified resource.
*
* @param int $id
* @return \Illuminate\Http\Response
*/
public function edit(int $id): View
public function edit($id)
{
// Get the item
$item = Item::find($id);
if ($item->appid === null && $item->class !== null) { // old apps won't have an app id so set it
if($item->appid === null && $item->class !== null) { // old apps wont have an app id so set it
$app = Application::where('class', $item->class)->first();
if ($app) {
if($app) {
$item->appid = $app->appid;
}
}
@@ -198,79 +173,49 @@ class ItemController extends Controller
//$data['current_tags'] = $data['item']->parent;
//die(print_r($data['current_tags']));
// show the edit form and pass the nerd
return view('items.edit', $data);
return view('items.edit', $data);
}
/**
* @param null $id
* @throws ValidationException
*/
public static function storelogic(Request $request, $id = null): Item
public function storelogic($request, $id = null)
{
$application = Application::single($request->input('appid'));
$validatedData = $request->validate([
'title' => 'required|max:255',
'url' => 'required',
'file' => 'image'
]);
if ($request->hasFile('file')) {
$path = $request->file('file')->store('icons', 'public');
if($request->hasFile('file')) {
$path = $request->file('file')->store('icons');
$request->merge([
'icon' => $path,
'icon' => $path
]);
} elseif (strpos($request->input('icon'), 'http') === 0) {
$options = [
"ssl" => [
"verify_peer" => false,
"verify_peer_name" => false,
],
];
} elseif(strpos($request->input('icon'), 'http') === 0) {
$contents = file_get_contents($request->input('icon'));
$file = $request->input('icon');
$path_parts = pathinfo($file);
$extension = $path_parts['extension'];
$contents = file_get_contents($request->input('icon'), false, stream_context_create($options));
if (!isImage($contents, $extension)) {
throw ValidationException::withMessages(['file' => 'Icon must be an image.']);
}
$path = 'icons/' . ($application ? $application->icon : md5($contents) . '.' . $extension);
// Private apps could have here duplicated icons folder
if (strpos($path, 'icons/icons/') !== false) {
$path = str_replace('icons/icons/', 'icons/', $path);
}
if (!Storage::disk('public')->exists($path)) {
Storage::disk('public')->put($path, $contents);
if ($application) {
$icon = $application->icon;
} else {
$file = $request->input('icon');
$path_parts = pathinfo($file);
$icon = md5($contents);
$icon .= '.'.$path_parts['extension'];
}
$path = 'icons/'.$icon;
Storage::disk('public')->put($path, $contents);
$request->merge([
'icon' => $path,
'icon' => $path
]);
}
$config = Item::checkConfig($request->input('config'));
// Don't overwrite the stored password if it wasn't submitted when updating the item
if ($id !== null && strpos($config, '"password":null') !== false) {
$storedItem = Item::find($id);
$storedConfigObject = json_decode($storedItem->getAttribute('description'));
$configObject = json_decode($config);
$configObject->password = $storedConfigObject->password;
$config = json_encode($configObject);
}
$current_user = User::currentUser();
$request->merge([
'description' => $config,
'user_id' => $current_user->getId(),
'user_id' => $current_user->id
]);
if ($request->input('appid') === 'null') {
if($request->input('appid') === 'null') {
$request->merge([
'class' => null,
]);
@@ -278,60 +223,75 @@ class ItemController extends Controller
$request->merge([
'class' => Application::classFromName($application->name),
]);
}
if ($id === null) {
if($id === null) {
$item = Item::create($request->all());
} else {
$item = Item::find($id);
$item->update($request->all());
}
$item->parents()->sync($request->tags);
return $item;
}
/**
* Store a newly created resource in storage.
*
* @param \Illuminate\Http\Request $request
* @return \Illuminate\Http\Response
*/
public function store(Request $request): RedirectResponse
public function store(Request $request)
{
self::storelogic($request);
$this->storelogic($request);
$route = route('dash', []);
return redirect($route)
->with('success', __('app.alert.success.item_created'));
}
/**
* Display the specified resource.
*
* @param int $id
* @return \Illuminate\Http\Response
*/
public function show(int $id): void
public function show($id)
{
//
}
/**
* Update the specified resource in storage.
*
* @param \Illuminate\Http\Request $request
* @param int $id
* @return \Illuminate\Http\Response
*/
public function update(Request $request, int $id): RedirectResponse
public function update(Request $request, $id)
{
self::storelogic($request, $id);
$this->storelogic($request, $id);
$route = route('dash', []);
return redirect($route)
->with('success', __('app.alert.success.item_updated'));
->with('success',__('app.alert.success.item_updated'));
}
/**
* Remove the specified resource from storage.
*
* @param int $id
* @return \Illuminate\Http\Response
*/
public function destroy(Request $request, int $id): RedirectResponse
public function destroy(Request $request, $id)
{
//
$force = (bool)$request->input('force');
if ($force) {
if($force) {
Item::withTrashed()
->where('id', $id)
->forceDelete();
@@ -340,40 +300,59 @@ class ItemController extends Controller
}
$route = route('items.index', []);
return redirect($route)
->with('success', __('app.alert.success.item_deleted'));
return redirect($route)
->with('success',__('app.alert.success.item_deleted'));
}
/**
* Restore the specified resource from soft deletion.
*
* @param int $id
* @return \Illuminate\Http\Response
*/
public function restore(int $id): RedirectResponse
public function restore($id)
{
//
Item::withTrashed()
->where('id', $id)
->restore();
->where('id', $id)
->restore();
$route = route('items.index', []);
return redirect($route)
->with('success', __('app.alert.success.item_restored'));
->with('success',__('app.alert.success.item_restored'));
}
/**
* Return details for supported apps
*
* @throws GuzzleException
* @return Json
*/
public function appload(Request $request): ?string
public function appload(Request $request)
{
$output = [];
$appid = $request->input('app');
if ($appid === 'null') {
return null;
}
if($appid === "null") return null;
/*$appname = $request->input('app');
//die($appname);
$app_details = Application::where('name', $appname)->firstOrFail();
$appclass = $app_details->class();
$app = new $appclass;
// basic details
$output['icon'] = $app_details->icon();
$output['name'] = $app_details->name;
$output['iconview'] = $app_details->iconView();
$output['colour'] = $app_details->defaultColour();
$output['class'] = $appclass;
// live details
if($app instanceof \App\EnhancedApps) {
$output['config'] = className($app_details->name).'.config';
} else {
$output['config'] = null;
}*/
$output['config'] = null;
$output['custom'] = null;
@@ -383,31 +362,21 @@ class ItemController extends Controller
$appdetails = Application::getApp($appid);
if ((bool)$app->enhanced === true) {
if((boolean)$app->enhanced === true) {
// if(!isset($app->config)) { // class based config
$output['custom'] = className($appdetails->name) . '.config';
$output['custom'] = className($appdetails->name).'.config';
// }
}
$output['colour'] = ($app->tile_background == 'light') ? '#fafbfc' : '#161b1f';
$output['iconview'] = config('app.appsource').'icons/' . $app->icon;
if (strpos($app->icon, '://') !== false) {
$output['iconview'] = $app->icon;
} elseif (strpos($app->icon, 'icons/') !== false) {
// Private apps have the icon locally
$output['iconview'] = URL::to('/') . '/storage/' . $app->icon;
$output['icon'] = str_replace('icons/', '', $output['icon']);
} else {
$output['iconview'] = config('app.appsource') . 'icons/' . $app->icon;
}
;
return json_encode($output);
}
/**
* @return void
*/
public function testConfig(Request $request)
{
$data = $request->input('data');
@@ -415,91 +384,71 @@ class ItemController extends Controller
$single = Application::single($data['type']);
$app = $single->class;
// If password is not resubmitted fill it from the database when in edit mode
if (array_key_exists('password', $data) &&
$data['password'] === null &&
array_key_exists('id', $data)
) {
$item = Item::find($data['id']);
if ($item) {
$itemConfig = $item->getConfig();
$data['password'] = $itemConfig->password;
}
}
$app_details = new $app();
$app_details->config = (object)$data;
$app_details->test();
}
/**
* @param $url
* @param array|bool $overridevars
* @throws GuzzleException
*/
public function execute($url, array $attrs = [], $overridevars = false): ?ResponseInterface
public function execute($url, $attrs = [], $overridevars=false)
{
$res = null;
$vars = ($overridevars !== false) ?
$overridevars : [
'http_errors' => false,
'timeout' => 15,
'connect_timeout' => 15,
'verify' => false,
];
$overridevars : [
'http_errors' => false,
'timeout' => 15,
'connect_timeout' => 15,
'verify' => false
];
$client = new Client($vars);
$method = 'GET';
try {
return $client->request($method, $url, $attrs);
} catch (ConnectException $e) {
Log::error('Connection refused');
return $client->request($method, $url, $attrs);
} catch (\GuzzleHttp\Exception\ConnectException $e) {
Log::error("Connection refused");
Log::debug($e->getMessage());
} catch (ServerException $e) {
} catch (\GuzzleHttp\Exception\ServerException $e) {
Log::debug($e->getMessage());
}
return null;
return $res;
}
/**
* @param $url
* @throws GuzzleException
*/
public function websitelookup($url): StreamInterface
{
$url = base64_decode($url);
$data = $this->execute($url);
public function websitelookup($url)
{
$url = \base64_decode($url);
$data = $this->execute($url);
return $data->getBody();
}
/**
* @param $id
* @return void
*/
public function getStats($id)
{
$item = Item::find($id);
$config = $item->getconfig();
if (isset($item->class)) {
if(isset($item->class)) {
$application = new $item->class;
$application->config = $config;
echo $application->livestats();
}
}
/**
* @return \Illuminate\Contracts\Foundation\Application|RedirectResponse|Redirector
*/
public function checkAppList(): RedirectResponse
public function checkAppList()
{
ProcessApps::dispatch();
$route = route('items.index');
return redirect($route)
->with('success', __('app.alert.success.updating'));
}
}

View File

@@ -1,93 +0,0 @@
<?php
namespace App\Http\Controllers;
use App\Item;
use Illuminate\Http\Request;
use Illuminate\Http\Response;
use Illuminate\Support\Collection;
class ItemRestController extends Controller
{
public function __construct()
{
parent::__construct();
$this->middleware('allowed');
}
/**
* Display a listing of the resource.
*/
public function index(): Collection
{
$columns = [
'title',
'colour',
'url',
'description',
'appid',
'appdescription',
];
return Item::select($columns)
->where('deleted_at', null)
->where('type', '0')
->orderBy('order', 'asc')
->get();
}
/**
* Show the form for creating a new resource.
*
* @return void
*/
public function create()
{
}
/**
* Store a newly created resource in storage.
*/
public function store(Request $request): object
{
$item = ItemController::storelogic($request);
if ($item) {
return (object) ['status' => 'OK'];
}
return (object) ['status' => 'FAILED'];
}
/**
* Display the specified resource.
*/
public function show(Item $item): Response
{
//
}
/**
* Show the form for editing the specified resource.
*/
public function edit(Item $item): Response
{
//
}
/**
* Update the specified resource in storage.
*/
public function update(Request $request, Item $item): Response
{
//
}
/**
* Remove the specified resource from storage.
*/
public function destroy(Item $item): Response
{
//
}
}

View File

@@ -2,17 +2,12 @@
namespace App\Http\Controllers;
use App\Search;
use Illuminate\Contracts\Foundation\Application;
use Illuminate\Http\RedirectResponse;
use Illuminate\Http\Request;
use Illuminate\Routing\Redirector;
use App\Http\Controllers\Controller;
use App\Search;
class SearchController extends Controller
{
/**
* @return Application|RedirectResponse|Redirector|mixed|void
*/
public function index(Request $request)
{
$requestprovider = $request->input('provider');
@@ -20,9 +15,9 @@ class SearchController extends Controller
$provider = Search::providerDetails($requestprovider);
if ($provider->type == 'standard') {
if($provider->type == 'standard') {
return redirect($provider->url.'?'.$provider->query.'='.urlencode($query));
} elseif ($provider->type == 'external') {
} elseif($provider->type == 'external') {
$class = new $provider->class;
//print_r($provider);
return $class->getResults($query, $provider);

View File

@@ -2,22 +2,25 @@
namespace App\Http\Controllers;
use Illuminate\Http\Request;
use App\Setting;
use App\SettingGroup;
use Exception;
use Illuminate\Contracts\View\View;
use Illuminate\Http\RedirectResponse;
use Illuminate\Http\Request;
use App\User;
use Illuminate\Support\Facades\Auth;
use App\Http\Controllers\Controller;
use Illuminate\Support\Str;
class SettingsController extends Controller
{
public function __construct()
{
parent::__construct();
$this->middleware('allowed');
}
public function index(): View
/**
* @return \Illuminate\View\View
*/
public function index()
{
$settings = SettingGroup::with([
'settings',
@@ -29,98 +32,98 @@ class SettingsController extends Controller
}
/**
* @param int $id
*
* @return RedirectResponse|View
* @return \Illuminate\Http\RedirectResponse
*/
public function edit(int $id)
public function edit($id)
{
$setting = Setting::find($id);
//die("s: ".$setting->label);
if ((bool) $setting->system === true) {
return abort(404);
}
if((bool)$setting->system === true) return abort(404);
if (! is_null($setting)) {
if (!is_null($setting)) {
return view('settings.edit')->with([
'setting' => $setting,
]);
} else {
$route = route('settings.list', []);
return redirect($route)
return redirect($route)
->with([
'errors' => collect([__('app.alert.error.not_exist')]),
'error' => __('app.alert.error.not_exist'),
]);
}
}
public function update(Request $request, int $id): RedirectResponse
/**
* @param int $id
*
* @return \Illuminate\Http\RedirectResponse
*/
public function update(Request $request, $id)
{
$setting = Setting::find($id);
$user = $this->user();
$route = route('settings.index', []);
try {
if (is_null($setting)) {
throw new Exception('not_exists');
}
if (!is_null($setting)) {
$data = Setting::getInput($request);
if ($setting->type === 'image') {
$validatedData = $request->validate([
'value' => 'image'
]);
$setting_value = null;
if (!$request->hasFile('value')) {
throw new \Exception(
'file_too_big'
);
if ($setting->type == 'image') {
if($request->hasFile('value')) {
$path = $request->file('value')->store('backgrounds');
$setting_value = $path;
}
$path = $request->file('value')->store('backgrounds', 'public');
if ($path === null) {
throw new \Exception('file_not_stored');
}
$setting_value = $path;
} elseif ($setting->type == 'apikey') {
$setting_value = Str::random(40);
} else {
$data = Setting::getInput($request);
$setting_value = $data->value;
}
$user->settings()->detach($setting->id);
$user->settings()->save($setting, ['uservalue' => $setting_value]);
return redirect($route)
->with([
'success' => __('app.alert.success.setting_updated'),
]);
} catch (Exception $e) {
return redirect($route)
->with([
'errors' => collect([__('app.alert.error.'.$e->getMessage())]),
]);
$route = route('settings.index', []);
return redirect($route)
->with([
'success' => __('app.alert.success.setting_updated'),
]);
} else {
$route = route('settings.index', []);
return redirect($route)
->with([
'error' => __('app.alert.error.not_exist'),
]);
}
}
public function clear(int $id): RedirectResponse
/**
* @param int $id
*
* @return \Illuminate\Http\RedirectResponse
*/
public function clear($id)
{
$user = $this->user();
$setting = Setting::find($id);
if ((bool) $setting->system !== true) {
if((bool)$setting->system !== true) {
$user->settings()->detach($setting->id);
$user->settings()->save($setting, ['uservalue' => '']);
}
$route = route('settings.index', []);
return redirect($route)
return redirect($route)
->with([
'success' => __('app.alert.success.setting_updated'),
]);
}
public function search(Request $request)
{
}
}

View File

@@ -2,13 +2,10 @@
namespace App\Http\Controllers;
use Illuminate\Http\Request;
use App\Item;
use App\User;
use Illuminate\Contracts\Foundation\Application;
use Illuminate\Contracts\View\Factory;
use Illuminate\Contracts\View\View;
use Illuminate\Http\RedirectResponse;
use Illuminate\Http\Request;
use DB;
class TagController extends Controller
{
@@ -16,19 +13,18 @@ class TagController extends Controller
{
$this->middleware('allowed');
}
/**
* Display a listing of the resource.
*
* @return Application|Factory|View
* @return \Illuminate\Http\Response
*/
public function index(Request $request): \Illuminate\View\View
public function index(Request $request)
{
$trash = (bool) $request->input('trash');
$trash = (bool)$request->input('trash');
$data['apps'] = Item::ofType('tag')->where('id', '>', 0)->orderBy('title', 'asc')->get();
$data['trash'] = Item::ofType('tag')->where('id', '>', 0)->onlyTrashed()->get();
if ($trash) {
if($trash) {
return view('tags.trash', $data);
} else {
return view('tags.list', $data);
@@ -38,33 +34,34 @@ class TagController extends Controller
/**
* Show the form for creating a new resource.
*
* @return Application|Factory|View
* @return \Illuminate\Http\Response
*/
public function create(): \Illuminate\View\View
public function create()
{
$data = [];
return view('tags.create', $data);
}
/**
* Store a newly created resource in storage.
*
* @param \Illuminate\Http\Request $request
* @return \Illuminate\Http\Response
*/
public function store(Request $request): RedirectResponse
public function store(Request $request)
{
$validatedData = $request->validate([
'title' => 'required|max:255',
'file' => 'image'
]);
if ($request->hasFile('file')) {
$path = $request->file('file')->store('icons', 'public');
if($request->hasFile('file')) {
$path = $request->file('file')->store('icons');
$request->merge([
'icon' => $path,
'icon' => $path
]);
}
$slug = str_slug($request->title, '-', 'en_US');
$slug = str_slug($request->title, '-');
$current_user = User::currentUser();
@@ -72,13 +69,12 @@ class TagController extends Controller
$request->merge([
'type' => '1',
'url' => $slug,
'user_id' => $current_user->getId(),
'user_id' => $current_user->id
]);
//die(print_r($request->all()));
Item::create($request->all());
$route = route('dash', []);
return redirect($route)
->with('success', __('app.alert.success.tag_created'));
}
@@ -86,119 +82,121 @@ class TagController extends Controller
/**
* Display the specified resource.
*
* @param $slug
* @param int $id
* @return \Illuminate\Http\Response
*/
public function show($slug): View
public function show($slug)
{
$item = Item::whereUrl($slug)->first();
//print_r($item);
$data['apps'] = $item->children()->pinned()->orderBy('order', 'asc')->get();
$data['tag'] = $item->id;
$data['all_apps'] = $item->children;
return view('welcome', $data);
}
/**
* Show the form for editing the specified resource.
*
* @param int $id
* @return \Illuminate\Http\Response
*/
public function edit(int $id): View
public function edit($id)
{
// Get the item
$item = Item::find($id);
// show the edit form and pass the nerd
return view('tags.edit')
->with('item', $item);
->with('item', $item);
}
/**
* Update the specified resource in storage.
*
* @param \Illuminate\Http\Request $request
* @param int $id
* @return \Illuminate\Http\Response
*/
public function update(Request $request, int $id): RedirectResponse
public function update(Request $request, $id)
{
$validatedData = $request->validate([
'title' => 'required|max:255',
'file' => 'image'
]);
if ($request->hasFile('file')) {
$path = $request->file('file')->store('icons', 'public');
if($request->hasFile('file')) {
$path = $request->file('file')->store('icons');
$request->merge([
'icon' => $path,
'icon' => $path
]);
}
$slug = str_slug($request->title, '-', 'en_US');
$slug = str_slug($request->title, '-');
// set item type to tag
$request->merge([
'url' => $slug,
'url' => $slug
]);
Item::find($id)->update($request->all());
$route = route('dash', []);
return redirect($route)
->with('success', __('app.alert.success.tag_updated'));
->with('success',__('app.alert.success.tag_updated'));
}
/**
* Remove the specified resource from storage.
*
* @param int $id
* @return \Illuminate\Http\Response
*/
public function destroy(Request $request, int $id): RedirectResponse
public function destroy(Request $request, $id)
{
//
$force = (bool) $request->input('force');
if ($force) {
$force = (bool)$request->input('force');
if($force) {
Item::withTrashed()
->where('id', $id)
->forceDelete();
} else {
Item::find($id)->delete();
}
$route = route('tags.index', []);
return redirect($route)
->with('success', __('app.alert.success.item_deleted'));
->with('success',__('app.alert.success.item_deleted'));
}
/**
* Restore the specified resource from soft deletion.
*
* @param int $id
* @return \Illuminate\Http\Response
*/
public function restore(int $id): RedirectResponse
public function restore($id)
{
//
Item::withTrashed()
->where('id', $id)
->restore();
->restore();
$route = route('tags.index', []);
return redirect($route)
->with('success', __('app.alert.success.item_restored'));
->with('success',__('app.alert.success.item_restored'));
}
/**
* Add item to tag
*
* @param $tag
* @param $item
* @return int 1|0
*/
public function add($tag, $item): int
public function add($tag, $item)
{
$output = 0;
$tag = Item::find($tag);
$item = Item::find($item);
if ($tag && $item) {
if($tag && $item) {
// only add items, not cats
if ((int) $item->type === 0) {
if((int)$item->type === 0) {
$tag->children()->attach($item);
return 1;
}
}
return 0;
return $output;
}
}

View File

@@ -2,60 +2,62 @@
namespace App\Http\Controllers;
use App\User;
use Illuminate\Contracts\View\View;
use Illuminate\Http\RedirectResponse;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Auth;
use App\Http\Controllers\Controller;
use App\User;
use Illuminate\Support\Str;
use Illuminate\Support\Facades\Auth;
class UserController extends Controller
{
public function __construct()
{
parent::__construct();
$this->middleware('allowed')->except(['selectUser']);
}
/**
* Display a listing of the resource.
*
* @return \Illuminate\Http\Response
*/
public function index(): View
public function index()
{
$data['users'] = User::all();
return view('users.index', $data);
}
/**
* Show the form for creating a new resource.
*
* @return \Illuminate\Http\Response
*/
public function create(): View
public function create()
{
$data = [];
return view('users.create', $data);
}
public function selectUser(): \Illuminate\View\View
public function selectUser()
{
Auth::logout();
$data['users'] = User::all();
return view('userselect', $data);
}
/**
* Store a newly created resource in storage.
*
* @param \Illuminate\Http\Request $request
* @return \Illuminate\Http\Response
*/
public function store(Request $request): RedirectResponse
public function store(Request $request)
{
$validatedData = $request->validate([
'username' => 'required|max:255|unique:users',
'email' => 'required|email',
'password' => 'nullable|confirmed',
'password_confirmation' => 'nullable',
'file' => 'image'
'password_confirmation' => 'nullable'
]);
$user = new User;
$user->username = $request->input('username');
@@ -63,77 +65,85 @@ class UserController extends Controller
$user->public_front = $request->input('public_front');
$password = $request->input('password');
if (! empty($password)) {
if(!empty($password)) {
$user->password = bcrypt($password);
}
if ($request->hasFile('file')) {
$path = $request->file('file')->store('avatars', 'public');
if($request->hasFile('file')) {
$path = $request->file('file')->store('avatars');
$user->avatar = $path;
}
if ((bool) $request->input('autologin_allow') === true) {
$user->autologin = (string) Str::uuid();
if ((bool)$request->input('autologin_allow') === true) {
$user->autologin = (string)Str::uuid();
}
$user->save();
$route = route('dash', []);
return redirect($route)
->with('success', __('app.alert.success.user_updated'));
->with('success',__('app.alert.success.user_updated'));
}
/**
* Display the specified resource.
*
* @param int $id
* @return \Illuminate\Http\Response
*/
public function show(int $id): void
public function show($id)
{
//
}
/**
* Show the form for editing the specified resource.
*
* @param int $id
* @return \Illuminate\Http\Response
*/
public function edit(User $user): View
public function edit(User $user)
{
$data['user'] = $user;
return view('users.edit', $data);
}
/**
* Update the specified resource in storage.
*
* @param \Illuminate\Http\Request $request
* @param int $id
* @return \Illuminate\Http\Response
*/
public function update(Request $request, User $user): RedirectResponse
public function update(Request $request, User $user)
{
$validatedData = $request->validate([
'username' => 'required|max:255|unique:users,username,'.$user->id,
'email' => 'required|email',
'password' => 'nullable|confirmed',
'password_confirmation' => 'nullable',
'file' => 'image'
'password_confirmation' => 'nullable'
]);
//die(print_r($request->all()));
//die(print_r($request->all()));
$user->username = $request->input('username');
$user->email = $request->input('email');
$user->public_front = $request->input('public_front');
$password = $request->input('password');
if (! empty($password)) {
if(!empty($password)) {
$user->password = bcrypt($password);
} elseif ($password == 'null') {
} elseif($password == 'null') {
$user->password = null;
}
if ($request->hasFile('file')) {
$path = $request->file('file')->store('avatars', 'public');
if($request->hasFile('file')) {
$path = $request->file('file')->store('avatars');
$user->avatar = $path;
}
if ((bool) $request->input('autologin_allow') === true) {
$user->autologin = (is_null($user->autologin)) ? (string) Str::uuid() : $user->autologin;
if ((bool)$request->input('autologin_allow') === true) {
$user->autologin = (is_null($user->autologin)) ? (string)Str::uuid() : $user->autologin;
} else {
$user->autologin = null;
}
@@ -141,24 +151,25 @@ class UserController extends Controller
$user->save();
$route = route('dash', []);
return redirect($route)
->with('success', __('app.alert.success.user_updated'));
->with('success',__('app.alert.success.user_updated'));
}
/**
* Remove the specified resource from storage.
*
* @return RedirectResponse | void
* @param int $id
* @return \Illuminate\Http\Response
*/
public function destroy(User $user): RedirectResponse
public function destroy(User $user)
{
if ($user->id !== 1) {
if($user->id !== 1) {
$user->delete();
$route = route('dash', []);
return redirect($route)
->with('success', __('app.alert.success.user_deleted'));
->with('success',__('app.alert.success.user_deleted'));
}
}
}

View File

@@ -31,25 +31,26 @@ class Kernel extends HttpKernel
\App\Http\Middleware\EncryptCookies::class,
\Illuminate\Cookie\Middleware\AddQueuedCookiesToResponse::class,
\Illuminate\Session\Middleware\StartSession::class,
// \Illuminate\Session\Middleware\AuthenticateSession::class,
\Illuminate\View\Middleware\ShareErrorsFromSession::class,
\App\Http\Middleware\VerifyCsrfToken::class,
\Illuminate\Routing\Middleware\SubstituteBindings::class,
],
'api' => [
\Illuminate\Routing\Middleware\ThrottleRequests::class.':60,1',
'throttle:60,1',
'bindings',
],
];
/**
* The application's middleware aliases.
* The application's route middleware.
*
* Aliases may be used to conveniently assign middleware to routes and groups.
* These middleware may be assigned to groups or used individually.
*
* @var array
*/
protected $middlewareAliases = [
protected $routeMiddleware = [
'allowed' => \App\Http\Middleware\CheckAllowed::class,
'auth' => \Illuminate\Auth\Middleware\Authenticate::class,
'auth.basic' => \Illuminate\Auth\Middleware\AuthenticateWithBasicAuth::class,
@@ -57,5 +58,6 @@ class Kernel extends HttpKernel
'can' => \Illuminate\Auth\Middleware\Authorize::class,
'guest' => \App\Http\Middleware\RedirectIfAuthenticated::class,
'throttle' => \Illuminate\Routing\Middleware\ThrottleRequests::class,
'apikey' => \App\Http\Middleware\UserApiKey::class,
];
}

View File

@@ -2,12 +2,9 @@
namespace App\Http\Middleware;
use Symfony\Component\HttpFoundation\Response;
use App\User;
use Closure;
use Illuminate\Auth\AuthenticationException;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Auth;
use App\User;
use Illuminate\Support\Facades\Route;
use Session;
@@ -16,42 +13,36 @@ class CheckAllowed
/**
* Handle an incoming request.
*
* @throws AuthenticationException
* @param \Illuminate\Http\Request $request
* @param \Closure $next
* @return mixed
*/
public function handle(Request $request, Closure $next): Response
public function handle($request, Closure $next)
{
$route = Route::currentRouteName();
$current_user = User::currentUser();
// Non admin users can't access users management
if (str_is('users*', $route)) {
if ($current_user->getId() !== 1) {
if(str_is('users*', $route)) {
if($current_user->id !== 1) {
return redirect()->route('dash');
}
}
// Public access to frontpage
if ($route === 'dash' || $route === 'tags.show') {
if ((bool)$current_user->public_front === true) {
return $next($request);
}
if($route == 'dash') {
//print_r(User::all());
//die("here".var_dump($current_user->password));
if((bool)$current_user->public_front === true) return $next($request);
}
// Continue with passwordless user
if (empty($current_user->password)) {
return $next($request);
}
if(empty($current_user->password)) return $next($request);
// Check if user is logged in as $current_user
if (Auth::check()) {
$loggedin_user = Auth::user();
if ($loggedin_user->id === $current_user->getId()) {
return $next($request);
}
if($loggedin_user->id === $current_user->id) return $next($request);
}
// Redirect to login
Auth::authenticate();
return redirect()->route('user.select');
return Auth::authenticate();
}
}

View File

@@ -2,17 +2,20 @@
namespace App\Http\Middleware;
use Symfony\Component\HttpFoundation\Response;
use Closure;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Auth;
class RedirectIfAuthenticated
{
/**
* Handle an incoming request.
*
* @param \Illuminate\Http\Request $request
* @param \Closure $next
* @param string|null $guard
* @return mixed
*/
public function handle(Request $request, Closure $next, string $guard = null): Response
public function handle($request, Closure $next, $guard = null)
{
if (Auth::guard($guard)->check()) {
return redirect()->intended();

View File

@@ -9,10 +9,9 @@ class TrimStrings extends Middleware
/**
* The names of the attributes that should not be trimmed.
*
* @var array<int, string>
* @var array
*/
protected $except = [
'current_password',
'password',
'password_confirmation',
];

View File

@@ -2,8 +2,8 @@
namespace App\Http\Middleware;
use Illuminate\Http\Middleware\TrustProxies as Middleware;
use Illuminate\Http\Request;
use Fideloper\Proxy\TrustProxies as Middleware;
class TrustProxies extends Middleware
{
@@ -12,12 +12,12 @@ class TrustProxies extends Middleware
*
* @var array
*/
protected $proxies = ['192.168.0.0/16', '172.16.0.0/12', '10.0.0.0/8', '127.0.0.1'];
protected $proxies = ['192.168.0.0/16', '172.16.0.0/12','10.0.0.0/8', '127.0.0.1'];
/**
* The current proxy header mappings.
*
* @var array
*/
protected $headers = Request::HEADER_X_FORWARDED_FOR | Request::HEADER_X_FORWARDED_HOST | Request::HEADER_X_FORWARDED_PORT | Request::HEADER_X_FORWARDED_PROTO | Request::HEADER_X_FORWARDED_AWS_ELB;
protected $headers = Request::HEADER_X_FORWARDED_ALL;
}

View File

@@ -0,0 +1,30 @@
<?php
namespace App\Http\Middleware;
use Closure;
use \App\SettingUser;
class UserApiKey
{
/**
* Handle an incoming request.
*
* @param \Illuminate\Http\Request $request
* @param \Closure $next
* @return mixed
*/
public function handle($request, Closure $next)
{
$key = $request->input('api_key');
$details = SettingUser::where('setting_id', 12)->where('uservalue', $key)->first();
// die(var_dump($details));
if($details === null) {
return response()->json([
'status' => 401,
'message' => 'invalid api key'
], 401);
}
return $next($request);
}
}

View File

@@ -1,22 +0,0 @@
<?php
namespace App\Http\Middleware;
use Illuminate\Routing\Middleware\ValidateSignature as Middleware;
class ValidateSignature extends Middleware
{
/**
* The names of the query string parameters that should be ignored.
*
* @var array<int, string>
*/
protected $except = [
// 'fbclid',
// 'utm_campaign',
// 'utm_content',
// 'utm_medium',
// 'utm_source',
// 'utm_term',
];
}

View File

@@ -3,6 +3,7 @@
namespace App\Http\Middleware;
use Illuminate\Foundation\Http\Middleware\VerifyCsrfToken as Middleware;
use Symfony\Component\HttpFoundation\Cookie;
class VerifyCsrfToken extends Middleware
{
@@ -18,4 +19,40 @@ class VerifyCsrfToken extends Middleware
'test_config',
//'get_stats'
];
/**
* Add the CSRF token to the response cookies.
*
* @param \Illuminate\Http\Request $request
* @param \Symfony\Component\HttpFoundation\Response $response
* @return \Symfony\Component\HttpFoundation\Response
*/
protected function addCookieToResponse($request, $response)
{
$config = config('session');
if ($response instanceof Responsable) {
$response = $response->toResponse($request);
}
$response->headers->setCookie(
new Cookie(
'HEIMDALL-XSRF-TOKEN', $request->session()->token(), $this->availableAt(60 * $config['lifetime']),
$config['path'], $config['domain'], $config['secure'], false, false, $config['same_site'] ?? null
)
);
return $response;
}
/**
* Determine if the cookie contents should be serialized.
*
* @return bool
*/
public static function serialized()
{
return EncryptCookies::serialized('HEIMDALL-XSRF-TOKEN');
}
}

View File

@@ -2,117 +2,51 @@
namespace App;
use Illuminate\Contracts\Routing\UrlGenerator;
use Illuminate\Database\Eloquent\Builder;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Relations\BelongsTo;
use Illuminate\Database\Eloquent\Relations\BelongsToMany;
use Illuminate\Database\Eloquent\SoftDeletes;
use Illuminate\Database\Eloquent\Casts\Attribute;
use stdClass;
use Symfony\Component\ClassLoader\ClassMapGenerator;
use Illuminate\Database\Eloquent\SoftDeletes;
use Illuminate\Database\Eloquent\Builder;
use App\User;
use App\ItemTag;
use App\Application;
// @codingStandardsIgnoreStart
/**
* App\Item
*
* @property int $id
* @property string $title
* @property string|null $colour
* @property string|null $icon
* @property string $url
* @property string|null $description
* @property int $pinned
* @property int $order
* @property \Illuminate\Support\Carbon|null $deleted_at
* @property \Illuminate\Support\Carbon|null $created_at
* @property \Illuminate\Support\Carbon|null $updated_at
* @property int $type
* @property int $user_id
* @property string|null $class
* @property string|null $appid
* @property string|null $appdescription
* @property-read \Illuminate\Database\Eloquent\Collection|Item[] $children
* @property-read int|null $children_count
* @property-read string $droppable
* @property-read \Illuminate\Contracts\Foundation\Application|\Illuminate\Contracts\Routing\UrlGenerator|mixed|string $link
* @property-read string $link_icon
* @property-read string $link_target
* @property-read string $link_type
* @property-read \Illuminate\Database\Eloquent\Collection|Item[] $parents
* @property-read int|null $parents_count
* @property-read \App\User|null $user
* @method static \Database\Factories\ItemFactory factory(...$parameters)
* @method static Builder|Item newModelQuery()
* @method static Builder|Item newQuery()
* @method static Builder|Item ofType($type)
* @method static \Illuminate\Database\Query\Builder|Item onlyTrashed()
* @method static Builder|Item pinned()
* @method static Builder|Item query()
* @method static Builder|Item whereAppdescription($value)
* @method static Builder|Item whereAppid($value)
* @method static Builder|Item whereClass($value)
* @method static Builder|Item whereColour($value)
* @method static Builder|Item whereCreatedAt($value)
* @method static Builder|Item whereDeletedAt($value)
* @method static Builder|Item whereDescription($value)
* @method static Builder|Item whereIcon($value)
* @method static Builder|Item whereId($value)
* @method static Builder|Item whereOrder($value)
* @method static Builder|Item wherePinned($value)
* @method static Builder|Item whereTitle($value)
* @method static Builder|Item whereType($value)
* @method static Builder|Item whereUpdatedAt($value)
* @method static Builder|Item whereUrl($value)
* @method static Builder|Item whereUserId($value)
* @method static \Illuminate\Database\Query\Builder|Item withTrashed()
* @method static \Illuminate\Database\Query\Builder|Item withoutTrashed()
* @mixin \Eloquent
*/
// @codingStandardsIgnoreEnd
class Item extends Model
{
use SoftDeletes;
use HasFactory;
protected static function boot(): void
protected static function boot()
{
parent::boot();
static::addGlobalScope('user_id', function (Builder $builder) {
$current_user = User::currentUser();
if ($current_user) {
$builder->where('user_id', $current_user->getId())->orWhere('user_id', 0);
if($current_user) {
$builder->where('user_id', $current_user->id)->orWhere('user_id', 0);
} else {
$builder->where('user_id', 0);
}
});
}
//
protected $fillable = [
'title',
'url',
'colour',
'icon',
'appdescription',
'description',
'pinned',
'order',
'type',
'class',
'user_id',
'tag_id',
'appid',
'title', 'url', 'colour', 'icon', 'appdescription', 'description', 'pinned', 'order', 'type', 'class', 'user_id', 'appid'
];
/**
* The attributes that should be mutated to dates.
*
* @var array
*/
protected $dates = ['deleted_at'];
/**
* Scope a query to only include pinned items.
*
* @param \Illuminate\Database\Eloquent\Builder $query
* @return \Illuminate\Database\Eloquent\Builder
*/
public function scopePinned(Builder $query): Builder
public function scopePinned($query)
{
return $query->where('pinned', 1);
}
@@ -120,149 +54,100 @@ class Item extends Model
public static function checkConfig($config)
{
// die(print_r($config));
if (empty($config)) {
if(empty($config)) {
$config = null;
} else {
$config = json_encode($config);
}
return $config;
}
public function tags()
{
$id = $this->id;
$tags = ItemTag::select('tag_id')->where('item_id', $id)->pluck('tag_id')->toArray();
$tagdetails = self::select('id', 'title', 'url', 'pinned')->whereIn('id', $tags)->get();
$tagdetails = Item::select('id', 'title', 'url', 'pinned')->whereIn('id', $tags)->get();
//print_r($tags);
if(in_array(0, $tags)) {
$details = new Item([
"id" => 0,
"title" => __('app.dashboard'),
"url" => '',
"pinned" => 0
]);
$tagdetails->prepend($details);
}
return $tagdetails;
}
protected function title(): Attribute
public function parents()
{
return Attribute::make(
get: fn (mixed $value) => ($value === 'app.dashboard' ? __('app.dashboard') : $value),
);
return $this->belongsToMany('App\Item', 'item_tag', 'item_id', 'tag_id');
}
public function children()
{
return $this->belongsToMany('App\Item', 'item_tag', 'tag_id', 'item_id');
}
protected function tagUrl(): Attribute
{
return Attribute::make(
get: fn (mixed $value, array $attributes) => ($attributes['id'] === 0 ? '0-dash' : $attributes['url']),
);
}
public function getTagClass(): string
{
$tags = $this->tags();
$slugs = [];
foreach ($tags as $tag) {
if ($tag->id === 0) {
$tag->url = '0-dash';
}
if ($tag->url) {
$slugs[] = 'tag-'.$tag->url;
}
}
return implode(' ', $slugs);
}
public function getTagList(): string
{
$tags = $this->tags();
$titles = [];
// print_r($tags);
foreach ($tags as $tag) {
if ($tag->title) {
$titles[] = $tag->title;
}
}
return implode(', ', $titles);
}
public function parents(): BelongsToMany
{
return $this->belongsToMany(Item::class, 'item_tag', 'item_id', 'tag_id');
}
public function children(): BelongsToMany
{
return $this->belongsToMany(Item::class, 'item_tag', 'tag_id', 'item_id');
}
/**
* @return \Illuminate\Contracts\Foundation\Application|UrlGenerator|mixed|string
*/
public function getLinkAttribute()
{
if ((int) $this->type === 1) {
if((int)$this->type === 1) {
return url('tag/'.$this->url);
} else {
return $this->url;
}
}
public function getDroppableAttribute(): string
public function getDroppableAttribute()
{
if ((int) $this->type === 1) {
if((int)$this->type === 1) {
return ' droppable';
} else {
return '';
}
}
public function getLinkTargetAttribute(): string
public function getLinkTargetAttribute()
{
$target = Setting::fetch('window_target');
if ((int) $this->type === 1 || $target === 'current') {
if((int)$this->type === 1 || $target === 'current') {
return '';
} else {
return ' target="'.$target.'"';
return ' target="' . $target . '"';
}
}
public function getLinkIconAttribute(): string
public function getLinkIconAttribute()
{
if ((int) $this->type === 1) {
if((int)$this->type === 1) {
return 'fa-tag';
} else {
return 'fa-arrow-alt-to-right';
}
}
public function getLinkTypeAttribute(): string
public function getLinkTypeAttribute()
{
if ((int) $this->type === 1) {
if((int)$this->type === 1) {
return 'tags';
} else {
return 'items';
}
}
/**
* @param $class
* @return false|mixed|string
*/
public static function nameFromClass($class)
{
$explode = explode('\\', $class);
$name = end($explode);
return $name;
}
/**
* @param $query
* @param $type
* @return mixed
*/
public function scopeOfType($query, $type)
{
switch ($type) {
switch($type) {
case 'item':
$typeid = 0;
break;
@@ -274,7 +159,7 @@ class Item extends Model
return $query->where('type', $typeid);
}
public function enhanced(): bool
public function enhanced()
{
/*if(isset($this->class) && !empty($this->class)) {
$app = new $this->class;
@@ -285,110 +170,89 @@ class Item extends Model
return $this->description !== null;
}
/**
* @param $class
*/
public static function isEnhanced($class): bool
public static function isEnhanced($class)
{
if (!class_exists($class, false) || $class === null || $class === 'null') {
return false;
}
if($class === null || $class === 'null') return false;
$app = new $class;
return (bool) ($app instanceof EnhancedApps);
return (bool)($app instanceof \App\EnhancedApps);
}
/**
* @param $class
* @return false|mixed
*/
public static function isSearchProvider($class)
{
if (!class_exists($class, false) || $class === null || $class === 'null') {
return false;
}
$app = new $class;
return ((bool) ($app instanceof SearchInterface)) ? $app : false;
return ((bool)($app instanceof \App\SearchInterface)) ? $app : false;
}
public function enabled(): bool
public function enabled()
{
if ($this->enhanced()) {
if($this->enhanced()) {
$config = $this->getconfig();
if ($config) {
if($config) {
return (bool) $config->enabled;
}
}
return false;
}
/**
* @return mixed|stdClass
*/
public function getconfig()
{
// $explode = explode('\\', $this->class);
if (! isset($this->description) || empty($this->description)) {
$config = new stdClass;
if(!isset($this->description) || empty($this->description)) {
$config = new \stdClass;
// $config->name = end($explode);
$config->enabled = false;
$config->override_url = null;
$config->apikey = null;
return $config;
}
$config = json_decode($this->description);
// $config->name = end($explode);
$config->url = $this->url;
if (isset($config->override_url) && ! empty($config->override_url)) {
if(isset($config->override_url) && !empty($config->override_url)) {
$config->url = $config->override_url;
} else {
$config->override_url = null;
}
return $config;
}
/**
* @param $class
*/
public static function applicationDetails($class): ?Application
public static function applicationDetails($class)
{
if (! empty($class)) {
if(!empty($class)) {
$name = self::nameFromClass($class);
$application = Application::where('name', $name)->first();
if ($application) {
return $application;
}
if($application) return $application;
}
return null;
return false;
}
/**
* @param $class
*/
public static function getApplicationDescription($class): string
public static function getApplicationDescription($class)
{
$details = self::applicationDetails($class);
if ($details !== null) {
if($details !== false) {
return $details->description.' - '.$details->license;
}
return '';
}
/**
* Get the user that owns the item.
*/
public function user(): BelongsTo
public function user()
{
return $this->belongsTo(User::class);
}
return $this->belongsTo('App\User');
}
}

View File

@@ -2,26 +2,9 @@
namespace App;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Relations\Pivot;
/**
* App\ItemTag
*
* @property int $item_id
* @property int $tag_id
* @property \Illuminate\Support\Carbon|null $created_at
* @property \Illuminate\Support\Carbon|null $updated_at
* @method static \Illuminate\Database\Eloquent\Builder|ItemTag newModelQuery()
* @method static \Illuminate\Database\Eloquent\Builder|ItemTag newQuery()
* @method static \Illuminate\Database\Eloquent\Builder|ItemTag query()
* @method static \Illuminate\Database\Eloquent\Builder|ItemTag whereCreatedAt($value)
* @method static \Illuminate\Database\Eloquent\Builder|ItemTag whereItemId($value)
* @method static \Illuminate\Database\Eloquent\Builder|ItemTag whereTagId($value)
* @method static \Illuminate\Database\Eloquent\Builder|ItemTag whereUpdatedAt($value)
* @mixin \Eloquent
*/
class ItemTag extends Pivot
{
use HasFactory;
}
}

View File

@@ -2,20 +2,17 @@
namespace App\Jobs;
use App\Application;
use App\Item;
use App\SupportedApps;
use GuzzleHttp\Exception\GuzzleException;
use Illuminate\Bus\Queueable;
use Illuminate\Contracts\Queue\ShouldBeUnique;
use Illuminate\Queue\SerializesModels;
use Illuminate\Queue\InteractsWithQueue;
use Illuminate\Contracts\Queue\ShouldQueue;
use Illuminate\Foundation\Bus\Dispatchable;
use Illuminate\Queue\InteractsWithQueue;
use Illuminate\Queue\SerializesModels;
use Illuminate\Support\Facades\Log;
use Illuminate\Support\Facades\Storage;
use App\Application;
use App\SupportedApps;
use App\Item;
class ProcessApps implements ShouldQueue, ShouldBeUnique
class ProcessApps implements ShouldQueue
{
use Dispatchable, InteractsWithQueue, Queueable, SerializesModels;
@@ -32,29 +29,27 @@ class ProcessApps implements ShouldQueue, ShouldBeUnique
/**
* Execute the job.
*
* @throws GuzzleException
* @return void
*/
public function handle(): void
public function handle()
{
Log::debug('Process Apps dispatched');
$localapps = Application::whereNull('class')->get();
$json = SupportedApps::getList()->getBody();
Storage::disk('local')->put('supportedapps.json', $json);
foreach ($localapps as $app) {
foreach($localapps as $app) {
$app->class = $app->class();
$app->save();
}
$items = Item::whereNotNull('class')->get();
foreach ($items as $item) {
if (! file_exists(app_path('SupportedApps/'.Item::nameFromClass($item->class)))) {
foreach($items as $item) {
if(!file_exists(app_path('SupportedApps/'.Item::nameFromClass($item->class)))) {
$app = Application::where('class', $item->class)->first();
if ($app) {
Application::getApp($app->appid);
}
Application::getApp($app->appid);
}
}
}
}

View File

@@ -1,56 +0,0 @@
<?php
namespace App\Jobs;
use App\Application;
use GuzzleHttp\Exception\GuzzleException;
use Illuminate\Bus\Queueable;
use Illuminate\Contracts\Queue\ShouldBeUnique;
use Illuminate\Contracts\Queue\ShouldQueue;
use Illuminate\Foundation\Bus\Dispatchable;
use Illuminate\Queue\InteractsWithQueue;
use Illuminate\Queue\SerializesModels;
use Illuminate\Support\Facades\Cache;
use Illuminate\Support\Facades\Log;
class UpdateApps implements ShouldQueue, ShouldBeUnique
{
use Dispatchable, InteractsWithQueue, Queueable, SerializesModels;
/**
* Create a new job instance.
*
* @return void
*/
public function __construct()
{
//
}
/**
* Execute the job.
*
* @throws GuzzleException
*/
public function handle(): void
{
Log::debug('Update of all apps triggered!');
$apps = Application::all('appid')->toArray();
// We onl update the apps that are actually in use by items
// 1 sec delay after each update to throttle the requests
foreach ($apps as $appKey => $app) {
Application::getApp($app['appid']);
sleep(1);
}
Log::debug('Update of all apps finished!');
Cache::lock('updateApps')->forceRelease();
}
public function failed($exception): void
{
Cache::lock('updateApps')->forceRelease();
}
}

View File

@@ -2,66 +2,92 @@
namespace App\Providers;
use App\Application;
use App\Jobs\ProcessApps;
use App\Jobs\UpdateApps;
use Illuminate\Support\ServiceProvider;
use Artisan;
use Schema;
use App\Setting;
use App\User;
use Barryvdh\LaravelIdeHelper\IdeHelperServiceProvider;
use Illuminate\Support\Facades\Artisan;
use Illuminate\Support\Facades\Cache;
use Illuminate\Support\Facades\Schema;
use Illuminate\Support\ServiceProvider;
use Psr\Container\ContainerExceptionInterface;
use Psr\Container\NotFoundExceptionInterface;
use App\Application;
use App\Jobs\ProcessApps;
class AppServiceProvider extends ServiceProvider
{
/**
* Bootstrap any application services.
*
* @return void
*/
public function boot(): void
public function boot()
{
if (! class_exists('ZipArchive')) {
die('You are missing php-zip');
if(!is_file(base_path('.env'))) {
copy(base_path('.env.example'), base_path('.env'));
}
$this->genKey();
if(!is_file(database_path('app.sqlite'))) {
// first time setup
touch(database_path('app.sqlite'));
Artisan::call('migrate', array('--path' => 'database/migrations', '--force' => true, '--seed' => true));
//Cache
//Artisan::call('config:cache');
//Artisan::call('route:cache');
}
if(is_file(database_path('app.sqlite'))) {
if(Schema::hasTable('settings')) {
// check version to see if an upgrade is needed
$db_version = Setting::_fetch('version');
$app_version = config('app.version');
if(version_compare($app_version, $db_version) == 1) { // app is higher than db, so need to run migrations etc
Artisan::call('migrate', array('--path' => 'database/migrations', '--force' => true, '--seed' => true));
}
} else {
Artisan::call('migrate', array('--path' => 'database/migrations', '--force' => true, '--seed' => true));
}
}
$this->createEnvFile();
$this->setupDatabase();
if (! is_file(public_path('storage/.gitignore'))) {
if(!is_file(public_path('storage/.gitignore'))) {
Artisan::call('storage:link');
\Session::put('current_user', null);
}
$applications = Application::all();
if ($applications->count() <= 0) {
ProcessApps::dispatch();
}
$lang = Setting::fetch('language');
\App::setLocale($lang);
$applications = Application::all();
if($applications->count() <= 0) {
if (class_exists('ZipArchive')) {
ProcessApps::dispatch();
} else {
die("You are missing php-zip");
}
}
// User specific settings need to go here as session isn't available at this point in the app
view()->composer('*', function ($view) {
if (isset($_SERVER['HTTP_AUTHORIZATION']) && ! empty($_SERVER['HTTP_AUTHORIZATION'])) {
list($_SERVER['PHP_AUTH_USER'], $_SERVER['PHP_AUTH_PW']) =
view()->composer('*', function ($view)
{
if(isset($_SERVER['HTTP_AUTHORIZATION']) && !empty($_SERVER['HTTP_AUTHORIZATION'])) {
list($_SERVER['PHP_AUTH_USER'], $_SERVER['PHP_AUTH_PW']) =
explode(':', base64_decode(substr($_SERVER['HTTP_AUTHORIZATION'], 6)));
}
if (! \Auth::check()) {
if (isset($_SERVER['PHP_AUTH_USER']) && isset($_SERVER['PHP_AUTH_PW'])
&& ! empty($_SERVER['PHP_AUTH_USER']) && ! empty($_SERVER['PHP_AUTH_PW'])) {
if(!\Auth::check()) {
if(isset($_SERVER['PHP_AUTH_USER']) && isset($_SERVER['PHP_AUTH_PW'])
&& !empty($_SERVER['PHP_AUTH_USER']) && !empty($_SERVER['PHP_AUTH_PW'])) {
$credentials = ['username' => $_SERVER['PHP_AUTH_USER'], 'password' => $_SERVER['PHP_AUTH_PW']];
if (\Auth::attempt($credentials, true)) {
// Authentication passed...
$user = \Auth::user();
//\Session::put('current_user', $user);
session(['current_user' => $user]);
session(['current_user' => $user]);
}
} elseif (isset($_SERVER['REMOTE_USER']) && ! empty($_SERVER['REMOTE_USER'])) {
}
elseif(isset($_SERVER['REMOTE_USER']) && !empty($_SERVER['REMOTE_USER'])) {
$user = User::where('username', $_SERVER['REMOTE_USER'])->first();
if ($user) {
\Auth::login($user, true);
@@ -70,116 +96,61 @@ class AppServiceProvider extends ServiceProvider
}
}
$alt_bg = '';
$trianglify = 'false';
$trianglify_seed = null;
if (Setting::fetch('trianglify')) {
$trianglify = 'true';
$trianglify_seed = Setting::fetch('trianglify_seed');
} elseif ($bg_image = Setting::fetch('background_image')) {
if($bg_image = Setting::fetch('background_image')) {
$alt_bg = ' style="background-image: url(storage/'.$bg_image.')"';
}
$allusers = User::all();
$current_user = User::currentUser();
$view->with('alt_bg', $alt_bg);
$view->with('trianglify', $trianglify);
$view->with('trianglify_seed', $trianglify_seed);
$view->with('allusers', $allusers);
$view->with('current_user', $current_user);
});
$view->with('alt_bg', $alt_bg );
$view->with('allusers', $allusers );
$view->with('current_user', $current_user );
});
$this->app['view']->addNamespace('SupportedApps', app_path('SupportedApps'));
if (env('FORCE_HTTPS') === true) {
\URL::forceScheme('https');
}
if (env('APP_URL') != 'http://localhost') {
if(env('APP_URL') != 'http://localhost') {
\URL::forceRootUrl(env('APP_URL'));
}
}
/**
/**
* Generate app key if missing and .env exists
*
* @return void
*/
public function genKey(): void
public function genKey()
{
if (is_file(base_path('.env'))) {
if (empty(env('APP_KEY'))) {
Artisan::call('key:generate', ['--force' => true, '--no-interaction' => true]);
if(is_file(base_path('.env'))) {
if(empty(env('APP_KEY'))) {
Artisan::call('key:generate', array('--force' => true, '--no-interaction' => true));
}
}
}
/**
* Register any application services.
*
* @return void
*/
public function register(): void
public function register()
{
if ($this->app->isLocal()) {
$this->app->register(IdeHelperServiceProvider::class);
}
$this->app->singleton('settings', function () {
return new Setting();
});
}
/**
* Check if database needs an update or do first time database setup
*
* @throws ContainerExceptionInterface
* @throws NotFoundExceptionInterface
*/
public function setupDatabase(): void
{
$db_type = config()->get('database.default');
if ($db_type == 'sqlite') {
$db_file = database_path(env('DB_DATABASE', 'app.sqlite'));
if (! is_file($db_file)) {
touch($db_file);
}
}
if ($this->needsDBUpdate()) {
Artisan::call('migrate', ['--path' => 'database/migrations', '--force' => true, '--seed' => true]);
ProcessApps::dispatchSync();
$this->updateApps();
}
}
public function createEnvFile(): void
{
if (!is_file(base_path('.env'))) {
copy(base_path('.env.example'), base_path('.env'));
}
$this->genKey();
}
private function needsDBUpdate(): bool
{
if (!Schema::hasTable('settings')) {
return true;
}
$db_version = Setting::_fetch('version');
$app_version = config('app.version');
return version_compare($app_version, $db_version) === 1;
}
private function updateApps(): void
{
// This lock ensures that the job is not invoked multiple times.
// In 5 minutes all app updates should be finished.
$lock = Cache::lock('updateApps', 5*60);
if ($lock->get()) {
UpdateApps::dispatchAfterResponse();
}
}
}

View File

@@ -2,6 +2,7 @@
namespace App\Providers;
use Illuminate\Support\Facades\Gate;
use Illuminate\Foundation\Support\Providers\AuthServiceProvider as ServiceProvider;
class AuthServiceProvider extends ServiceProvider
@@ -17,9 +18,13 @@ class AuthServiceProvider extends ServiceProvider
/**
* Register any authentication / authorization services.
*
* @return void
*/
public function boot(): void
public function boot()
{
$this->registerPolicies();
//
}
}

View File

@@ -2,15 +2,17 @@
namespace App\Providers;
use Illuminate\Support\Facades\Broadcast;
use Illuminate\Support\ServiceProvider;
use Illuminate\Support\Facades\Broadcast;
class BroadcastServiceProvider extends ServiceProvider
{
/**
* Bootstrap any application services.
*
* @return void
*/
public function boot(): void
public function boot()
{
Broadcast::routes();

View File

@@ -2,6 +2,7 @@
namespace App\Providers;
use Illuminate\Support\Facades\Event;
use Illuminate\Foundation\Support\Providers\EventServiceProvider as ServiceProvider;
class EventServiceProvider extends ServiceProvider
@@ -19,19 +20,13 @@ class EventServiceProvider extends ServiceProvider
/**
* Register any events for your application.
*
* @return void
*/
public function boot(): void
public function boot()
{
parent::boot();
//
}
/**
* Determine if events and listeners should be automatically discovered.
*/
public function shouldDiscoverEvents(): bool
{
return false;
}
}

View File

@@ -2,8 +2,8 @@
namespace App\Providers;
use Illuminate\Foundation\Support\Providers\RouteServiceProvider as ServiceProvider;
use Illuminate\Support\Facades\Route;
use Illuminate\Foundation\Support\Providers\RouteServiceProvider as ServiceProvider;
class RouteServiceProvider extends ServiceProvider
{
@@ -12,13 +12,16 @@ class RouteServiceProvider extends ServiceProvider
*
* In addition, it is set as the URL generator's root namespace.
*
* REMOVED WITH LARAVEL 8 UPGRADE
* @var string
*/
protected $namespace = 'App\Http\Controllers';
/**
* Define your route model bindings, pattern filters, etc.
*
* @return void
*/
public function boot(): void
public function boot()
{
//
@@ -27,8 +30,10 @@ class RouteServiceProvider extends ServiceProvider
/**
* Define the routes for the application.
*
* @return void
*/
public function map(): void
public function map()
{
$this->mapApiRoutes();
@@ -41,10 +46,13 @@ class RouteServiceProvider extends ServiceProvider
* Define the "web" routes for the application.
*
* These routes all receive session state, CSRF protection, etc.
*
* @return void
*/
protected function mapWebRoutes(): void
protected function mapWebRoutes()
{
Route::middleware('web')
->namespace($this->namespace)
->group(base_path('routes/web.php'));
}
@@ -52,11 +60,14 @@ class RouteServiceProvider extends ServiceProvider
* Define the "api" routes for the application.
*
* These routes are typically stateless.
*
* @return void
*/
protected function mapApiRoutes(): void
protected function mapApiRoutes()
{
Route::prefix('api')
->middleware('api')
->namespace($this->namespace)
->group(base_path('routes/api.php'));
}
}

View File

@@ -1,55 +1,52 @@
<?php
<?php namespace App;
namespace App;
use Cache;
use GuzzleHttp\Exception\GuzzleException;
use GuzzleHttp\Client;
use App\Item;
use App\Setting;
use Form;
use Illuminate\Support\Collection;
use Illuminate\Support\Facades\Request as Input;
use Cache;
use Yaml;
abstract class Search
{
/**
* List of all search providers
*
* @return Collection
*
* @return Array
*/
public static function providers(): Collection
public static function providers()
{
$providers = self::standardProviders();
$providers = $providers + self::appProviders();
return collect($providers);
}
/**
* Gets details for a single provider
*
* @return false|object
*
* @return Object
*/
public static function providerDetails($provider)
{
$providers = self::providers();
if (! isset($providers[$provider])) {
return false;
}
return (object) $providers[$provider] ?? false;
if(!isset($providers[$provider])) return false;
return (object)$providers[$provider] ?? false;
}
/**
* Array of the standard providers
*
* @return array
*
* @return Array
*/
public static function standardProviders(): array
public static function standardProviders()
{
// $providers = json_decode(file_get_contents(storage_path('app/searchproviders.json')));
// print_r($providers);
$providers = Yaml::parseFile(storage_path('app/searchproviders.yaml'));
$all = [];
foreach ($providers as $key => $provider) {
foreach($providers as $key => $provider) {
$all[$key] = $provider;
$all[$key]['type'] = 'standard';
}
@@ -60,18 +57,16 @@ abstract class Search
/**
* Loops through users apps to see if app is a search provider, might be worth
* looking into caching this at some point
*
* @return array
*
* @return Array
*/
public static function appProviders(): array
public static function appProviders()
{
$providers = [];
$userapps = Item::all();
foreach ($userapps as $app) {
if (empty($app->class)) {
continue;
}
if (($provider = Item::isSearchProvider($app->class)) !== false) {
foreach($userapps as $app) {
if(empty($app->class)) continue;
if(($provider = Item::isSearchProvider($app->class)) !== false) {
$name = Item::nameFromClass($app->class);
$providers[$app->id] = [
'id' => $app->id,
@@ -81,36 +76,35 @@ abstract class Search
'name' => $app->title,
'colour' => $app->colour,
'icon' => $app->icon,
'description' => $app->description,
'description' => $app->description
];
}
}
return $providers;
}
/**
* Outputs the search form
*
* @return string
*
* @return html
*/
public static function form(): string
public static function form()
{
$output = '';
$homepage_search = Setting::fetch('homepage_search');
$search_provider = Setting::where('key', '=', 'search_provider')->first();
$user_search_provider = Setting::fetch('search_provider');
//die(print_r($search_provider));
//die(var_dump($user_search_provider));
// return early if search isn't applicable
if ((bool) $homepage_search !== true) {
return $output;
}
$user_search_provider = Input::get('p') ?? $user_search_provider ?? 'none';
if((bool)$homepage_search !== true) return $output;
$user_search_provider = $user_search_provider ?? 'none';
if ((bool) $search_provider) {
if ((bool) $user_search_provider) {
if((bool)$homepage_search && (bool)$search_provider) {
if((bool)$user_search_provider) {
$name = 'app.options.'.$user_search_provider;
$provider = self::providerDetails($user_search_provider);
@@ -118,27 +112,20 @@ abstract class Search
$output .= '<form action="'.url('search').'"'.getLinkTargetAttribute().' method="get">';
$output .= '<div id="search-container" class="input-container">';
$output .= '<select name="provider">';
foreach (self::providers() as $key => $searchprovider) {
$selected = ((string) $key === (string) $user_search_provider) ? ' selected="selected"' : '';
foreach(self::providers() as $key => $searchprovider) {
$selected = ((string)$key === (string)$user_search_provider) ? ' selected="selected"' : '';
$output .= '<option value="'.$key.'"'.$selected.'>'.$searchprovider['name'].'</option>';
}
$output .= '</select>';
$output .= Form::text(
'q',
Input::get('q') ?? null,
[
'class' => 'homesearch',
'autofocus' => 'autofocus',
'placeholder' => __('app.settings.search').'...'
]
);
$output .= Form::text('q', null, ['class' => 'homesearch', 'autofocus' => 'autofocus', 'placeholder' => __('app.settings.search').'...']);
$output .= '<button type="submit">'.ucwords(__('app.settings.search')).'</button>';
$output .= '</div>';
$output .= '</form>';
$output .= '</div>';
}
}
return $output;
}
}

View File

@@ -1,8 +1,10 @@
<?php
<?php namespace App;
namespace App;
use GuzzleHttp\Exception\GuzzleException;
use GuzzleHttp\Client;
interface SearchInterface
{
public function getResults($query, $providerdetails);
}
}

View File

@@ -2,47 +2,14 @@
namespace App;
use Form;
use Illuminate\Database\Eloquent\Builder;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Relations\BelongsTo;
use Illuminate\Database\Eloquent\Relations\BelongsToMany;
use Illuminate\Http\Request;
use Illuminate\Session\SessionManager;
use Illuminate\Session\Store;
use Illuminate\Support\Facades\Input;
use Form;
use Illuminate\Support\Facades\Auth;
use App\User;
use App\Search;
use Illuminate\Http\Request;
/**
* App\Setting
*
* @mixin Builder
* @property int $id
* @property int $group_id
* @property string $key
* @property string $type
* @property string|null $options
* @property string $label
* @property string|null $value
* @property string $order
* @property int $system
* @property-read mixed $edit_value
* @property-read mixed $list_value
* @property-read \App\SettingGroup|null $group
* @property-read \Illuminate\Database\Eloquent\Collection|\App\User[] $users
* @property-read int|null $users_count
* @method static Builder|Setting newModelQuery()
* @method static Builder|Setting newQuery()
* @method static Builder|Setting query()
* @method static Builder|Setting whereGroupId($value)
* @method static Builder|Setting whereId($value)
* @method static Builder|Setting whereKey($value)
* @method static Builder|Setting whereLabel($value)
* @method static Builder|Setting whereOptions($value)
* @method static Builder|Setting whereOrder($value)
* @method static Builder|Setting whereSystem($value)
* @method static Builder|Setting whereType($value)
* @method static Builder|Setting whereValue($value)
*/
class Setting extends Model
{
/**
@@ -53,7 +20,7 @@ class Setting extends Model
protected $table = 'settings';
protected $fillable = [
'id', 'group_id', 'key', 'type', 'options', 'label', 'value', 'order', 'system',
'id', 'group_id', 'key', 'type', 'options', 'label', 'value', 'order', 'system'
];
/**
@@ -70,7 +37,10 @@ class Setting extends Model
*/
protected static $cache = [];
public static function getInput(Request $request): object
/**
* @return array
*/
public static function getInput(Request $request)
{
return (object) [
'value' => $request->input('value'),
@@ -80,43 +50,37 @@ class Setting extends Model
public function getListValueAttribute()
{
if ((bool) $this->system === true) {
if((bool)$this->system === true) {
$value = self::_fetch($this->key);
} else {
$value = self::fetch($this->key);
}
$this->value = $value;
switch ($this->type) {
switch($this->type) {
case 'image':
if (! empty($this->value)) {
$value = '<a href="'.asset('storage/'.$this->value).'" title="'.
__('app.settings.view').
'" target="_blank">'.
__('app.settings.view').
'</a>';
if(!empty($this->value)) {
$value = '<a href="'.asset('storage/'.$this->value).'" title="'.__('app.settings.view').'" target="_blank">'.__('app.settings.view').'</a>';
} else {
$value = __('app.options.none');
}
}
break;
case 'boolean':
if ((bool) $this->value === true) {
if((bool)$this->value === true) {
$value = __('app.options.yes');
} else {
$value = __('app.options.no');
}
}
break;
case 'select':
if (! empty($this->value) && $this->value !== 'none') {
$options = (array) json_decode($this->options);
if ($this->key === 'search_provider') {
if(!empty($this->value) && $this->value !== 'none') {
$options = (array)json_decode($this->options);
if($this->key === 'search_provider') {
$options = Search::providers()->pluck('name', 'id')->toArray();
}
$value = (array_key_exists($this->value, $options))
? __($options[$this->value])
: __('app.options.none');
}
$value = __($options[$this->value]);
} else {
$value = __('app.options.none');
}
}
break;
default:
$value = __($this->value);
@@ -124,46 +88,32 @@ class Setting extends Model
}
return $value;
}
public function getEditValueAttribute()
{
if ((bool) $this->system === true) {
if((bool)$this->system === true) {
$value = self::_fetch($this->key);
} else {
$value = self::fetch($this->key);
}
$this->value = $value;
switch ($this->type) {
switch($this->type) {
case 'image':
$value = '';
if (isset($this->value) && ! empty($this->value)) {
$value .= '<a class="setting-view-image" href="'.
asset('storage/'.$this->value).
'" title="'.
__('app.settings.view').
'" target="_blank"><img src="'.
asset('storage/'.
$this->value).
'" /></a>';
if(isset($this->value) && !empty($this->value)) {
$value .= '<a class="setting-view-image" href="'.asset('storage/'.$this->value).'" title="'.__('app.settings.view').'" target="_blank"><img src="'.asset('storage/'.$this->value).'" /></a>';
}
$value .= Form::file('value', ['class' => 'form-control']);
if (isset($this->value) && ! empty($this->value)) {
$value .= '<a class="settinglink" href="'.
route('settings.clear', $this->id).
'" title="'.
__('app.settings.remove').
'">'.
__('app.settings.reset').
'</a>';
if(isset($this->value) && !empty($this->value)) {
$value .= '<a class="settinglink" href="'.route('settings.clear', $this->id).'" title="'.__('app.settings.remove').'">'.__('app.settings.reset').'</a>';
}
break;
case 'boolean':
$checked = false;
if (isset($this->value) && (bool) $this->value === true) {
$checked = true;
}
if(isset($this->value) && (bool)$this->value === true) $checked = true;
$set_checked = ($checked) ? ' checked="checked"' : '';
$value = '
<input type="hidden" name="value" value="0" />
@@ -175,16 +125,24 @@ class Setting extends Model
break;
case 'select':
$options = json_decode($this->options);
if ($this->key === 'search_provider') {
if($this->key === 'search_provider') {
$options = Search::providers()->pluck('name', 'id');
}
foreach ($options as $key => $opt) {
foreach($options as $key => $opt) {
$options->$key = __($opt);
}
$value = Form::select('value', $options, null, ['class' => 'form-control']);
break;
case 'textarea':
$value = Form::textarea('value', null, ['class' => 'form-control', 'cols' => '44', 'rows' => '15']);
$value = Form::textarea('value', null, ['class' => 'form-control', 'cols' => '44', 'rows' => '15', 'style' => 'width: 100%;']);
break;
case 'apikey':
if (isset($this->value) && !empty($this->value)) {
$value = Form::text('value', null, ['class' => 'form-control']);
} else {
$value = '<div>'.$current.'</div>';
}
$value .= '<small style="margin-top: 10px; display: block">'.__('app.settings.click_generate').'</small>';
break;
default:
$value = Form::text('value', null, ['class' => 'form-control']);
@@ -192,97 +150,104 @@ class Setting extends Model
}
return $value;
}
public function group(): BelongsTo
public function group()
{
return $this->belongsTo(\App\SettingGroup::class, 'group_id');
return $this->belongsTo('App\SettingGroup', 'group_id');
}
/**
* @param string $key
*
* @return mixed
*/
public static function fetch(string $key)
public static function fetch($key)
{
$user = self::user();
return self::_fetch($key, $user);
}
// @codingStandardsIgnoreStart
/**
* @param string $key
*
* @return mixed
*/
public static function _fetch(string $key, $user = null)
public static function _fetch($key, $user=null)
{
// @codingStandardsIgnoreEnd
//$cachekey = ($user === null) ? $key : $key.'-'.$user->id;
//if (Setting::cached($cachekey)) {
// return Setting::$cache[$cachekey];
//} else {
$find = self::where('key', '=', $key)->first();
#$cachekey = ($user === null) ? $key : $key.'-'.$user->id;
#if (Setting::cached($cachekey)) {
# return Setting::$cache[$cachekey];
#} else {
$find = self::where('key', '=', $key)->first();
if (! is_null($find)) {
if ((bool) $find->system === true) { // if system variable use global value
$value = $find->value;
} else { // not system variable so use user specific value
// check if user specified value has been set
//print_r($user);
$usersetting = $user->settings()->where('id', $find->id)->first();
//print_r($user->settings);
//die(var_dump($usersetting));
//->pivot->value;
//echo "user: ".$user->id." --- ".$usersettings;
if (isset($usersetting) && ! empty($usersetting)) {
$value = $usersetting->pivot->uservalue;
} else { // if not get default from base setting
//$user->settings()->save($find, ['value' => $find->value]);
//$has_setting = $user->settings()->where('id', $find->id)->exists();
//if($has_setting) {
// $user->settings()->updateExistingPivot($find->id, ['uservalue' => (string)$find->value]);
//} else {
// $user->settings()->save($find, ['uservalue' => (string)$find->value]);
//}
if (!is_null($find)) {
if((bool)$find->system === true) { // if system variable use global value
$value = $find->value;
} else { // not system variable so use user specific value
// check if user specified value has been set
//print_r($user);
$usersetting = $user->settings()->where('id', $find->id)->first();
//print_r($user->settings);
//die(var_dump($usersetting));
//->pivot->value;
//echo "user: ".$user->id." --- ".$usersettings;
if(isset($usersetting) && !empty($usersetting)) {
$value = $usersetting->pivot->uservalue;
} else { // if not get default from base setting
//$user->settings()->save($find, ['value' => $find->value]);
#$has_setting = $user->settings()->where('id', $find->id)->exists();
#if($has_setting) {
# $user->settings()->updateExistingPivot($find->id, ['uservalue' => (string)$find->value]);
#} else {
# $user->settings()->save($find, ['uservalue' => (string)$find->value]);
#}
$value = $find->value;
}
}
}
//Setting::add($cachekey, $value);
#Setting::add($cachekey, $value);
return $value;
} else {
return false;
}
//}
return $value;
} else {
return false;
}
#}
}
/**
* @param string $key
* @param $value
*/
public static function add(string $key, $value)
public static function add($key, $value)
{
self::$cache[$key] = $value;
Setting::$cache[$key] = $value;
}
public static function cached(string $key): bool
/**
* @param string $key
*
* @return bool
*/
public static function cached($key)
{
return array_key_exists($key, self::$cache);
return array_key_exists($key, Setting::$cache);
}
/**
* The users that belong to the setting.
*/
public function users(): BelongsToMany
public function users()
{
return $this->belongsToMany(\App\User::class)->using(\App\SettingUser::class)->withPivot('uservalue');
return $this->belongsToMany('App\User')->using('App\SettingUser')->withPivot('uservalue');
}
/**
* @return \Illuminate\Contracts\Foundation\Application|SessionManager|Store|mixed
*/
public static function user()
{
return User::currentUser();
}
}

View File

@@ -3,24 +3,7 @@
namespace App;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Relations\HasMany;
/**
* App\SettingGroup
*
* @property int $id
* @property string $title
* @property int $order
* @property-read \Illuminate\Database\Eloquent\Collection|\App\Setting[] $settings
* @property-read int|null $settings_count
* @method static \Illuminate\Database\Eloquent\Builder|SettingGroup newModelQuery()
* @method static \Illuminate\Database\Eloquent\Builder|SettingGroup newQuery()
* @method static \Illuminate\Database\Eloquent\Builder|SettingGroup query()
* @method static \Illuminate\Database\Eloquent\Builder|SettingGroup whereId($value)
* @method static \Illuminate\Database\Eloquent\Builder|SettingGroup whereOrder($value)
* @method static \Illuminate\Database\Eloquent\Builder|SettingGroup whereTitle($value)
* @mixin \Eloquent
*/
class SettingGroup extends Model
{
/**
@@ -37,8 +20,8 @@ class SettingGroup extends Model
*/
public $timestamps = false;
public function settings(): HasMany
public function settings()
{
return $this->hasMany(\App\Setting::class, 'group_id');
return $this->hasMany('App\Setting', 'group_id');
}
}

View File

@@ -4,20 +4,6 @@ namespace App;
use Illuminate\Database\Eloquent\Relations\Pivot;
/**
* App\SettingUser
*
* @property int $setting_id
* @property int $user_id
* @property string|null $uservalue
* @method static \Illuminate\Database\Eloquent\Builder|SettingUser newModelQuery()
* @method static \Illuminate\Database\Eloquent\Builder|SettingUser newQuery()
* @method static \Illuminate\Database\Eloquent\Builder|SettingUser query()
* @method static \Illuminate\Database\Eloquent\Builder|SettingUser whereSettingId($value)
* @method static \Illuminate\Database\Eloquent\Builder|SettingUser whereUserId($value)
* @method static \Illuminate\Database\Eloquent\Builder|SettingUser whereUservalue($value)
* @mixin \Eloquent
*/
class SettingUser extends Pivot
{
//

View File

@@ -1,46 +1,34 @@
<?php
<?php namespace App;
namespace App;
use GuzzleHttp\Client;
use GuzzleHttp\Exception\ConnectException;
use GuzzleHttp\Exception\GuzzleException;
use GuzzleHttp\Exception\ServerException;
use GuzzleHttp\Client;
use Illuminate\Support\Facades\Log;
use Psr\Http\Message\ResponseInterface;
abstract class SupportedApps
{
protected $jar = false;
protected $method = 'GET';
protected $error;
/**
* @param $url
* @param array $attrs
* @return object
* @throws GuzzleException
*/
public function appTest($url, array $attrs = []): object
public function appTest($url, $attrs = [], $overridevars=false)
{
if (empty($this->config->url)) {
return (object) [
if(empty($this->config->url)) {
return (object)[
'code' => 404,
'status' => 'No URL has been specified',
'response' => 'No URL has been specified',
];
];
}
$res = $this->execute($url, $attrs);
if ($res == null) {
return (object) [
if($res == null) {
return (object)[
'code' => null,
'status' => $this->error,
'response' => 'Connection failed',
];
}
switch ($res->getStatusCode()) {
switch($res->getStatusCode()) {
case 200:
$status = 'Successfully communicated with the API';
break;
@@ -54,138 +42,92 @@ abstract class SupportedApps
$status = 'Something went wrong... Code: '.$res->getStatusCode();
break;
}
return (object) [
return (object)[
'code' => $res->getStatusCode(),
'status' => $status,
'response' => $res->getBody(),
];
}
/**
* @param $url
* @param array $attrs
* @param array|bool|null $overridevars
* @param string|bool|null $overridemethod
* @return ResponseInterface|null
* @throws GuzzleException
*/
public function execute(
$url,
array $attrs = [],
$overridevars = null,
$overridemethod = null
): ?ResponseInterface {
public function execute($url, $attrs = [], $overridevars=false, $overridemethod=false)
{
$res = null;
$vars = ($overridevars === null || $overridevars === false) ?
[
'http_errors' => false,
'timeout' => 15,
$vars = ($overridevars !== false) ?
$overridevars : [
'http_errors' => false,
'timeout' => 15,
'connect_timeout' => 15,
] : $overridevars;
];
$client = new Client($vars);
$method = ($overridemethod === null || $overridemethod === false) ? $this->method : $overridemethod;
$method = ($overridemethod !== false) ? $overridemethod : $this->method;
try {
return $client->request($method, $url, $attrs);
} catch (ConnectException $e) {
Log::error('Connection refused');
return $client->request($method, $url, $attrs);
} catch (\GuzzleHttp\Exception\ConnectException $e) {
Log::error("Connection refused");
Log::debug($e->getMessage());
$this->error = 'Connection refused - '.(string) $e->getMessage();
} catch (ServerException $e) {
$this->error = "Connection refused - ".(string) $e->getMessage();
} catch (\GuzzleHttp\Exception\ServerException $e) {
Log::debug($e->getMessage());
$this->error = (string) $e->getResponse()->getBody();
}
$this->error = 'General error connecting with API';
return $res;
}
/**
* @return void
*/
public function login()
{
}
/**
* @param string $url
* @param bool $addslash
* @return string
*/
public function normaliseurl(string $url, bool $addslash = true): string
public function normaliseurl($url, $addslash=true)
{
$url = rtrim($url, '/');
if ($addslash) {
$url .= '/';
}
if($addslash) $url .= '/';
return $url;
}
/**
* @param $status
* @param $data
* @return false|string
*/
public function getLiveStats($status, $data)
{
$className = $this::class;
$className = get_class($this);
$explode = explode('\\', $className);
$name = end($explode);
$html = view('SupportedApps::'.$name.'.livestats', $data)->with('data', $data)->render();
return json_encode(['status' => $status, 'html' => $html]);
//return
//return
}
/**
* @return ResponseInterface
* @throws GuzzleException
*/
public static function getList(): ResponseInterface
public static function getList()
{
// $list_url = 'https://apps.heimdall.site/list';
$list_url = config('app.appsource').'list.json';
$client = new Client(['http_errors' => false, 'verify' => false, 'timeout' => 15, 'connect_timeout' => 15]);
$client = new Client(['http_errors' => false, 'timeout' => 15, 'connect_timeout' => 15]);
return $client->request('GET', $list_url);
}
public static function configValue($item = null, $key = null)
public static function configValue($item=null, $key=null)
{
if (isset($item) && ! empty($item)) {
if(isset($item) && !empty($item)) {
return $item->getconfig()->$key;
} else {
return null;
}
} else return null;
}
/**
* @param $app
* @return bool|false
* @throws GuzzleException
*/
public static function getFiles($app): bool
public static function getFiles($app)
{
Log::debug("Download triggered for ".print_r($app, true));
$zipurl = config('app.appsource').'files/'.$app->sha.'.zip';
$client = new Client(['http_errors' => false, 'timeout' => 60, 'connect_timeout' => 15, 'verify' => false]);
$client = new Client(['http_errors' => false, 'timeout' => 60, 'connect_timeout' => 15]);
$res = $client->request('GET', $zipurl);
// Something went wrong?
if ($res->getStatusCode() !== 200) {
return false;
}
if (! file_exists(app_path('SupportedApps'))) {
if(!file_exists(app_path('SupportedApps'))) {
mkdir(app_path('SupportedApps'), 0777, true);
}
@@ -200,18 +142,11 @@ abstract class SupportedApps
unlink($src); //Deleting the Zipped file
} else {
var_dump($x);
return false;
}
return true;
}
/**
* @param $details
* @param $app
* @return mixed
*/
public static function saveApp($details, $app)
{
{
$app->appid = $details->appid;
$app->name = $details->name;
$app->sha = $details->sha ?? null;
@@ -221,12 +156,12 @@ abstract class SupportedApps
$appclass = $app->class();
$application = new $appclass;
$enhanced = (bool) ($application instanceof \App\EnhancedApps);
$enhanced = (bool)($application instanceof \App\EnhancedApps);
$app->class = $appclass;
$app->enhanced = $enhanced;
$app->tile_background = $details->tile_background;
$app->save();
return $app;
return $app;
}
}
}

View File

@@ -2,54 +2,13 @@
namespace App;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Relations\BelongsToMany;
use Illuminate\Database\Eloquent\Relations\HasMany;
use Illuminate\Foundation\Auth\User as Authenticatable;
use Illuminate\Notifications\Notifiable;
use Illuminate\Foundation\Auth\User as Authenticatable;
// @codingStandardsIgnoreStart
/**
* App\User
*
* @property int $id
* @property string $username
* @property string $email
* @property string|null $avatar
* @property string|null $password
* @property string|null $autologin
* @property int $public_front
* @property string|null $remember_token
* @property \Illuminate\Support\Carbon|null $created_at
* @property \Illuminate\Support\Carbon|null $updated_at
* @property-read \Illuminate\Database\Eloquent\Collection|\App\Item[] $items
* @property-read int|null $items_count
* @property-read \Illuminate\Notifications\DatabaseNotificationCollection|\Illuminate\Notifications\DatabaseNotification[] $notifications
* @property-read int|null $notifications_count
* @property-read \Illuminate\Database\Eloquent\Collection|\App\Setting[] $settings
* @property-read int|null $settings_count
* @method static \Illuminate\Database\Eloquent\Builder|User newModelQuery()
* @method static \Illuminate\Database\Eloquent\Builder|User newQuery()
* @method static \Illuminate\Database\Eloquent\Builder|User query()
* @method static \Illuminate\Database\Eloquent\Builder|User whereAutologin($value)
* @method static \Illuminate\Database\Eloquent\Builder|User whereAvatar($value)
* @method static \Illuminate\Database\Eloquent\Builder|User whereCreatedAt($value)
* @method static \Illuminate\Database\Eloquent\Builder|User whereEmail($value)
* @method static \Illuminate\Database\Eloquent\Builder|User whereId($value)
* @method static \Illuminate\Database\Eloquent\Builder|User wherePassword($value)
* @method static \Illuminate\Database\Eloquent\Builder|User wherePublicFront($value)
* @method static \Illuminate\Database\Eloquent\Builder|User whereRememberToken($value)
* @method static \Illuminate\Database\Eloquent\Builder|User whereUpdatedAt($value)
* @method static \Illuminate\Database\Eloquent\Builder|User whereUsername($value)
* @mixin \Eloquent
*/
// @codingStandardsIgnoreEnd
class User extends Authenticatable
{
use Notifiable;
use HasFactory;
/**
* The attributes that are mass assignable.
*
@@ -68,28 +27,20 @@ class User extends Authenticatable
'password', 'remember_token',
];
/**
* @return mixed
*/
public function getId()
{
return $this->id;
}
/**
* Get the items for the user.
*/
public function items(): HasMany
public function items()
{
return $this->hasMany(Item::class);
return $this->hasMany('App\Item');
}
/**
* The settings that belong to the user.
*/
public function settings(): BelongsToMany
public function settings()
{
return $this->belongsToMany(Setting::class)->withPivot('uservalue');
return $this->belongsToMany('App\Setting')->withPivot('uservalue');
}
public static function currentUser()
@@ -98,13 +49,15 @@ class User extends Authenticatable
if ($current_user) { // if logged in, set this user
return $current_user;
} else { // not logged in, get first user
$user = self::where('public_front', true)->first();
if (! $user) {
$user = self::first();
$user = User::where('public_front',true)->first();
if(!$user) {
$user = User::first();
}
session(['current_user' => $user]);
return $user;
}
}
}

View File

@@ -12,7 +12,7 @@
*/
$app = new Illuminate\Foundation\Application(
$_ENV['APP_BASE_PATH'] ?? dirname(__DIR__)
realpath(__DIR__.'/../')
);
/*

View File

@@ -1,48 +1,37 @@
{
"name": "laravel/laravel",
"description": "The Laravel Framework.",
"keywords": [
"framework",
"laravel"
],
"keywords": ["framework", "laravel"],
"license": "MIT",
"type": "project",
"require": {
"php": "^8.1",
"graham-campbell/github": "^12.0",
"php": ">=7.2.5",
"fideloper/proxy": "^4.0",
"graham-campbell/github": "^10.5",
"guzzlehttp/guzzle": "^7.4",
"laravel/framework": "^10.44",
"laravel/tinker": "^2.8",
"laravel/ui": "^4.2",
"laravelcollective/html": "^6.4",
"nunomaduro/collision": "^6.3",
"symfony/yaml": "^6.2",
"ext-json": "*",
"ext-intl": "*",
"league/flysystem-aws-s3-v3": "^3.0",
"spatie/laravel-ignition": "^2.0"
"laravel/framework": "^7.0",
"laravel/tinker": "^2.0",
"laravel/ui": "^2.4",
"laravelcollective/html": "^6.0",
"symfony/yaml": "^5.4"
},
"require-dev": {
"barryvdh/laravel-ide-helper": "^2.13",
"filp/whoops": "^2.8",
"mockery/mockery": "^1.4.4",
"phpunit/phpunit": "^9.5.10",
"squizlabs/php_codesniffer": "3.*",
"symfony/thanks": "^1.2",
"fakerphp/faker": "^1.9.1"
"filp/whoops": "~2.0",
"fzaninotto/faker": "~1.4",
"mockery/mockery": "~1.0",
"phpunit/phpunit": "~6.0",
"symfony/thanks": "^1.0"
},
"autoload": {
"classmap": [
"database/seeders",
"database/seeds",
"database/factories"
],
"files": [
"app/Helper.php"
],
"psr-4": {
"App\\": "app/",
"Database\\Factories\\": "database/factories/",
"Database\\Seeders\\": "database/seeders/"
"App\\": "app/"
}
},
"autoload-dev": {
@@ -53,7 +42,6 @@
"extra": {
"laravel": {
"dont-discover": [
"barryvdh/laravel-ide-helper"
]
}
},
@@ -67,12 +55,6 @@
"post-autoload-dump": [
"Illuminate\\Foundation\\ComposerScripts::postAutoloadDump",
"@php artisan package:discover"
],
"post-update-cmd": [
"Illuminate\\Foundation\\ComposerScripts::postUpdate",
"@php artisan ide-helper:generate",
"@php artisan ide-helper:meta",
"@php artisan vendor:publish --tag=laravel-assets --ansi --force"
]
},
"config": {
@@ -81,10 +63,7 @@
"optimize-autoloader": true,
"allow-plugins": {
"kylekatarnls/update-helper": true,
"symfony/thanks": true,
"php-http/discovery": true
"symfony/thanks": true
}
},
"minimum-stability": "stable",
"prefer-stable": true
}
}

6466
composer.lock generated

File diff suppressed because it is too large Load Diff

View File

@@ -1,8 +1,5 @@
<?php
use Illuminate\Support\ServiceProvider;
use Illuminate\Support\Facades\Facade;
return [
/*
@@ -16,8 +13,8 @@ return [
|
*/
'name' => env('APP_NAME', 'Heimdall'),
'version' => '2.6.3',
'name' => env('APP_NAME', 'Heimdall'),
'version' => '2.5.0-beta1',
/*
|--------------------------------------------------------------------------
@@ -43,7 +40,7 @@ return [
|
*/
'debug' => (bool) env('APP_DEBUG', false),
'debug' => env('APP_DEBUG', false),
/*
|--------------------------------------------------------------------------
@@ -57,10 +54,9 @@ return [
*/
'url' => env('APP_URL', 'http://localhost'),
'asset_url' => env('ASSET_URL', null),
'appsource' => env('APP_SOURCE', 'https://appslist.heimdall.site/'),
/*
|--------------------------------------------------------------------------
| Application Timezone
@@ -100,19 +96,6 @@ return [
'fallback_locale' => 'en',
/*
|--------------------------------------------------------------------------
| Faker Locale
|--------------------------------------------------------------------------
|
| This locale will be used by the Faker PHP library when generating fake
| data for your database seeds. For example, this will be used to get
| localized telephone numbers, street address information and more.
|
*/
'faker_locale' => 'en_US',
/*
|--------------------------------------------------------------------------
| Encryption Key
@@ -130,21 +113,20 @@ return [
/*
|--------------------------------------------------------------------------
| Maintenance Mode Driver
| Logging Configuration
|--------------------------------------------------------------------------
|
| These configuration options determine the driver used to determine and
| manage Laravel's "maintenance mode" status. The "cache" driver will
| allow maintenance mode to be controlled across multiple machines.
| Here you may configure the log settings for your application. Out of
| the box, Laravel uses the Monolog PHP logging library. This gives
| you a variety of powerful log handlers / formatters to utilize.
|
| Supported drivers: "file", "cache"
| Available Settings: "single", "daily", "syslog", "errorlog"
|
*/
'maintenance' => [
'driver' => 'file',
// 'store' => 'redis',
],
'log' => env('APP_LOG', 'single'),
'log_level' => env('APP_LOG_LEVEL', 'debug'),
/*
|--------------------------------------------------------------------------
@@ -157,7 +139,34 @@ return [
|
*/
'providers' => ServiceProvider::defaultProviders()->merge([
'providers' => [
/*
* Laravel Framework Service Providers...
*/
Illuminate\Auth\AuthServiceProvider::class,
Illuminate\Broadcasting\BroadcastServiceProvider::class,
Illuminate\Bus\BusServiceProvider::class,
Illuminate\Cache\CacheServiceProvider::class,
Illuminate\Foundation\Providers\ConsoleSupportServiceProvider::class,
Illuminate\Cookie\CookieServiceProvider::class,
Illuminate\Database\DatabaseServiceProvider::class,
Illuminate\Encryption\EncryptionServiceProvider::class,
Illuminate\Filesystem\FilesystemServiceProvider::class,
Illuminate\Foundation\Providers\FoundationServiceProvider::class,
Illuminate\Hashing\HashServiceProvider::class,
Illuminate\Mail\MailServiceProvider::class,
Illuminate\Notifications\NotificationServiceProvider::class,
Illuminate\Pagination\PaginationServiceProvider::class,
Illuminate\Pipeline\PipelineServiceProvider::class,
Illuminate\Queue\QueueServiceProvider::class,
Illuminate\Redis\RedisServiceProvider::class,
Illuminate\Auth\Passwords\PasswordResetServiceProvider::class,
Illuminate\Session\SessionServiceProvider::class,
Illuminate\Translation\TranslationServiceProvider::class,
Illuminate\Validation\ValidationServiceProvider::class,
Illuminate\View\ViewServiceProvider::class,
/*
* Package Service Providers...
*/
@@ -170,7 +179,8 @@ return [
// App\Providers\BroadcastServiceProvider::class,
App\Providers\EventServiceProvider::class,
App\Providers\RouteServiceProvider::class,
])->toArray(),
],
/*
|--------------------------------------------------------------------------
@@ -183,13 +193,48 @@ return [
|
*/
'aliases' => Facade::defaultAliases()->merge([
'EnhancedApps' => App\EnhancedApps::class,
'aliases' => [
'App' => Illuminate\Support\Facades\App::class,
'Artisan' => Illuminate\Support\Facades\Artisan::class,
'Auth' => Illuminate\Support\Facades\Auth::class,
'Blade' => Illuminate\Support\Facades\Blade::class,
'Broadcast' => Illuminate\Support\Facades\Broadcast::class,
'Bus' => Illuminate\Support\Facades\Bus::class,
'Cache' => Illuminate\Support\Facades\Cache::class,
'Config' => Illuminate\Support\Facades\Config::class,
'Cookie' => Illuminate\Support\Facades\Cookie::class,
'Crypt' => Illuminate\Support\Facades\Crypt::class,
'DB' => Illuminate\Support\Facades\DB::class,
'Eloquent' => Illuminate\Database\Eloquent\Model::class,
'Event' => Illuminate\Support\Facades\Event::class,
'File' => Illuminate\Support\Facades\File::class,
'Form' => Collective\Html\FormFacade::class,
'Gate' => Illuminate\Support\Facades\Gate::class,
'Hash' => Illuminate\Support\Facades\Hash::class,
'Html' => Collective\Html\HtmlFacade::class,
'Lang' => Illuminate\Support\Facades\Lang::class,
'Log' => Illuminate\Support\Facades\Log::class,
'Mail' => Illuminate\Support\Facades\Mail::class,
'Notification' => Illuminate\Support\Facades\Notification::class,
'Password' => Illuminate\Support\Facades\Password::class,
'Queue' => Illuminate\Support\Facades\Queue::class,
'Redirect' => Illuminate\Support\Facades\Redirect::class,
'Redis' => Illuminate\Support\Facades\Redis::class,
'SupportedApps' => App\SupportedApps::class,
'Request' => Illuminate\Support\Facades\Request::class,
'Response' => Illuminate\Support\Facades\Response::class,
'Route' => Illuminate\Support\Facades\Route::class,
'Schema' => Illuminate\Support\Facades\Schema::class,
'Session' => Illuminate\Support\Facades\Session::class,
'Storage' => Illuminate\Support\Facades\Storage::class,
'URL' => Illuminate\Support\Facades\URL::class,
'Validator' => Illuminate\Support\Facades\Validator::class,
'View' => Illuminate\Support\Facades\View::class,
'Yaml' => Symfony\Component\Yaml\Yaml::class,
])->toArray(),
'SupportedApps' => App\SupportedApps::class,
'EnhancedApps' => App\EnhancedApps::class,
],
];

View File

@@ -31,7 +31,7 @@ return [
| users are actually retrieved out of your database or other storage
| mechanisms used by this application to persist your user's data.
|
| Supported: "session"
| Supported: "session", "token"
|
*/
@@ -44,7 +44,6 @@ return [
'api' => [
'driver' => 'token',
'provider' => 'users',
'hash' => false,
],
],
@@ -86,36 +85,18 @@ return [
| than one user table or model in the application and you want to have
| separate password reset settings based on the specific user types.
|
| The expiry time is the number of minutes that each reset token will be
| The expire time is the number of minutes that the reset token should be
| considered valid. This security feature keeps tokens short-lived so
| they have less time to be guessed. You may change this as needed.
|
| The throttle setting is the number of seconds a user must wait before
| generating more password reset tokens. This prevents the user from
| quickly generating a very large amount of password reset tokens.
|
*/
'passwords' => [
'users' => [
'provider' => 'users',
'table' => 'password_reset_tokens',
'table' => 'password_resets',
'expire' => 60,
'throttle' => 60,
],
],
/*
|--------------------------------------------------------------------------
| Password Confirmation Timeout
|--------------------------------------------------------------------------
|
| Here you may define the amount of seconds before a password confirmation
| times out and the user is prompted to re-enter their password via the
| confirmation screen. By default, the timeout lasts for three hours.
|
*/
'password_timeout' => 10800,
];

View File

@@ -11,7 +11,7 @@ return [
| framework when an event needs to be broadcast. You may set this to
| any of the connections defined in the "connections" array below.
|
| Supported: "pusher", "ably", "redis", "log", "null"
| Supported: "pusher", "redis", "log", "null"
|
*/
@@ -37,20 +37,8 @@ return [
'app_id' => env('PUSHER_APP_ID'),
'options' => [
'cluster' => env('PUSHER_APP_CLUSTER'),
'host' => env('PUSHER_HOST') ?: 'api-'.env('PUSHER_APP_CLUSTER', 'mt1').'.pusher.com',
'port' => env('PUSHER_PORT', 443),
'scheme' => env('PUSHER_SCHEME', 'https'),
'encrypted' => true,
'useTLS' => env('PUSHER_SCHEME', 'https') === 'https',
],
'client_options' => [
// Guzzle client options: https://docs.guzzlephp.org/en/stable/request-options.html
],
],
'ably' => [
'driver' => 'ably',
'key' => env('ABLY_KEY'),
],
'redis' => [

View File

@@ -1,7 +1,5 @@
<?php
use Illuminate\Support\Str;
return [
/*
@@ -13,6 +11,8 @@ return [
| using this caching library. This connection is used when another is
| not explicitly specified when executing a given caching function.
|
| Supported: "apc", "array", "database", "file", "memcached", "redis"
|
*/
'default' => env('CACHE_DRIVER', 'file'),
@@ -26,9 +26,6 @@ return [
| well as their drivers. You may even define multiple stores for the
| same cache driver to group types of items stored in your caches.
|
| Supported drivers: "apc", "array", "database", "file",
| "memcached", "redis", "dynamodb", "octane", "null"
|
*/
'stores' => [
@@ -39,20 +36,17 @@ return [
'array' => [
'driver' => 'array',
'serialize' => false,
],
'database' => [
'driver' => 'database',
'table' => 'cache',
'connection' => null,
'lock_connection' => null,
],
'file' => [
'driver' => 'file',
'path' => storage_path('framework/cache/data'),
'lock_path' => storage_path('framework/cache/data'),
],
'memcached' => [
@@ -63,7 +57,7 @@ return [
env('MEMCACHED_PASSWORD'),
],
'options' => [
// Memcached::OPT_CONNECT_TIMEOUT => 2000,
// Memcached::OPT_CONNECT_TIMEOUT => 2000,
],
'servers' => [
[
@@ -77,20 +71,6 @@ return [
'redis' => [
'driver' => 'redis',
'connection' => 'default',
'lock_connection' => 'default',
],
'dynamodb' => [
'driver' => 'dynamodb',
'key' => env('AWS_ACCESS_KEY_ID'),
'secret' => env('AWS_SECRET_ACCESS_KEY'),
'region' => env('AWS_DEFAULT_REGION', 'us-east-1'),
'table' => env('DYNAMODB_CACHE_TABLE', 'cache'),
'endpoint' => env('DYNAMODB_ENDPOINT'),
],
'octane' => [
'driver' => 'octane',
],
],
@@ -100,12 +80,15 @@ return [
| Cache Key Prefix
|--------------------------------------------------------------------------
|
| When utilizing the APC, database, memcached, Redis, or DynamoDB cache
| stores there might be other applications using the same cache. For
| that reason, you may prefix every cache key to avoid collisions.
| When utilizing a RAM based store such as APC or Memcached, there might
| be other applications utilizing the same cache. So, we'll specify a
| value to get prefixed to all our keys so we can avoid collisions.
|
*/
'prefix' => env('CACHE_PREFIX', Str::slug(env('APP_NAME', 'laravel'), '_').'_cache_'),
'prefix' => env(
'CACHE_PREFIX',
str_slug(env('APP_NAME', 'laravel'), '_').'_cache'
),
];

View File

@@ -1,34 +0,0 @@
<?php
return [
/*
|--------------------------------------------------------------------------
| Cross-Origin Resource Sharing (CORS) Configuration
|--------------------------------------------------------------------------
|
| Here you may configure your settings for cross-origin resource sharing
| or "CORS". This determines what cross-origin operations may execute
| in web browsers. You are free to adjust these settings as needed.
|
| To learn more: https://developer.mozilla.org/en-US/docs/Web/HTTP/CORS
|
*/
'paths' => ['api/*', 'sanctum/csrf-cookie'],
'allowed_methods' => ['*'],
'allowed_origins' => ['*'],
'allowed_origins_patterns' => [],
'allowed_headers' => ['*'],
'exposed_headers' => [],
'max_age' => 0,
'supports_credentials' => false,
];

View File

@@ -15,7 +15,7 @@ return [
|
*/
'default' => env('DB_CONNECTION', 'mysql'),
'default' => env('DB_CONNECTION', 'sqlite'),
/*
|--------------------------------------------------------------------------
@@ -37,15 +37,13 @@ return [
'sqlite' => [
'driver' => 'sqlite',
'url' => env('DATABASE_URL'),
'database' => database_path(env('DB_DATABASE', 'database.sqlite')),
//'database' => env('DB_DATABASE', database_path('database.sqlite')),
'database' => database_path(env('DB_DATABASE', 'app.sqlite')),
'prefix' => '',
'foreign_key_constraints' => env('DB_FOREIGN_KEYS', true),
],
'mysql' => [
'driver' => 'mysql',
'url' => env('DATABASE_URL'),
'host' => env('DB_HOST', '127.0.0.1'),
'port' => env('DB_PORT', '3306'),
'database' => env('DB_DATABASE', 'forge'),
@@ -55,17 +53,12 @@ return [
'charset' => 'utf8mb4',
'collation' => 'utf8mb4_unicode_ci',
'prefix' => '',
'prefix_indexes' => true,
'strict' => true,
'engine' => null,
'options' => extension_loaded('pdo_mysql') ? array_filter([
PDO::MYSQL_ATTR_SSL_CA => env('MYSQL_ATTR_SSL_CA'),
]) : [],
],
'pgsql' => [
'driver' => 'pgsql',
'url' => env('DATABASE_URL'),
'host' => env('DB_HOST', '127.0.0.1'),
'port' => env('DB_PORT', '5432'),
'database' => env('DB_DATABASE', 'forge'),
@@ -73,14 +66,12 @@ return [
'password' => env('DB_PASSWORD', ''),
'charset' => 'utf8',
'prefix' => '',
'prefix_indexes' => true,
'search_path' => 'public',
'schema' => 'public',
'sslmode' => 'prefer',
],
'sqlsrv' => [
'driver' => 'sqlsrv',
'url' => env('DATABASE_URL'),
'host' => env('DB_HOST', 'localhost'),
'port' => env('DB_PORT', '1433'),
'database' => env('DB_DATABASE', 'forge'),
@@ -88,9 +79,6 @@ return [
'password' => env('DB_PASSWORD', ''),
'charset' => 'utf8',
'prefix' => '',
'prefix_indexes' => true,
// 'encrypt' => env('DB_ENCRYPT', 'yes'),
// 'trust_server_certificate' => env('DB_TRUST_SERVER_CERTIFICATE', 'false'),
],
],
@@ -114,7 +102,7 @@ return [
|--------------------------------------------------------------------------
|
| Redis is an open source, fast, and advanced key-value store that also
| provides a richer body of commands than a typical key-value system
| provides a richer set of commands than a typical key-value systems
| such as APC or Memcached. Laravel makes it easy to dig right in.
|
*/
@@ -131,8 +119,7 @@ return [
'default' => [
'url' => env('REDIS_URL'),
'host' => env('REDIS_HOST', '127.0.0.1'),
'username' => env('REDIS_USERNAME'),
'password' => env('REDIS_PASSWORD'),
'password' => env('REDIS_PASSWORD', null),
'port' => env('REDIS_PORT', '6379'),
'database' => env('REDIS_DB', '0'),
],
@@ -140,8 +127,7 @@ return [
'cache' => [
'url' => env('REDIS_URL'),
'host' => env('REDIS_HOST', '127.0.0.1'),
'username' => env('REDIS_USERNAME'),
'password' => env('REDIS_PASSWORD'),
'password' => env('REDIS_PASSWORD', null),
'port' => env('REDIS_PORT', '6379'),
'database' => env('REDIS_CACHE_DB', '1'),
],

View File

@@ -13,7 +13,18 @@ return [
|
*/
'default' => env('FILESYSTEM_DISK', 'local'),
'default' => env('FILESYSTEM_DRIVER', 'public'),
/*
|--------------------------------------------------------------------------
| Default Cloud Filesystem Disk
|--------------------------------------------------------------------------
|
| Many applications store files both locally and in the cloud. For this
| reason, you may specify a default "cloud" driver here. This driver
| will be bound as the Cloud disk implementation in the container.
|
*/
'cloud' => env('FILESYSTEM_CLOUD', 's3'),
@@ -24,9 +35,9 @@ return [
|
| Here you may configure as many filesystem "disks" as you wish, and you
| may even configure multiple disks of the same driver. Defaults have
| been set up for each driver as an example of the required values.
| been setup for each driver as an example of the required options.
|
| Supported Drivers: "local", "ftp", "sftp", "s3"
| Supported Drivers: "local", "ftp", "s3", "rackspace"
|
*/
@@ -35,7 +46,6 @@ return [
'local' => [
'driver' => 'local',
'root' => storage_path('app'),
'throw' => false,
],
'public' => [
@@ -43,7 +53,6 @@ return [
'root' => storage_path('app/public'),
'url' => env('APP_URL').'/storage',
'visibility' => 'public',
'throw' => false,
],
's3' => [
@@ -52,27 +61,8 @@ return [
'secret' => env('AWS_SECRET_ACCESS_KEY'),
'region' => env('AWS_DEFAULT_REGION'),
'bucket' => env('AWS_BUCKET'),
'url' => env('AWS_URL'),
'endpoint' => env('AWS_ENDPOINT'),
'use_path_style_endpoint' => env('AWS_USE_PATH_STYLE_ENDPOINT', false),
'throw' => false,
],
],
/*
|--------------------------------------------------------------------------
| Symbolic Links
|--------------------------------------------------------------------------
|
| Here you may configure the symbolic links that will be created when the
| `storage:link` Artisan command is executed. The array keys should be
| the locations of the links and the values should be their targets.
|
*/
'links' => [
public_path('storage') => storage_path('app/public'),
],
];

View File

@@ -1,54 +0,0 @@
<?php
return [
/*
|--------------------------------------------------------------------------
| Default Hash Driver
|--------------------------------------------------------------------------
|
| This option controls the default hash driver that will be used to hash
| passwords for your application. By default, the bcrypt algorithm is
| used; however, you remain free to modify this option if you wish.
|
| Supported: "bcrypt", "argon", "argon2id"
|
*/
'driver' => 'bcrypt',
/*
|--------------------------------------------------------------------------
| Bcrypt Options
|--------------------------------------------------------------------------
|
| Here you may specify the configuration options that should be used when
| passwords are hashed using the Bcrypt algorithm. This will allow you
| to control the amount of time it takes to hash the given password.
|
*/
'bcrypt' => [
'rounds' => env('BCRYPT_ROUNDS', 12),
'verify' => true,
],
/*
|--------------------------------------------------------------------------
| Argon Options
|--------------------------------------------------------------------------
|
| Here you may specify the configuration options that should be used when
| passwords are hashed using the Argon algorithm. These will allow you
| to control the amount of time it takes to hash the given password.
|
*/
'argon' => [
'memory' => 65536,
'threads' => 1,
'time' => 4,
'verify' => true,
],
];

View File

@@ -3,7 +3,6 @@
use Monolog\Handler\NullHandler;
use Monolog\Handler\StreamHandler;
use Monolog\Handler\SyslogUdpHandler;
use Monolog\Processor\PsrLogMessageProcessor;
return [
@@ -20,22 +19,6 @@ return [
'default' => env('LOG_CHANNEL', 'stack'),
/*
|--------------------------------------------------------------------------
| Deprecations Log Channel
|--------------------------------------------------------------------------
|
| This option controls the log channel that should be used to log warnings
| regarding deprecated PHP and library features. This allows you to get
| your application ready for upcoming major versions of dependencies.
|
*/
'deprecations' => [
'channel' => env('LOG_DEPRECATIONS_CHANNEL', 'null'),
'trace' => false,
],
/*
|--------------------------------------------------------------------------
| Log Channels
@@ -61,16 +44,14 @@ return [
'single' => [
'driver' => 'single',
'path' => storage_path('logs/laravel.log'),
'level' => env('LOG_LEVEL', 'debug'),
'replace_placeholders' => true,
'level' => 'debug',
],
'daily' => [
'driver' => 'daily',
'path' => storage_path('logs/laravel.log'),
'level' => env('LOG_LEVEL', 'debug'),
'level' => 'debug',
'days' => 14,
'replace_placeholders' => true,
],
'slack' => [
@@ -78,44 +59,36 @@ return [
'url' => env('LOG_SLACK_WEBHOOK_URL'),
'username' => 'Laravel Log',
'emoji' => ':boom:',
'level' => env('LOG_LEVEL', 'critical'),
'replace_placeholders' => true,
'level' => 'critical',
],
'papertrail' => [
'driver' => 'monolog',
'level' => env('LOG_LEVEL', 'debug'),
'handler' => env('LOG_PAPERTRAIL_HANDLER', SyslogUdpHandler::class),
'level' => 'debug',
'handler' => SyslogUdpHandler::class,
'handler_with' => [
'host' => env('PAPERTRAIL_URL'),
'port' => env('PAPERTRAIL_PORT'),
'connectionString' => 'tls://'.env('PAPERTRAIL_URL').':'.env('PAPERTRAIL_PORT'),
],
'processors' => [PsrLogMessageProcessor::class],
],
'stderr' => [
'driver' => 'monolog',
'level' => env('LOG_LEVEL', 'debug'),
'handler' => StreamHandler::class,
'formatter' => env('LOG_STDERR_FORMATTER'),
'with' => [
'stream' => 'php://stderr',
],
'processors' => [PsrLogMessageProcessor::class],
],
'syslog' => [
'driver' => 'syslog',
'level' => env('LOG_LEVEL', 'debug'),
'facility' => LOG_USER,
'replace_placeholders' => true,
'level' => 'debug',
],
'errorlog' => [
'driver' => 'errorlog',
'level' => env('LOG_LEVEL', 'debug'),
'replace_placeholders' => true,
'level' => 'debug',
],
'null' => [
@@ -128,4 +101,4 @@ return [
],
],
];
];

View File

@@ -4,97 +4,45 @@ return [
/*
|--------------------------------------------------------------------------
| Default Mailer
| Mail Driver
|--------------------------------------------------------------------------
|
| This option controls the default mailer that is used to send any email
| messages sent by your application. Alternative mailers may be setup
| and used as needed; however, this mailer will be used by default.
| Laravel supports both SMTP and PHP's "mail" function as drivers for the
| sending of e-mail. You may specify which one you're using throughout
| your application here. By default, Laravel is setup for SMTP mail.
|
| Supported: "smtp", "sendmail", "mailgun", "mandrill", "ses",
| "sparkpost", "log", "array"
|
*/
'default' => env('MAIL_MAILER', 'smtp'),
'driver' => env('MAIL_DRIVER', 'smtp'),
/*
|--------------------------------------------------------------------------
| Mailer Configurations
| SMTP Host Address
|--------------------------------------------------------------------------
|
| Here you may configure all of the mailers used by your application plus
| their respective settings. Several examples have been configured for
| you and you are free to add your own as your application requires.
|
| Laravel supports a variety of mail "transport" drivers to be used while
| sending an e-mail. You will specify which one you are using for your
| mailers below. You are free to add additional mailers as required.
|
| Supported: "smtp", "sendmail", "mailgun", "ses", "ses-v2",
| "postmark", "log", "array", "failover", "roundrobin"
| Here you may provide the host address of the SMTP server used by your
| applications. A default option is provided that is compatible with
| the Mailgun mail service which will provide reliable deliveries.
|
*/
'mailers' => [
'smtp' => [
'transport' => 'smtp',
'url' => env('MAIL_URL'),
'host' => env('MAIL_HOST', 'smtp.mailgun.org'),
'port' => env('MAIL_PORT', 587),
'encryption' => env('MAIL_ENCRYPTION', 'tls'),
'username' => env('MAIL_USERNAME'),
'password' => env('MAIL_PASSWORD'),
'timeout' => null,
'local_domain' => env('MAIL_EHLO_DOMAIN'),
],
'host' => env('MAIL_HOST', 'smtp.mailgun.org'),
'ses' => [
'transport' => 'ses',
],
/*
|--------------------------------------------------------------------------
| SMTP Host Port
|--------------------------------------------------------------------------
|
| This is the SMTP port used by your application to deliver e-mails to
| users of the application. Like the host we have set this value to
| stay compatible with the Mailgun e-mail application by default.
|
*/
'postmark' => [
'transport' => 'postmark',
// 'message_stream_id' => null,
// 'client' => [
// 'timeout' => 5,
// ],
],
'mailgun' => [
'transport' => 'mailgun',
// 'client' => [
// 'timeout' => 5,
// ],
],
'sendmail' => [
'transport' => 'sendmail',
'path' => env('MAIL_SENDMAIL_PATH', '/usr/sbin/sendmail -bs -i'),
],
'log' => [
'transport' => 'log',
'channel' => env('MAIL_LOG_CHANNEL'),
],
'array' => [
'transport' => 'array',
],
'failover' => [
'transport' => 'failover',
'mailers' => [
'smtp',
'log',
],
],
'roundrobin' => [
'transport' => 'roundrobin',
'mailers' => [
'ses',
'postmark',
],
],
],
'port' => env('MAIL_PORT', 587),
/*
|--------------------------------------------------------------------------
@@ -112,6 +60,47 @@ return [
'name' => env('MAIL_FROM_NAME', 'Example'),
],
/*
|--------------------------------------------------------------------------
| E-Mail Encryption Protocol
|--------------------------------------------------------------------------
|
| Here you may specify the encryption protocol that should be used when
| the application send e-mail messages. A sensible default using the
| transport layer security protocol should provide great security.
|
*/
'encryption' => env('MAIL_ENCRYPTION', 'tls'),
/*
|--------------------------------------------------------------------------
| SMTP Server Username
|--------------------------------------------------------------------------
|
| If your SMTP server requires a username for authentication, you should
| set it here. This will get used to authenticate with your server on
| connection. You may also set the "password" value below this one.
|
*/
'username' => env('MAIL_USERNAME'),
'password' => env('MAIL_PASSWORD'),
/*
|--------------------------------------------------------------------------
| Sendmail System Path
|--------------------------------------------------------------------------
|
| When using the "sendmail" driver to send e-mails, we will need to know
| the path to where Sendmail lives on this server. A default path has
| been provided here, which will work well on most of your systems.
|
*/
'sendmail' => '/usr/sbin/sendmail -bs',
/*
|--------------------------------------------------------------------------
| Markdown Mail Settings

View File

@@ -4,16 +4,18 @@ return [
/*
|--------------------------------------------------------------------------
| Default Queue Connection Name
| Default Queue Driver
|--------------------------------------------------------------------------
|
| Laravel's queue API supports an assortment of back-ends via a single
| API, giving you convenient access to each back-end using the same
| syntax for every one. Here you may define a default connection.
| syntax for each one. Here you may set the default queue driver.
|
| Supported: "sync", "database", "beanstalkd", "sqs", "redis", "null"
|
*/
'default' => env('QUEUE_CONNECTION', 'sync'),
'default' => env('QUEUE_DRIVER', 'sync'),
/*
|--------------------------------------------------------------------------
@@ -24,8 +26,6 @@ return [
| is used by your application. A default configuration has been added
| for each back-end shipped with Laravel. You are free to add more.
|
| Drivers: "sync", "database", "beanstalkd", "sqs", "redis", "null"
|
*/
'connections' => [
@@ -39,7 +39,6 @@ return [
'table' => 'jobs',
'queue' => 'default',
'retry_after' => 90,
'after_commit' => false,
],
'beanstalkd' => [
@@ -47,28 +46,22 @@ return [
'host' => 'localhost',
'queue' => 'default',
'retry_after' => 90,
'block_for' => 0,
'after_commit' => false,
],
'sqs' => [
'driver' => 'sqs',
'key' => env('AWS_ACCESS_KEY_ID'),
'secret' => env('AWS_SECRET_ACCESS_KEY'),
'key' => env('SQS_KEY', 'your-public-key'),
'secret' => env('SQS_SECRET', 'your-secret-key'),
'prefix' => env('SQS_PREFIX', 'https://sqs.us-east-1.amazonaws.com/your-account-id'),
'queue' => env('SQS_QUEUE', 'default'),
'suffix' => env('SQS_SUFFIX'),
'region' => env('AWS_DEFAULT_REGION', 'us-east-1'),
'after_commit' => false,
'queue' => env('SQS_QUEUE', 'your-queue-name'),
'region' => env('SQS_REGION', 'us-east-1'),
],
'redis' => [
'driver' => 'redis',
'connection' => 'default',
'queue' => env('REDIS_QUEUE', 'default'),
'queue' => 'default',
'retry_after' => 90,
'block_for' => null,
'after_commit' => false,
],
],
@@ -85,7 +78,6 @@ return [
*/
'failed' => [
'driver' => env('QUEUE_FAILED_DRIVER', 'database-uuids'),
'database' => env('DB_CONNECTION', 'mysql'),
'table' => 'failed_jobs',
],

View File

@@ -8,27 +8,31 @@ return [
|--------------------------------------------------------------------------
|
| This file is for storing the credentials for third party services such
| as Mailgun, Postmark, AWS and more. This file provides the de facto
| location for this type of information, allowing packages to have
| a conventional file to locate the various service credentials.
| as Stripe, Mailgun, SparkPost and others. This file provides a sane
| default location for this type of information, allowing packages
| to have a conventional place to find your various credentials.
|
*/
'mailgun' => [
'domain' => env('MAILGUN_DOMAIN'),
'secret' => env('MAILGUN_SECRET'),
'endpoint' => env('MAILGUN_ENDPOINT', 'api.mailgun.net'),
'scheme' => 'https',
],
'postmark' => [
'token' => env('POSTMARK_TOKEN'),
],
'ses' => [
'key' => env('AWS_ACCESS_KEY_ID'),
'secret' => env('AWS_SECRET_ACCESS_KEY'),
'region' => env('AWS_DEFAULT_REGION', 'us-east-1'),
'key' => env('SES_KEY'),
'secret' => env('SES_SECRET'),
'region' => 'us-east-1',
],
'sparkpost' => [
'secret' => env('SPARKPOST_SECRET'),
],
'stripe' => [
'model' => App\User::class,
'key' => env('STRIPE_KEY'),
'secret' => env('STRIPE_SECRET'),
],
];

View File

@@ -1,7 +1,5 @@
<?php
use Illuminate\Support\Str;
return [
/*
@@ -14,7 +12,7 @@ return [
| you may specify any of the other wonderful drivers provided here.
|
| Supported: "file", "cookie", "database", "apc",
| "memcached", "redis", "dynamodb", "array"
| "memcached", "redis", "array"
|
*/
@@ -72,7 +70,7 @@ return [
|
*/
'connection' => env('SESSION_CONNECTION'),
'connection' => null,
/*
|--------------------------------------------------------------------------
@@ -92,15 +90,13 @@ return [
| Session Cache Store
|--------------------------------------------------------------------------
|
| While using one of the framework's cache driven session backends you may
| list a cache store that should be used for these sessions. This value
| must match with one of the application's configured cache "stores".
|
| Affects: "apc", "dynamodb", "memcached", "redis"
| When using the "apc" or "memcached" session drivers, you may specify a
| cache store that should be used for these sessions. This value must
| correspond with one of the application's configured cache stores.
|
*/
'store' => env('SESSION_STORE'),
'store' => null,
/*
|--------------------------------------------------------------------------
@@ -128,7 +124,7 @@ return [
'cookie' => env(
'SESSION_COOKIE',
Str::slug(env('APP_NAME', 'laravel'), '_').'_session'
str_slug(env('APP_NAME', 'laravel'), '_').'_session'
),
/*
@@ -155,7 +151,7 @@ return [
|
*/
'domain' => env('SESSION_DOMAIN'),
'domain' => env('SESSION_DOMAIN', null),
/*
|--------------------------------------------------------------------------
@@ -164,11 +160,11 @@ return [
|
| By setting this option to true, session cookies will only be sent back
| to the server if the browser has a HTTPS connection. This will keep
| the cookie from being sent to you when it can't be done securely.
| the cookie from being sent to you if it can not be done securely.
|
*/
'secure' => env('SESSION_SECURE_COOKIE'),
'secure' => env('SESSION_SECURE_COOKIE', null),
/*
|--------------------------------------------------------------------------
@@ -190,25 +186,12 @@ return [
|
| This option determines how your cookies behave when cross-site requests
| take place, and can be used to mitigate CSRF attacks. By default, we
| will set this value to "lax" since this is a secure default value.
| do not enable this as other CSRF protection services are in place.
|
| Supported: "lax", "strict", "none", null
| Supported: "lax", "strict"
|
*/
'same_site' => null,
/*
|--------------------------------------------------------------------------
| Partitioned Cookies
|--------------------------------------------------------------------------
|
| Setting this value to true will tie the cookie to the top-level site for
| a cross-site context. Partitioned cookies are accepted by the browser
| when flagged "secure" and the Same-Site attribute is set to "none".
|
*/
'partitioned' => false,
];

View File

@@ -28,9 +28,6 @@ return [
|
*/
'compiled' => env(
'VIEW_COMPILED_PATH',
realpath(storage_path('framework/views'))
),
'compiled' => realpath(storage_path('framework/views')),
];

View File

@@ -1,20 +0,0 @@
<?php
namespace Database\Factories;
use App\Item;
use Illuminate\Database\Eloquent\Factories\Factory;
class ItemFactory extends Factory
{
/**
* Define the model's default state.
*/
public function definition(): array
{
return [
'title' => $this->faker->unique()->text(),
'url' => $this->faker->unique()->url(),
];
}
}

View File

@@ -1,18 +0,0 @@
<?php
namespace Database\Factories;
use App\Item;
use App\ItemTag;
use Illuminate\Database\Eloquent\Factories\Factory;
class ItemTagFactory extends Factory
{
/**
* Define the model's default state.
*/
public function definition(): array
{
return [];
}
}

View File

@@ -1,41 +1,23 @@
<?php
namespace Database\Factories;
use Faker\Generator as Faker;
use Illuminate\Support\Facades\Hash;
use App\User;
use Illuminate\Database\Eloquent\Factories\Factory;
use Illuminate\Support\Str;
/*
|--------------------------------------------------------------------------
| Model Factories
|--------------------------------------------------------------------------
|
| This directory should contain each of the model factory definitions for
| your application. Factories provide a convenient way to generate new
| model instances for testing / seeding your application's database.
|
*/
class UserFactory extends Factory
{
/**
* Define the model's default state.
*
* @return array
*/
protected static ?string $password;
public function definition(): array
{
return [
'username' => $this->faker->name(),
'email' => $this->faker->unique()->safeEmail(),
'password' => static::$password ??= Hash::make('password'),
'public_front' => 1,
'remember_token' => Str::random(10),
];
}
/**
* Indicate that the model's email address should be unverified.
*/
public function unverified(): Factory
{
return $this->state(function (array $attributes) {
return [
'email_verified_at' => null,
];
});
}
}
$factory->define(App\User::class, function (Faker $faker) {
return [
'name' => $faker->name,
'email' => $faker->unique()->safeEmail,
'password' => '$2y$10$TKh8H1.PfQx37YgCzwiKb.KjNyWgaHb9cbcoQgdIVFlYg7B77UdFm', // secret
'remember_token' => str_random(10),
];
});

View File

@@ -1,15 +1,17 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
return new class extends Migration
class CreateItemsTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up(): void
public function up()
{
Schema::create('items', function (Blueprint $table) {
$table->increments('id');
@@ -27,9 +29,11 @@ return new class extends Migration
/**
* Reverse the migrations.
*
* @return void
*/
public function down(): void
public function down()
{
Schema::dropIfExists('items');
}
};
}

View File

@@ -1,15 +1,17 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
return new class extends Migration
class CreateSettingsTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up(): void
public function up()
{
Schema::create('settings', function (Blueprint $table) {
$table->increments('id');
@@ -26,9 +28,11 @@ return new class extends Migration
/**
* Reverse the migrations.
*
* @return void
*/
public function down(): void
public function down()
{
Schema::dropIfExists('settings');
}
};
}

View File

@@ -1,15 +1,17 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
return new class extends Migration
class CreateSettingGroupsTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up(): void
public function up()
{
Schema::create('setting_groups', function (Blueprint $table) {
$table->increments('id');
@@ -20,9 +22,11 @@ return new class extends Migration
/**
* Reverse the migrations.
*
* @return void
*/
public function down(): void
public function down()
{
Schema::dropIfExists('setting_groups');
}
};
}

View File

@@ -1,15 +1,17 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
return new class extends Migration
class AddColumnsToItemsForGroups extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up(): void
public function up()
{
Schema::table('items', function (Blueprint $table) {
$table->integer('type')->default(0)->index(); // 0 = item, 1 = category
@@ -18,11 +20,13 @@ return new class extends Migration
/**
* Reverse the migrations.
*
* @return void
*/
public function down(): void
public function down()
{
Schema::table('items', function (Blueprint $table) {
$table->dropColumn(['type']);
});
}
};
}

View File

@@ -1,15 +1,17 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
return new class extends Migration
class ItemTag extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up(): void
public function up()
{
Schema::create('item_tag', function (Blueprint $table) {
$table->integer('item_id')->unsigned()->index();
@@ -23,9 +25,11 @@ return new class extends Migration
/**
* Reverse the migrations.
*
* @return void
*/
public function down(): void
public function down()
{
Schema::dropIfExists('item_tag');
}
};
}

View File

@@ -1,15 +1,17 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
return new class extends Migration
class CreateUsersTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up(): void
public function up()
{
Schema::create('users', function (Blueprint $table) {
$table->increments('id');
@@ -26,9 +28,11 @@ return new class extends Migration
/**
* Reverse the migrations.
*
* @return void
*/
public function down(): void
public function down()
{
Schema::dropIfExists('users');
}
};
}

View File

@@ -1,15 +1,17 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
return new class extends Migration
class CreatePasswordResetsTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up(): void
public function up()
{
Schema::create('password_resets', function (Blueprint $table) {
$table->string('email')->index();
@@ -20,9 +22,11 @@ return new class extends Migration
/**
* Reverse the migrations.
*
* @return void
*/
public function down(): void
public function down()
{
Schema::dropIfExists('password_resets');
}
};
}

View File

@@ -1,15 +1,17 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
return new class extends Migration
class AddUserIdToItemsTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up(): void
public function up()
{
Schema::table('items', function (Blueprint $table) {
$table->integer('user_id')->default(1)->index(); // 0 = item, 1 = category
@@ -18,11 +20,13 @@ return new class extends Migration
/**
* Reverse the migrations.
*
* @return void
*/
public function down(): void
public function down()
{
Schema::table('items', function (Blueprint $table) {
$table->dropColumn(['user_id']);
});
}
};
}

View File

@@ -1,15 +1,17 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
return new class extends Migration
class CreateSettingUserPivotTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up(): void
public function up()
{
Schema::create('setting_user', function (Blueprint $table) {
$table->integer('setting_id')->unsigned()->index();
@@ -23,9 +25,11 @@ return new class extends Migration
/**
* Reverse the migrations.
*
* @return void
*/
public function down(): void
public function down()
{
Schema::dropIfExists('setting_user');
}
};
}

View File

@@ -1,17 +1,20 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
return new class extends Migration
class CreateApplicationsTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up(): void
public function up()
{
Schema::create('applications', function (Blueprint $table) {
$table->string('appid')->unique();
$table->string('name')->unique();
$table->string('sha')->unique()->nullable();
@@ -28,9 +31,11 @@ return new class extends Migration
/**
* Reverse the migrations.
*
* @return void
*/
public function down(): void
public function down()
{
Schema::dropIfExists('applications');
}
};
}

View File

@@ -1,15 +1,17 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
return new class extends Migration
class AddClassToItemsTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up(): void
public function up()
{
Schema::table('items', function (Blueprint $table) {
$table->string('class')->nullable();
@@ -18,11 +20,13 @@ return new class extends Migration
/**
* Reverse the migrations.
*
* @return void
*/
public function down(): void
public function down()
{
Schema::table('items', function (Blueprint $table) {
$table->dropColumn(['class']);
});
}
};
}

View File

@@ -1,15 +1,17 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
return new class extends Migration
class CreateJobsTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up(): void
public function up()
{
Schema::create('jobs', function (Blueprint $table) {
$table->bigIncrements('id');
@@ -24,9 +26,11 @@ return new class extends Migration
/**
* Reverse the migrations.
*
* @return void
*/
public function down(): void
public function down()
{
Schema::dropIfExists('jobs');
}
};
}

View File

@@ -1,15 +1,17 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
return new class extends Migration
class CreateFailedJobsTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up(): void
public function up()
{
Schema::create('failed_jobs', function (Blueprint $table) {
$table->bigIncrements('id');
@@ -23,9 +25,11 @@ return new class extends Migration
/**
* Reverse the migrations.
*
* @return void
*/
public function down(): void
public function down()
{
Schema::dropIfExists('failed_jobs');
}
};
}

View File

@@ -4,12 +4,14 @@ use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
class AddAppidToItems extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up(): void
public function up()
{
Schema::table('items', function (Blueprint $table) {
$table->string('appid')->nullable();
@@ -18,11 +20,13 @@ return new class extends Migration
/**
* Reverse the migrations.
*
* @return void
*/
public function down(): void
public function down()
{
Schema::table('items', function (Blueprint $table) {
$table->dropColumn(['appid']);
});
}
};
}

View File

@@ -4,12 +4,14 @@ use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
class AddClassToApplication extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up(): void
public function up()
{
Schema::table('applications', function (Blueprint $table) {
$table->string('class')->nullable()->index();
@@ -18,11 +20,13 @@ return new class extends Migration
/**
* Reverse the migrations.
*
* @return void
*/
public function down(): void
public function down()
{
Schema::table('applications', function (Blueprint $table) {
$table->dropColumn(['class']);
});
}
};
}

View File

@@ -4,12 +4,14 @@ use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
class AddAppDescriptionToItems extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up(): void
public function up()
{
Schema::table('items', function (Blueprint $table) {
$table->text('appdescription')->nullable();
@@ -18,11 +20,13 @@ return new class extends Migration
/**
* Reverse the migrations.
*
* @return void
*/
public function down(): void
public function down()
{
Schema::table('items', function (Blueprint $table) {
//
});
}
};
}

View File

@@ -1,24 +0,0 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
/**
* Run the migrations.
*/
public function up(): void
{
Schema::rename('password_resets', 'password_reset_tokens');
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::rename('password_reset_tokens', 'password_resets');
}
};

View File

@@ -1,354 +0,0 @@
<?php
namespace Database\Seeders;
use App\Setting;
use App\SettingGroup;
use Illuminate\Database\Seeder;
use Illuminate\Support\Facades\DB;
use Illuminate\Support\Facades\Log;
use Locale;
class SettingsSeeder extends Seeder
{
/**
* @return false|string
*/
public static function getSupportedLanguageMap()
{
if (! class_exists('Locale')) {
Log::info('PHP Extension Intl not found. Falling back to English language support only.');
return json_encode(['en' => 'English']);
}
$languageDirectories = array_filter(glob(lang_path().'/*'), 'is_dir');
$result = [];
foreach ($languageDirectories as $languageDirectory) {
$language = self::getLanguageFromDirectory($languageDirectory);
$resultNative = mb_convert_case(
Locale::getDisplayLanguage($language.'-', $language),
MB_CASE_TITLE,
'UTF-8'
);
$resultEn = ucfirst(Locale::getDisplayLanguage($language, 'en'));
$result[$language] = "$resultNative ($resultEn)";
}
return json_encode($result);
}
/**
* @param $languageDirectory
* @return false|string[]
*/
public static function getLanguageFromDirectory($languageDirectory)
{
$directories = explode('/', $languageDirectory);
return $directories[array_key_last($directories)];
}
/**
* Run the database seeds.
*/
public function run(): void
{
// Groups
if (! $setting_group = SettingGroup::find(1)) {
$setting_group = new SettingGroup;
$setting_group->id = 1;
$setting_group->title = 'app.settings.system';
$setting_group->order = 0;
$setting_group->save();
} else {
$setting_group->title = 'app.settings.system';
$setting_group->save();
}
if (! $setting_group = SettingGroup::find(2)) {
$setting_group = new SettingGroup;
$setting_group->id = 2;
$setting_group->title = 'app.settings.appearance';
$setting_group->order = 1;
$setting_group->save();
} else {
$setting_group->title = 'app.settings.appearance';
$setting_group->save();
}
if (! $setting_group = SettingGroup::find(3)) {
$setting_group = new SettingGroup;
$setting_group->id = 3;
$setting_group->title = 'app.settings.miscellaneous';
$setting_group->order = 2;
$setting_group->save();
} else {
$setting_group->title = 'app.settings.miscellaneous';
$setting_group->save();
}
if (! $setting_group = SettingGroup::find(4)) {
$setting_group = new SettingGroup;
$setting_group->id = 4;
$setting_group->title = 'app.settings.advanced';
$setting_group->order = 3;
$setting_group->save();
} else {
$setting_group->title = 'app.settings.advanced';
$setting_group->save();
}
if ($version = Setting::find(1)) {
$version->label = 'app.settings.version';
$version->value = config('app.version');
$version->save();
} else {
$setting = new Setting;
$setting->id = 1;
$setting->group_id = 1;
$setting->key = 'version';
$setting->type = 'text';
$setting->label = 'app.settings.version';
$setting->value = config('app.version');
$setting->system = true;
$setting->save();
}
if (! $setting = Setting::find(2)) {
$setting = new Setting;
$setting->id = 2;
$setting->group_id = 2;
$setting->key = 'background_image';
$setting->type = 'image';
$setting->label = 'app.settings.background_image';
$setting->save();
} else {
$setting->label = 'app.settings.background_image';
$setting->save();
}
if (! $setting = Setting::find(3)) {
$setting = new Setting;
$setting->id = 3;
$setting->group_id = 3;
$setting->key = 'homepage_search';
$setting->type = 'boolean';
$setting->label = 'app.settings.homepage_search';
$setting->save();
} else {
$setting->label = 'app.settings.homepage_search';
$setting->save();
}
$options = json_encode([
'none' => 'app.options.none',
'google' => 'app.options.google',
'ddg' => 'app.options.ddg',
'qwant' => 'app.options.qwant',
'bing' => 'app.options.bing',
'startpage' => 'app.options.startpage',
]);
if (! $setting = Setting::find(4)) {
$setting = new Setting;
$setting->id = 4;
$setting->group_id = 3;
$setting->key = 'search_provider';
$setting->type = 'select';
$setting->options = $options;
$setting->label = 'app.settings.search_provider';
$setting->save();
} else {
$setting->options = $options;
$setting->label = 'app.settings.search_provider';
$setting->save();
}
$language_options = SettingsSeeder::getSupportedLanguageMap();
if ($languages = Setting::find(5)) {
$languages->options = $language_options;
$languages->save();
} else {
$setting = new Setting;
$setting->id = 5;
$setting->group_id = 1;
$setting->key = 'language';
$setting->type = 'select';
$setting->label = 'app.settings.language';
$setting->options = $language_options;
$setting->value = 'en';
$setting->save();
}
if (! $setting = Setting::find(12)) {
$setting = new Setting;
$setting->id = 12;
$setting->group_id = 2;
$setting->key = 'trianglify';
$setting->type = 'boolean';
$setting->label = 'app.settings.trianglify';
$setting->save();
} else {
$setting->label = 'app.settings.trianglify';
$setting->save();
}
if (! $setting = Setting::find(13)) {
$setting = new Setting;
$setting->id = 13;
$setting->group_id = 2;
$setting->key = 'trianglify_seed';
$setting->type = 'text';
$setting->value = 'heimdall';
$setting->label = 'app.settings.trianglify_seed';
$setting->save();
} else {
$setting->label = 'app.settings.trianglify_seed';
$setting->save();
}
$window_target_options = json_encode([
'current' => 'app.settings.window_target.current',
'heimdall' => 'app.settings.window_target.one',
'_blank' => 'app.settings.window_target.new',
]);
if (! $setting = Setting::find(7)) {
$setting = new Setting;
$setting->id = 7;
$setting->group_id = 3;
$setting->key = 'window_target';
$setting->type = 'select';
$setting->options = $window_target_options;
$setting->label = 'app.settings.window_target';
$setting->value = 'heimdall';
$setting->save();
} else {
$setting->options = $window_target_options;
$setting->label = 'app.settings.window_target';
$setting->save();
}
if ($support = Setting::find(8)) {
$support->label = 'app.settings.support';
$support->value =
'<a rel="noopener" target="_blank" href="https://discord.gg/CCjHKn4">Discord</a>'.
' | '.
'<a rel="noopener" target="_blank" href="https://github.com/linuxserver/Heimdall">Github</a>'.
' | '.
'<a rel="noopener" target="_blank" href="https://blog.heimdall.site/">Blog</a>';
$support->save();
} else {
$setting = new Setting;
$setting->id = 8;
$setting->group_id = 1;
$setting->key = 'support';
$setting->type = 'text';
$setting->label = 'app.settings.support';
$setting->value = '<a rel="noopener" target="_blank" href="https://discord.gg/CCjHKn4">Discord</a>'.
' | '.
'<a rel="noopener" target="_blank" href="https://github.com/linuxserver/Heimdall">Github</a>'.
' | '.
'<a rel="noopener" target="_blank" href="https://blog.heimdall.site/">Blog</a>';
$setting->system = true;
$setting->save();
}
if ($donate = Setting::find(9)) {
$donate->label = 'app.settings.donate';
$donate->value = '<a rel="noopener" target="_blank" href="https://www.paypal.me/heimdall">Paypal</a>';
$donate->save();
} else {
$setting = new Setting;
$setting->id = 9;
$setting->group_id = 1;
$setting->key = 'donate';
$setting->type = 'text';
$setting->label = 'app.settings.donate';
$setting->value = '<a rel="noopener" target="_blank" href="https://www.paypal.me/heimdall">Paypal</a>';
$setting->system = true;
$setting->save();
}
if (! $setting = Setting::find(10)) {
$setting = new Setting;
$setting->id = 10;
$setting->group_id = 4;
$setting->key = 'custom_css';
$setting->type = 'textarea';
$setting->label = 'app.settings.custom_css';
$setting->value = '';
$setting->save();
} else {
$setting->type = 'textarea';
$setting->group_id = 4;
$setting->label = 'app.settings.custom_css';
$setting->save();
}
if (! $setting = Setting::find(11)) {
$setting = new Setting;
$setting->id = 11;
$setting->group_id = 4;
$setting->key = 'custom_js';
$setting->type = 'textarea';
$setting->label = 'app.settings.custom_js';
$setting->value = '';
$setting->save();
} else {
$setting->type = 'textarea';
$setting->group_id = 4;
$setting->label = 'app.settings.custom_js';
$setting->save();
}
if (! $home_tag = \App\Item::find(0)) {
$home_tag = new \App\Item;
$home_tag->id = 0;
$home_tag->title = 'app.dashboard';
$home_tag->pinned = 0;
$home_tag->url = '';
$home_tag->type = 1;
$home_tag->user_id = 0;
$home_tag->save();
$home_tag_id = $home_tag->id;
if ($home_tag_id != 0) {
Log::info("Home Tag returned with id $home_tag_id from db! Changing to 0.");
DB::update('update items set id = 0 where id = ?', [$home_tag_id]);
}
$homeapps = \App\Item::withoutGlobalScope('user_id')->doesntHave('parents')->get();
foreach ($homeapps as $app) {
if ($app->id === 0) {
continue;
}
$app->parents()->attach(0);
}
}
$tag_options = json_encode([
'folders' => 'app.settings.folders',
'tags' => 'app.settings.tags',
'categories' => 'app.settings.categories',
]);
if (! $setting = Setting::find(14)) {
$setting = new Setting;
$setting->id = 14;
$setting->group_id = 2;
$setting->key = 'treat_tags_as';
$setting->type = 'select';
$setting->options = $tag_options;
$setting->value = 'folders';
$setting->label = 'app.settings.treat_tags_as';
$setting->save();
} else {
$setting->options = $tag_options;
$setting->label = 'app.settings.treat_tags_as';
$setting->save();
}
}
}

View File

@@ -1,32 +0,0 @@
<?php
namespace Database\Seeders;
use App\User;
use Illuminate\Database\Seeder;
class UsersSeeder extends Seeder
{
/**
* Run the database seeds.
*/
public function run(): void
{
// Groups
if (!User::find(1)) {
$user = new User;
$user->username = 'admin';
$user->email = 'admin@test.com';
$user->password = null;
$user->save();
$user_id = $user->id;
if ($user_id != 1) {
Log::info("First User returned with id $user_id from db! Changing to 1.");
DB::update('update users set id = 1 where id = ?', [$user_id]);
}
}
}
}

View File

@@ -1,15 +1,15 @@
<?php
namespace Database\Seeders;
use Illuminate\Database\Seeder;
class DatabaseSeeder extends Seeder
{
/**
* Run the database seeds.
*
* @return void
*/
public function run(): void
public function run()
{
$this->call(SettingsSeeder::class);
$this->call(UsersSeeder::class);

View File

@@ -0,0 +1,274 @@
<?php
use Illuminate\Database\Seeder;
use App\Setting;
use App\SettingGroup;
class SettingsSeeder extends Seeder
{
/**
* Run the database seeds.
*
* @return void
*/
public function run()
{
// Groups
if(!$setting_group = SettingGroup::find(1)) {
$setting_group = new SettingGroup;
$setting_group->id = 1;
$setting_group->title = 'app.settings.system';
$setting_group->order = 0;
$setting_group->save();
} else {
$setting_group->title = 'app.settings.system';
$setting_group->save();
}
if(!$setting_group = SettingGroup::find(2)) {
$setting_group = new SettingGroup;
$setting_group->id = 2;
$setting_group->title = 'app.settings.appearance';
$setting_group->order = 1;
$setting_group->save();
} else {
$setting_group->title = 'app.settings.appearance';
$setting_group->save();
}
if(!$setting_group = SettingGroup::find(3)) {
$setting_group = new SettingGroup;
$setting_group->id = 3;
$setting_group->title = 'app.settings.miscellaneous';
$setting_group->order = 2;
$setting_group->save();
} else {
$setting_group->title = 'app.settings.miscellaneous';
$setting_group->save();
}
if(!$setting_group = SettingGroup::find(4)) {
$setting_group = new SettingGroup;
$setting_group->id = 4;
$setting_group->title = 'app.settings.advanced';
$setting_group->order = 3;
$setting_group->save();
} else {
$setting_group->title = 'app.settings.advanced';
$setting_group->save();
}
if($version = Setting::find(1)) {
$version->label = 'app.settings.version';
$version->value = config('app.version');
$version->save();
} else {
$setting = new Setting;
$setting->id = 1;
$setting->group_id = 1;
$setting->key = 'version';
$setting->type = 'text';
$setting->label = 'app.settings.version';
$setting->value = config('app.version');
$setting->system = true;
$setting->save();
}
if(!$setting = Setting::find(2)) {
$setting = new Setting;
$setting->id = 2;
$setting->group_id = 2;
$setting->key = 'background_image';
$setting->type = 'image';
$setting->label = 'app.settings.background_image';
$setting->save();
} else {
$setting->label = 'app.settings.background_image';
$setting->save();
}
if(!$setting = Setting::find(3)) {
$setting = new Setting;
$setting->id = 3;
$setting->group_id = 3;
$setting->key = 'homepage_search';
$setting->type = 'boolean';
$setting->label = 'app.settings.homepage_search';
$setting->save();
} else {
$setting->label = 'app.settings.homepage_search';
$setting->save();
}
$options = json_encode([
'none' => 'app.options.none',
'google' => 'app.options.google',
'ddg' => 'app.options.ddg',
'qwant' => 'app.options.qwant',
'bing' => 'app.options.bing',
'startpage' => 'app.options.startpage',
]);
if(!$setting = Setting::find(4)) {
$setting = new Setting;
$setting->id = 4;
$setting->group_id = 3;
$setting->key = 'search_provider';
$setting->type = 'select';
$setting->options = $options;
$setting->label = 'app.settings.search_provider';
$setting->save();
} else {
$setting->options = $options;
$setting->label = 'app.settings.search_provider';
$setting->save();
}
$language_options = json_encode([
'de' => 'Deutsch (German)',
'en' => 'English',
'fi' => 'Suomi (Finnish)',
'fr' => 'Français (French)',
'el' => 'Ελληνικά (Greek)',
'it' => 'Italiano (Italian)',
'no' => 'Norsk (Norwegian)',
'pl' => 'Polski (Polish)',
'sv' => 'Svenska (Swedish)',
'es' => 'Español (Spanish)',
'tr' => 'Türkçe (Turkish)',
]);
if($languages = Setting::find(5)) {
$languages->options = $language_options;
$languages->save();
} else {
$setting = new Setting;
$setting->id = 5;
$setting->group_id = 1;
$setting->key = 'language';
$setting->type = 'select';
$setting->label = 'app.settings.language';
$setting->options = $language_options;
$setting->value = 'en';
$setting->save();
}
$window_target_options = json_encode([
'current' => 'app.settings.window_target.current',
'heimdall' => 'app.settings.window_target.one',
'_blank' => 'app.settings.window_target.new',
]);
if(!$setting = Setting::find(7)) {
$setting = new Setting;
$setting->id = 7;
$setting->group_id = 3;
$setting->key = 'window_target';
$setting->type = 'select';
$setting->options = $window_target_options;
$setting->label = 'app.settings.window_target';
$setting->value = 'heimdall';
$setting->save();
} else {
$setting->options = $window_target_options;
$setting->label = 'app.settings.window_target';
$setting->save();
}
if($support = Setting::find(8)) {
$support->label = 'app.settings.support';
$support->value = '<a rel="noopener" target="_blank" href="https://discord.gg/CCjHKn4">Discord</a> | <a rel="noopener" target="_blank" href="https://github.com/linuxserver/Heimdall">Github</a> | <a rel="noopener" target="_blank" href="https://blog.heimdall.site/">Blog</a>';
$support->save();
} else {
$setting = new Setting;
$setting->id = 8;
$setting->group_id = 1;
$setting->key = 'support';
$setting->type = 'text';
$setting->label = 'app.settings.support';
$setting->value = '<a rel="noopener" target="_blank" href="https://discord.gg/CCjHKn4">Discord</a> | <a rel="noopener" target="_blank" href="https://github.com/linuxserver/Heimdall">Github</a> | <a rel="noopener" target="_blank" href="https://blog.heimdall.site/">Blog</a>';
$setting->system = true;
$setting->save();
}
if($donate = Setting::find(9)) {
$donate->label = 'app.settings.donate';
$donate->value = '<a rel="noopener" target="_blank" href="https://www.paypal.me/heimdall">Paypal</a>';
$donate->save();
} else {
$setting = new Setting;
$setting->id = 9;
$setting->group_id = 1;
$setting->key = 'donate';
$setting->type = 'text';
$setting->label = 'app.settings.donate';
$setting->value = '<a rel="noopener" target="_blank" href="https://www.paypal.me/heimdall">Paypal</a>';
$setting->system = true;
$setting->save();
}
if(!$setting = Setting::find(10)) {
$setting = new Setting;
$setting->id = 10;
$setting->group_id = 4;
$setting->key = 'custom_css';
$setting->type = 'textarea';
$setting->label = 'app.settings.custom_css';
$setting->value = '';
$setting->save();
} else {
$setting->type = 'textarea';
$setting->group_id = 4;
$setting->label = 'app.settings.custom_css';
$setting->save();
}
if(!$setting = Setting::find(11)) {
$setting = new Setting;
$setting->id = 11;
$setting->group_id = 4;
$setting->key = 'custom_js';
$setting->type = 'textarea';
$setting->label = 'app.settings.custom_js';
$setting->value = '';
$setting->save();
} else {
$setting->type = 'textarea';
$setting->group_id = 4;
$setting->label = 'app.settings.custom_js';
$setting->save();
}
if(!$setting = Setting::find(12)) {
$setting = new Setting;
$setting->id = 12;
$setting->group_id = 1;
$setting->key = 'api_key';
$setting->type = 'apikey';
$setting->label = 'app.settings.apikey';
$setting->value = '';
$setting->save();
} else {
$setting->type = 'apikey';
$setting->group_id = 1;
$setting->label = 'app.settings.apikey';
$setting->save();
}
if(!$home_tag = \App\Item::find(0)) {
$home_tag = new \App\Item;
$home_tag->id = 0;
$home_tag->title = 'app.dashboard';
$home_tag->pinned = 0;
$home_tag->url = '';
$home_tag->type = 1;
$home_tag->user_id = 0;
$home_tag->save();
$homeapps = \App\Item::withoutGlobalScope('user_id')->doesntHave('parents')->get();
foreach($homeapps as $app) {
if($app->id === 0) continue;
$app->parents()->attach(0);
}
}
}
}

View File

@@ -0,0 +1,27 @@
<?php
use Illuminate\Database\Seeder;
use App\User;
class UsersSeeder extends Seeder
{
/**
* Run the database seeds.
*
* @return void
*/
public function run()
{
// Groups
if(!$user = User::find(1)) {
$user = new User;
$user->id = 1;
$user->username = 'admin';
$user->email = 'admin@test.com';
$user->password = null;
$user->save();
} else {
//$user->save();
}
}
}

View File

@@ -1,133 +0,0 @@
<?php
return [
/*
|--------------------------------------------------------------------------
| App Language Lines
|--------------------------------------------------------------------------
|
*/
'settings.system' => 'Sistema',
'settings.appearance' => 'Aparência',
'settings.miscellaneous' => 'Diversos',
'settings.support' => 'Ajuda',
'settings.donate' => 'Doar',
'settings.version' => 'Versão',
'settings.background_image' => 'Imagem de fundo',
'settings.trianglify' => 'Trianglify',
'settings.trianglify_seed' => 'Trianglify Random Seed',
'settings.window_target' => 'Link é aberto em',
'settings.window_target.current' => 'Abra nesta aba',
'settings.window_target.one' => 'Abra na mesma aba',
'settings.window_target.new' => 'Abra em uma nova aba',
'settings.homepage_search' => 'Pesquisa na página inicial',
'settings.search_provider' => 'Provedor de pesquisa',
'settings.language' => 'Idioma',
'settings.reset' => 'Redefinir de volta ao padrão',
'settings.remove' => 'Remover',
'settings.search' => 'busca',
'settings.no_items' => 'Nenhum item encontrado',
'settings.advanced' => 'Avançado',
'settings.custom_css' => 'CSS Customizado',
'settings.custom_js' => 'JavaScript Customizado',
'settings.label' => 'Rótulo',
'settings.value' => 'Valor',
'settings.edit' => 'Editar',
'settings.view' => 'Ver',
'options.none' => '- não configurado -',
'options.google' => 'Google',
'options.ddg' => 'DuckDuckGo',
'options.bing' => 'Bing',
'options.qwant' => 'Qwant',
'options.startpage' => 'Página inicial',
'options.yes' => 'Sim',
'options.no' => 'Não',
'options.nzbhydra' => 'NZBHydra',
'options.jackett' => 'Jackett',
'buttons.save' => 'Salvar',
'buttons.cancel' => 'Cancelar',
'buttons.add' => 'Adicionar',
'buttons.upload' => 'Carregar um arquivo',
'buttons.downloadapps' => 'Atualizar lista de Apps',
'dashboard' => 'Página Inicial do dashboard',
'dashboard.reorder' => 'Reordenar e fixar itens',
'dashboard.settings' => 'Configurações',
'dash.pin_item' => 'Fixar o item na dashboard',
'dash.no_apps' => 'Atualmente não há aplicativos fixados, :link1 ou :link2',
'dash.link1' => 'Adicionar um aplivativo aqui',
'dash.link2' => 'Fixar um item na dashboard',
'dash.pinned_items' => 'Itens fixados',
'apps.app_list' => 'Lista de aplicativos',
'apps.view_trash' => 'Ver lixo',
'apps.add_application' => 'Adicionar aplicativo',
'apps.application_name' => 'Nome do aplicativo',
'apps.colour' => 'Cor',
'apps.icon' => 'Ícone',
'app.import' => 'Importar',
'apps.pinned' => 'Fixado',
'apps.title' => 'Título',
'apps.hex' => 'Cor hexadecimal',
'apps.username' => 'Nome de usuário',
'apps.password' => 'Senha',
'apps.config' => 'Configuração',
'apps.apikey' => 'API Key',
'apps.enable' => 'Habilitar',
'apps.tag_list' => 'Lista de tags',
'apps.add_tag' => 'Adicionar tag',
'apps.tag_name' => 'Nome da tag',
'apps.tags' => 'Tags',
'apps.override' => 'Se diferente do URL principal',
'apps.preview' => 'Vizualizar',
'apps.apptype' => 'Tipo de Aplicativo',
'apps.website' => 'Website',
'apps.description' => 'Descrição',
'apps.only_admin_account' => 'Somente se tiver conta admin!',
'apps.autologin_url' => 'URL de login automático',
'apps.show_deleted' => 'Mostrando Aplicativos Apagados',
'user.user_list' => 'Comercial',
'user.add_user' => 'Adicionar usuários',
'user.username' => 'Nome de usuário',
'user.avatar' => 'Avatar',
'user.email' => 'O email',
'user.password_confirm' => 'Confirme a Senha',
'user.secure_front' => 'Permitir acesso público à frente - Aplicado apenas se uma senha for definida.',
'user.autologin' => 'Permitir o login a partir de um URL específico. Qualquer pessoa com o link pode fazer o login.',
'url' => 'URL',
'title' => 'Título',
'delete' => 'Apagar',
'optional' => 'Opcional',
'restore' => 'Restaurar',
'export' => 'Exportar',
'import' => 'Importar',
'alert.success.item_created' => 'Item criado com sucesso',
'alert.success.item_updated' => 'Item atualizado com sucesso',
'alert.success.item_deleted' => 'Item apagado com sucesso',
'alert.success.item_restored' => 'Item restaurado com sucesso',
'alert.success.tag_created' => 'Tag criada com sucesso',
'alert.success.tag_updated' => 'Tag atualizada com sucesso',
'alert.success.tag_deleted' => 'Tag apagada com sucesso',
'alert.success.tag_restored' => 'Tag restaurada com sucesso',
'alert.success.updating'=> 'Atualizando lista de apps',
'alert.success.setting_updated' => 'Você editou com sucesso essa configuração',
'alert.error.not_exist' => 'Essa configuração não existe.',
'alert.success.updating' => 'Atualizando lista de Apps',
'alert.success.user_created' => 'Usuário criado com sucesso',
'alert.success.user_updated' => 'Usuário atualizado com sucesso',
'alert.success.user_deleted' => 'Usuário excluído com sucesso',
'alert.success.user_restored' => 'Usuário restaurado com sucesso',
];

View File

@@ -1,108 +0,0 @@
<?php
return array (
'settings.system' => 'Systém',
'settings.appearance' => 'Vzhled',
'settings.miscellaneous' => 'Různé',
'settings.advanced' => 'Rozšířené nastavení',
'settings.support' => 'Podpora',
'settings.donate' => 'Podpořte nás',
'settings.version' => 'Verze',
'settings.background_image' => 'Obrázek pozadí',
'settings.trianglify' => 'Trianglify',
'settings.trianglify_seed' => 'Trianglify Random Seed',
'settings.window_target' => 'Odkazy otevírat v',
'settings.window_target.current' => 'Otevřít v této záložce',
'settings.window_target.one' => 'Otevřít ve stejné záložce',
'settings.window_target.new' => 'Otevřít v nové záložce',
'settings.homepage_search' => 'Vyhledávání na domovské stránce',
'settings.search_provider' => 'Vyhledávat pomocí',
'settings.language' => 'Jazyk',
'settings.reset' => 'Obnovit výchozí nastavení',
'settings.remove' => 'Odstranit',
'settings.search' => 'hledat',
'settings.no_items' => 'Žadné položky nenalezeny',
'settings.label' => 'Název',
'settings.value' => 'Hodnota',
'settings.edit' => 'Upravit',
'settings.view' => 'Náhled',
'settings.custom_css' => 'Vlastní CSS',
'settings.custom_js' => 'Vlastní JavaScript',
'options.none' => '- nenastaveno -',
'options.google' => 'Google',
'options.ddg' => 'DuckDuckGo',
'options.bing' => 'Bing',
'options.qwant' => 'Qwant',
'options.startpage' => 'StartPage',
'options.yes' => 'Ano',
'options.no' => 'Ne',
'options.nzbhydra' => 'NZBHydra',
'options.jackett' => 'Jackett',
'buttons.save' => 'Uložit',
'buttons.cancel' => 'Zrušit',
'buttons.add' => 'Přidat',
'buttons.upload' => 'Nahrát ikonu',
'buttons.downloadapps' => 'Aktualizovat seznam aplikací',
'dash.pin_item' => 'Připnout na dashboard',
'dash.no_apps' => 'Aktuálně nemáte žádné připnuté aplikace, :link1 nebo :link2',
'dash.link1' => 'Přidejte zde aplikacei',
'dash.link2' => 'Připnout na dashboard',
'dash.pinned_items' => 'Připnuté položky',
'apps.app_list' => 'Seznam aplikací',
'apps.view_trash' => 'Zobrazit koš',
'apps.add_application' => 'Přidat aplikaci',
'apps.application_name' => 'Název aplikace',
'apps.colour' => 'Barva',
'apps.icon' => 'Ikona',
'apps.pinned' => 'Připnuto',
'apps.title' => 'Název',
'apps.hex' => 'Hex barva',
'apps.username' => 'Uživatelské jméno',
'apps.password' => 'Heslo',
'apps.config' => 'Config',
'apps.apikey' => 'API Klíč',
'apps.enable' => 'Povolit',
'apps.tag_list' => 'Seznam tagů',
'apps.add_tag' => 'Přidat tag',
'apps.tag_name' => 'Název tagu',
'apps.tags' => 'Tagy',
'apps.override' => 'Pokud je různá od hlavní url',
'apps.preview' => 'Náhled',
'apps.apptype' => 'Typ apliakce',
'apps.website' => 'Webová stránka',
'apps.description' => 'Popis',
'apps.only_admin_account' => 'Pouze pokud máte administrátorský účet!',
'apps.autologin_url' => 'URL automatického přihlášení',
'apps.show_deleted' => 'Zobrazit smazané aplikace',
'dashboard' => 'Domácí obrazovka',
'user.user_list' => 'Uživatelé',
'user.add_user' => 'Přidat uživatele',
'user.username' => 'Uživatelské jméno',
'user.avatar' => 'Avatar',
'user.email' => 'Email',
'user.password_confirm' => 'Potvrdit heslo',
'user.secure_front' => 'Povolit veřejný přístup k rozhraní - Nastavte pouze pokud je nastaveno heslo.',
'user.autologin' => 'Povolit přihlášení ze specifické URL. Kdokoliv s odkazem se může přihlásit.',
'url' => 'URL',
'title' => 'Název',
'delete' => 'Smazat',
'optional' => 'Volitelné',
'restore' => 'Obnovit',
'alert.success.item_created' => 'Položka úspěšně vytvořena',
'alert.success.item_updated' => 'Položka úspěšně aktualizována',
'alert.success.item_deleted' => 'Položka úspěšně smazána',
'alert.success.item_restored' => 'Položka úspěšně obnovena',
'alert.success.updating' => 'Aktualizuji seznam aplikací',
'alert.success.tag_created' => 'Tag úspěšně vytvořen',
'alert.success.tag_updated' => 'Tag úspěšně aktualizován',
'alert.success.tag_deleted' => 'Tag úspěšně smazán',
'alert.success.tag_restored' => 'Tag úspěšně obnoven',
'alert.success.setting_updated' => 'Úspěšně jste aktualizovali nastavení',
'alert.error.not_exist' => 'Tohle nastavení neexistuje.',
'alert.success.user_created' => 'Uživatel úspěšně vytovřen',
'alert.success.user_updated' => 'Uživatel úspěšně aktualizován',
'alert.success.user_deleted' => 'Uživatel úspěšně smazán',
'alert.success.user_restored' => 'Uživatel úspěšně obnoven',
'dashboard.reorder' => 'Změňte pořadí a připněte položky',
'dashboard.settings' => 'Nastavení',
);

View File

@@ -1,6 +0,0 @@
<?php
return array (
'failed' => 'Zadané údaje se neshodují s našimi záznamy.',
'throttle' => 'Příliš mnoho pokusů o přihlášení. Prosím opakujte za :seconds sekund.',
);

View File

@@ -1,6 +0,0 @@
<?php
return array (
'previous' => '&laquo; Předchozí',
'next' => 'Další &raquo;',
);

View File

@@ -1,9 +0,0 @@
<?php
return array (
'password' => 'Heslo musí mít alespoň šest znaků a musí se shodovat s potvrzením.',
'reset' => 'Vaše heslo bylo úspěšně resetováno!',
'sent' => 'Odeslali jsme vám emailem odkaz pro reset hesla!',
'token' => 'Token pro obnovu hesla je neplatný.',
'user' => 'Nenalezli jsme uživatele se zadaným e-mailem.',
);

Some files were not shown because too many files have changed in this diff Show More