Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Upgrade to laravel 10 and running again #103

Open
wants to merge 17 commits into
base: next
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
41 changes: 41 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
FROM alpine

RUN apk update && apk upgrade \
&& apk add --no-cache php83 php83-mbstring php83-xml php83-pdo php83-mysqli php83-bcmath php83-ctype php83-zip \
php83-imap php83-curl php83-json php83-gettext php83-gd php83-session php83-snmp php83-pdo_mysql php83-tokenizer \
php83-openssl php83-sockets php83-fileinfo php83-dom php83-exif php83-simplexml php83-xmlwriter php83-xmlreader\
php83-sqlite3 php83-pdo_sqlite php83-pcntl php83-gd php83-iconv php83-phar composer nodejs php83-apache2 apache2 npm git python3 ca-certificates \
curl ffmpeg chromium ttf-freefont font-noto-emoji \
&& curl -Lo /usr/bin/yt-dlp https://github.com/yt-dlp/yt-dlp/releases/latest/download/yt-dlp \
&& chmod a+rx /usr/bin/yt-dlp \
&& apk del curl

EXPOSE 80

RUN mkdir -p /var/www/laravel && \
sed -i 's#^DocumentRoot ".*#DocumentRoot "/var/www/laravel/public"#g' /etc/apache2/httpd.conf && \
sed -i 's#AllowOverride [Nn]one#AllowOverride All#' /etc/apache2/httpd.conf && \
sed -i 's#Directory "/var/www/localhost/htdocs.*#Directory "/var/www/laravel/public" >#g' /etc/apache2/httpd.conf && \
sed -i 's#\#LoadModule rewrite_module modules/mod_rewrite.so#LoadModule rewrite_module modules/mod_rewrite.so#' /etc/apache2/httpd.conf

WORKDIR /var/www/laravel

COPY . .

RUN echo "* * * * * cd /var/www/laravel && php artisan schedule:run >> /dev/null 2>&1" > /crontab.txt && \
/usr/bin/crontab /crontab.txt && \
echo -e "#!/bin/sh\n/usr/sbin/crond -b -l 8\n/usr/sbin/httpd -D FOREGROUND" > /entrypoint.sh && chmod +x /entrypoint.sh

RUN find . -type f -exec chmod 664 {} \; \
&& find . -type d -exec chmod 775 {} \; \
&& chown -R apache:apache * . \
&& composer install --no-dev -o \
&& npm install \
&& chmod -R a+x node_modules \
&& npm run production \
&& php artisan optimize \
&& php artisan view:clear \
&& php artisan config:clear \
&& adduser -D chrome

ENTRYPOINT ["/entrypoint.sh"]
4 changes: 2 additions & 2 deletions app/Concerns/Models/HasTags.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

namespace App\Concerns\Models;

use App\Tag;
use App\Models\Tag;
use Illuminate\Database\Eloquent\Builder;
use Illuminate\Database\Eloquent\Relations\MorphToMany;
use Illuminate\Support\Collection;
Expand All @@ -15,7 +15,7 @@ trait HasTags
{
public function tags(): MorphToMany
{
return $this->morphToMany('App\Tag', 'taggable');
return $this->morphToMany('App\Models\Tag', 'taggable');
}

/**
Expand Down
4 changes: 2 additions & 2 deletions app/Concerns/Models/Postable.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@

namespace App\Concerns\Models;

use App\Post;
use App\User;
use App\Models\Post;
use App\Models\User;
use Illuminate\Database\Eloquent\Builder;
use Illuminate\Database\Eloquent\Relations\MorphOne;
use Illuminate\Http\Request;
Expand Down
2 changes: 1 addition & 1 deletion app/Console/Commands/DecryptChests.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

namespace App\Console\Commands;

use App\Chest;
use App\Models\Chest;
use Illuminate\Console\Command;
use Illuminate\Support\Facades\DB;

Expand Down
2 changes: 1 addition & 1 deletion app/Console/Commands/EncryptChests.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

namespace App\Console\Commands;

use App\Chest;
use App\Models\Chest;
use Illuminate\Console\Command;
use Illuminate\Support\Facades\DB;

Expand Down
8 changes: 5 additions & 3 deletions app/Console/Commands/Install.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

namespace App\Console\Commands;

use App\Models\Link;
use App\Models\User;
use Illuminate\Console\Command;

class Install extends Command
Expand All @@ -26,20 +28,20 @@ public function handle()

if ($this->confirm('Default data?')) {
$this->callSilent('db:seed');
exec('php artisan scout:import ' . \App\Link::class);
exec('php8 artisan scout:import ' . Link::class);
}

$name = $this->ask('User name?', 'Admin');
$email = $this->ask('User email?', 'shaark@example.com');
$pass = $this->ask('User pass?', 'secret');

$user = \App\User::count() ? \App\User::first() : new \App\User();
$user = User::count() ? User::first() : new User();

$user->fill([
'name' => $name,
'email' => $email,
'password' => \Illuminate\Support\Facades\Hash::make($pass),
'api_token' => $pass === 'secret' ? 'api-token-secret' : \App\User::generateApiToken(),
'api_token' => $pass === 'secret' ? 'api-token-secret' : User::generateApiToken(),
]);

$user->save();
Expand Down
2 changes: 1 addition & 1 deletion app/Console/Commands/LinkHealthChecks.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
namespace App\Console\Commands;

use App\Events\LinkHealthCheck;
use App\Link;
use App\Models\Link;
use App\Services\Shaark\Shaark;
use Illuminate\Console\Command;
use Illuminate\Database\Eloquent\Collection;
Expand Down
2 changes: 1 addition & 1 deletion app/Events/LinkArchiveRequested.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

namespace App\Events;

use App\Link;
use App\Models\Link;
use Illuminate\Broadcasting\Channel;
use Illuminate\Queue\SerializesModels;
use Illuminate\Broadcasting\PrivateChannel;
Expand Down
2 changes: 1 addition & 1 deletion app/Events/LinkHealthCheck.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

namespace App\Events;

use App\Link;
use App\Models\Link;
use Illuminate\Broadcasting\Channel;
use Illuminate\Queue\SerializesModels;
use Illuminate\Broadcasting\PrivateChannel;
Expand Down
6 changes: 3 additions & 3 deletions app/Exceptions/Handler.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

namespace App\Exceptions;

use Exception;
Use Throwable;
use Illuminate\Foundation\Exceptions\Handler as ExceptionHandler;

class Handler extends ExceptionHandler
Expand Down Expand Up @@ -32,7 +32,7 @@ class Handler extends ExceptionHandler
* @param \Exception $exception
* @return void
*/
public function report(Exception $exception)
public function report(Throwable $exception)
{
parent::report($exception);
}
Expand All @@ -44,7 +44,7 @@ public function report(Exception $exception)
* @param \Exception $exception
* @return \Illuminate\Http\Response
*/
public function render($request, Exception $exception)
public function render($request, Throwable $exception)
{
return parent::render($request, $exception);
}
Expand Down
2 changes: 1 addition & 1 deletion app/Exports/ChestsExport.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

namespace App\Exports;

use App\Chest;
use App\Models\Chest;
use Maatwebsite\Excel\Concerns\FromCollection;
use Maatwebsite\Excel\Concerns\WithHeadings;
use Maatwebsite\Excel\Concerns\WithMapping;
Expand Down
2 changes: 1 addition & 1 deletion app/Exports/LinksExport.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

namespace App\Exports;

use App\Link;
use App\Models\Link;
use Maatwebsite\Excel\Concerns\FromCollection;
use Maatwebsite\Excel\Concerns\WithHeadings;
use Maatwebsite\Excel\Concerns\WithMapping;
Expand Down
2 changes: 1 addition & 1 deletion app/Exports/StoriesExport.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

namespace App\Exports;

use App\Story;
use App\Models\Story;
use Maatwebsite\Excel\Concerns\FromCollection;
use Maatwebsite\Excel\Concerns\WithHeadings;
use Maatwebsite\Excel\Concerns\WithMapping;
Expand Down
2 changes: 1 addition & 1 deletion app/Http/Controllers/AccountController.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

use App\Http\Requests\UpdateUserAccount;
use App\Http\Requests\UpdateUserPassword;
use App\User;
use App\Models\User;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Auth;
use Illuminate\Support\Facades\Hash;
Expand Down
4 changes: 2 additions & 2 deletions app/Http/Controllers/AlbumController.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@

namespace App\Http\Controllers;

use App\Album;
use App\Models\Album;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Storage;
use Illuminate\Support\Str;
use Spatie\MediaLibrary\Models\Media;
use Spatie\MediaLibrary\MediaCollections\Models\Media;

class AlbumController extends Controller
{
Expand Down
4 changes: 2 additions & 2 deletions app/Http/Controllers/Api/AlbumController.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@

namespace App\Http\Controllers\Api;

use App\Album;
use App\Models\Album;
use App\Http\Controllers\Controller;
use App\Http\Requests\StoreAlbumRequest;
use App\Http\Requests\StoreAlbumUploadRequest;
use App\Http\Resources\PostResource;
use App\Post;
use App\Models\Post;
use App\Services\Shaark\Shaark;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Storage;
Expand Down
4 changes: 2 additions & 2 deletions app/Http/Controllers/Api/ChestController.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@

use App\Http\Controllers\Controller;
use App\Http\Requests\StoreChestRequest;
use App\Chest;
use App\Models\Chest;
use App\Http\Resources\PostResource;
use App\Post;
use App\Models\Post;
use Illuminate\Http\Request;

class ChestController extends Controller
Expand Down
4 changes: 2 additions & 2 deletions app/Http/Controllers/Api/CommentController.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@

namespace App\Http\Controllers\Api;

use App\Comment;
use App\Models\Comment;
use App\Http\Controllers\Controller;
use App\Http\Requests\AddCommentRequest;
use App\Http\Resources\CommentResource;
use App\Post;
use App\Models\Post;
use App\Services\Shaark\Shaark;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\DB;
Expand Down
2 changes: 1 addition & 1 deletion app/Http/Controllers/Api/LinkArchiveController.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

use App\Events\LinkArchiveRequested;
use App\Http\Controllers\Controller;
use App\Link;
use App\Models\Link;
use App\Services\LinkArchive\LinkArchive;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Storage;
Expand Down
4 changes: 2 additions & 2 deletions app/Http/Controllers/Api/LinkController.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
use App\Http\Controllers\Controller;
use App\Http\Requests\StoreLinkRequest;
use App\Http\Resources\PostResource;
use App\Link;
use App\Post;
use App\Models\Link;
use App\Models\Post;
use App\Services\WebParser;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Storage;
Expand Down
2 changes: 1 addition & 1 deletion app/Http/Controllers/Api/Manage/ArchivesController.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

use App\Http\Controllers\Controller;
use App\Http\Resources\LinkArchiveResource;
use App\Link;
use App\Models\Link;
use Illuminate\Http\Request;

class ArchivesController extends Controller
Expand Down
8 changes: 1 addition & 7 deletions app/Http/Controllers/Api/Manage/FeaturesController.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
use App\Services\LinkArchive\LinkArchive;
use App\Services\LinkArchive\YoutubeDlProvider;
use App\Services\Shaark\Shaark;
use App\User;
use App\Models\User;
use Illuminate\Http\Request;
use Illuminate\Http\JsonResponse;
use Illuminate\Support\Facades\Storage;
Expand Down Expand Up @@ -59,12 +59,6 @@ protected function checkArchivePdf(Shaark $shaark)
return $this->sendError(__('Your node path is unreachable: :path', ['path' => $exec]));
}

$dir = base_path('node_modules/puppeteer/.local-chromium');

if (false === is_dir($dir)) {
return $this->sendError(__('Puppeteer dependencies not installed, run `npm install @nesk/puphpeteer --no-save`'));
}

try {
$name = LinkArchive::archive(url()->route('home'), 'pdf');
} catch (\Exception $e) {
Expand Down
2 changes: 1 addition & 1 deletion app/Http/Controllers/Api/Manage/LinksHealthController.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

use App\Http\Controllers\Controller;
use App\Http\Resources\LinkResource;
use App\Link;
use App\Models\Link;
use Illuminate\Http\Request;

class LinksHealthController extends Controller
Expand Down
4 changes: 2 additions & 2 deletions app/Http/Controllers/Api/Manage/TagsController.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
namespace App\Http\Controllers\Api\Manage;

use App\Http\Controllers\Controller;
use App\Post;
use App\Tag;
use App\Models\Post;
use App\Models\Tag;
use Illuminate\Http\Request;

class TagsController extends Controller
Expand Down
4 changes: 2 additions & 2 deletions app/Http/Controllers/Api/Manage/UsersController.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@
use App\Http\Requests\Manage\StoreUserRequest;
use App\Http\Requests\Manage\UpdateUserRequest;
use App\Http\Resources\UserResource;
use App\Post;
use App\User;
use App\Models\Post;
use App\Models\User;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Hash;

Expand Down
2 changes: 1 addition & 1 deletion app/Http/Controllers/Api/Manage/WallsController.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

use App\Http\Controllers\Controller;
use App\Http\Requests\StoreWallRequest;
use App\Wall;
use App\Models\Wall;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Http\Request;

Expand Down
4 changes: 2 additions & 2 deletions app/Http/Controllers/Api/SearchController.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@
use App\Http\Controllers\Controller;
use App\Http\Resources\PostResource;
use App\Http\Resources\TagResource;
use App\Post;
use App\Models\Post;
use App\Services\ModelSearch;
use App\Services\Shaark\Shaark;
use App\Tag;
use App\Models\Tag;
use Illuminate\Http\Request;

class SearchController extends Controller
Expand Down
4 changes: 2 additions & 2 deletions app/Http/Controllers/Api/ShareController.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@

use App\Http\Controllers\Controller;
use App\Http\Resources\ShareResource;
use App\Post;
use App\Share;
use App\Models\Post;
use App\Models\Share;
use Illuminate\Http\Request;

class ShareController extends Controller
Expand Down
4 changes: 2 additions & 2 deletions app/Http/Controllers/Api/StoryController.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
use App\Http\Controllers\Controller;
use App\Http\Requests\StoreStoryRequest;
use App\Http\Resources\PostResource;
use App\Post;
use App\Story;
use App\Models\Post;
use App\Models\Story;
use Illuminate\Http\Request;

class StoryController extends Controller
Expand Down
Loading