richard
/
cyca
Archived
1
0
Fork 0

Final commit

master
Richard Dern 2024-02-08 11:04:05 +01:00
parent 400e3d01f1
commit b87fce9336
19 changed files with 1924 additions and 1931 deletions

View File

@ -317,9 +317,16 @@ class HtmlAnalyzer extends Analyzer
*/
private function findBestFavicon()
{
$defaultFaviconUrl = \App\Helpers\Url::makeUrlAbsolute($this->response->effectiveUri(), '/favicon.ico');
$potentialIcons = [];
try {
$defaultFaviconUrl = \App\Helpers\Url::makeUrlAbsolute($this->response->effectiveUri(), '/favicon.ico');
$potentialIcons[] = $defaultFaviconUrl;
} catch(Exception $ex) {
}
$links = $this->linkTags;
foreach ($links as $group => $tags) {
@ -330,13 +337,17 @@ class HtmlAnalyzer extends Analyzer
}
}
$potentialIcons[] = $defaultFaviconUrl;
$topWidth = 0;
$selectedIcon = null;
foreach ($potentialIcons as $potentialIcon) {
$url = \App\Helpers\Url::makeUrlAbsolute($this->response->effectiveUri(), $potentialIcon);
try {
$url = \App\Helpers\Url::makeUrlAbsolute($this->response->effectiveUri(), $potentialIcon);
} catch (\Exception $ex) {
report($ex);
continue;
}
try {
$response = Http::timeout(10)->get($url);

View File

@ -20,9 +20,10 @@ class Kernel extends ConsoleKernel
*/
protected function schedule(Schedule $schedule)
{
$schedule->command('document:update')->everyFifteenMinutes()->withoutOverlapping();
$schedule->command('feed:update')->everyFifteenMinutes()->withoutOverlapping();
$schedule->command('document:update')->everyFifteenMinutes();
//$schedule->command('feed:update')->everyFifteenMinutes();
$schedule->command('feeditems:purgeread')->daily();
$schedule->command('queue:flush')->daily();
}
/**

View File

@ -22,14 +22,26 @@ class Url
public static function makeUrlAbsolute($baseUrl, $relativeUrl)
{
if (\is_string($baseUrl)) {
$baseUrl = UriHttp::createFromString($baseUrl);
try {
$baseUrl = UriHttp::createFromString($baseUrl);
} catch(Exception $e) {
return $baseUrl;
}
}
if (\is_string($relativeUrl)) {
$relativeUrl = UriHttp::createFromString($relativeUrl);
try {
$relativeUrl = UriHttp::createFromString($relativeUrl);
} catch(Exception $e) {
$relativeUrl = '/';
}
}
$newUri = UriResolver::resolve($relativeUrl, $baseUrl);
try {
$newUri = UriResolver::resolve($relativeUrl, $baseUrl);
} catch(Exception $e) {
return $baseUrl;
}
return (string) $newUri;
}

View File

@ -226,7 +226,7 @@ class FolderController extends Controller
return $this->details($request, $folder);
}
$user = $folder->group->activeUsers()->findOrFail($validated['user_id']);
$user = $folder->group->activeUsers()->findOrFail($validated['user_id'])->first();
$user->setFolderPermissions($folder, $ability, $granted);

View File

@ -9,8 +9,9 @@ use Illuminate\Contracts\Queue\ShouldQueue;
use Illuminate\Foundation\Bus\Dispatchable;
use Illuminate\Queue\InteractsWithQueue;
use Illuminate\Queue\SerializesModels;
use Str;
class EnqueueDocumentUpdate implements ShouldQueue, ShouldBeUnique
class EnqueueDocumentUpdate implements ShouldQueue
{
use Dispatchable;
use InteractsWithQueue;
@ -30,7 +31,6 @@ class EnqueueDocumentUpdate implements ShouldQueue, ShouldBeUnique
* @var \App\Models\Document
*/
protected $document;
protected $documentId;
/**
* Create a new job instance.
@ -38,10 +38,6 @@ class EnqueueDocumentUpdate implements ShouldQueue, ShouldBeUnique
public function __construct(Document $document)
{
$this->document = $document;
if (!empty($this->document->id)) {
$this->documentId = $document->id;
}
}
/**
@ -52,14 +48,4 @@ class EnqueueDocumentUpdate implements ShouldQueue, ShouldBeUnique
$this->document->analyze();
$this->document = null;
}
/**
* The unique ID of the job.
*
* @return string
*/
public function uniqueId()
{
return $this->document->id;
}
}

View File

@ -10,7 +10,7 @@ use Illuminate\Foundation\Bus\Dispatchable;
use Illuminate\Queue\InteractsWithQueue;
use Illuminate\Queue\SerializesModels;
class EnqueueFeedUpdate implements ShouldQueue, ShouldBeUnique
class EnqueueFeedUpdate implements ShouldQueue
{
use Dispatchable;
use InteractsWithQueue;
@ -31,18 +31,12 @@ class EnqueueFeedUpdate implements ShouldQueue, ShouldBeUnique
*/
protected $feed;
public $feedId = null;
/**
* Create a new job instance.
*/
public function __construct(Feed $feed)
{
$this->feed = $feed;
if (!empty($this->feed->id)) {
$this->feedId = $feed->id;
}
}
/**
@ -53,14 +47,4 @@ class EnqueueFeedUpdate implements ShouldQueue, ShouldBeUnique
$this->feed->analyze();
$this->feed = null;
}
/**
* The unique ID of the job.
*
* @return string
*/
public function uniqueId()
{
return $this->feedId;
}
}

View File

@ -193,6 +193,8 @@ class FolderPolicy
if ($ability) {
return $permissions->{$ability};
} else {
return true;
}
return false;

View File

@ -55,6 +55,7 @@ trait AnalysesFeed
$this->url = $this->client->subscribe_url();
}
$this->error = null;
$this->title = \App\Helpers\Cleaner::cleanupString($this->client->get_title(), true, true);
$this->description = \App\Helpers\Cleaner::cleanupString($this->client->get_description());
$this->checked_at = now();

View File

@ -145,7 +145,7 @@ trait HasFeeds
if (empty($for['folders'])) {
$folderIds = Document::with('folders')->find($for['documents'])->pluck('folders')->flatten()->pluck('id');
$for['folders'] = Folder::find($folderIds);
$for['folders'] = Folder::whereIn('id', $folderIds)->get();
}
}

View File

@ -28,7 +28,7 @@ class User extends Authenticatable implements MustVerifyEmail, HasLocalePreferen
* @var array
*/
protected $fillable = [
'name', 'email', 'password', 'lang'
'name', 'email', 'password', 'lang', 'theme'
];
/**

3645
composer.lock generated

File diff suppressed because it is too large Load Diff

View File

@ -19,6 +19,8 @@ class CreateUsersTable extends Migration
$table->string('email')->unique();
$table->timestamp('email_verified_at')->nullable();
$table->string('password');
$table->string('lang')->default('en');
$table->string('theme')->default('auto');
$table->rememberToken();
$table->timestamps();
});

View File

@ -1,32 +0,0 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class CreatePasswordResetsTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('password_resets', function (Blueprint $table) {
$table->string('email')->index();
$table->string('token');
$table->timestamp('created_at')->nullable();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('password_resets');
}
}

View File

@ -1,36 +0,0 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class CreateFailedJobsTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('failed_jobs', function (Blueprint $table) {
$table->id();
$table->string('uuid')->unique();
$table->text('connection');
$table->text('queue');
$table->longText('payload');
$table->longText('exception');
$table->timestamp('failed_at')->useCurrent();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('failed_jobs');
}
}

View File

@ -1,41 +0,0 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class CreateUsersTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('users', function (Blueprint $table) {
$table->bigIncrements('id');
$table->string('name');
$table->string('email')->unique();
$table->timestamp('email_verified_at')->nullable();
$table->string('password');
$table->char('lang', 8)->default('en');
$table->string('theme')->default('auto');
$table->text('two_factor_secret')->nullable();
$table->text('two_factor_recovery_codes')->nullable();
$table->tinyInteger('is_admin')->default(0);
$table->rememberToken();
$table->timestamps();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('users');
}
}

2
package-lock.json generated
View File

@ -1,5 +1,5 @@
{
"name": "cyca",
"name": "cyca.athaliasoft.com",
"lockfileVersion": 2,
"requires": true,
"packages": {

2
public/css/app.css vendored

File diff suppressed because one or more lines are too long

View File

@ -3,5 +3,5 @@
"/js/groups.js": "/js/groups.js?id=605190725ef59db79f49",
"/js/highlights.js": "/js/highlights.js?id=4c09b28f0c7f645a34e7",
"/js/import.js": "/js/import.js?id=8740d2d52fa1aa69cc00",
"/css/app.css": "/css/app.css?id=01114ba1881507f1b4f5"
"/css/app.css": "/css/app.css?id=f4ec5e632ded01143548"
}

View File

@ -2,8 +2,8 @@
@section('menu')
<a href="{{ route('login') }}" class="{{ url()->current() === route('login') ? 'selected' : '' }}">{{ __('Login') }}</a>
<a href="{{ route('register') }}"
class="{{ url()->current() === route('register') ? 'selected' : '' }}">{{ __('Register') }}</a>
<!--<a href="{{ route('register') }}"
class="{{ url()->current() === route('register') ? 'selected' : '' }}">{{ __('Register') }}</a>-->
<a href="{{ route('password.request') }}"
class="{{ url()->current() === route('password.request') ? 'selected' : '' }}">{{ __('Password lost') }}</a>
@endsection
@ -22,4 +22,4 @@
<div class="w-3/4 bg-gray-100 dark:bg-gray-800 flex h-screen overflow-auto">
@yield('content')
</div>
@endsection
@endsection