Replace Auth System #3

Merged
w33b merged 19 commits from auth-redo into main 2026-01-09 15:11:37 +00:00
14 changed files with 27 additions and 31 deletions
Showing only changes of commit c0b068de58 - Show all commits

View File

@@ -30,9 +30,9 @@ class AutoStats extends Command
*/
public function handle()
{
PopularDaily::where('created_at', '<=', Carbon::now()->subMinutes(1440))->forceDelete();
PopularWeekly::where('created_at', '<=', Carbon::now()->subMinutes(10080))->forceDelete();
PopularMonthly::where('created_at', '<=', Carbon::now()->subMinutes(43200))->forceDelete();
PopularDaily::where('created_at', '<=', Carbon::now()->subMinutes(1440))->delete();
PopularWeekly::where('created_at', '<=', Carbon::now()->subMinutes(10080))->delete();
PopularMonthly::where('created_at', '<=', Carbon::now()->subMinutes(43200))->delete();
$this->comment('Automated Purge Stats Complete');
}

View File

@@ -35,6 +35,6 @@ class ResetUserDownloads extends Command
// Clear old downloads which have expired
UserDownload::where('created_at', '<=', Carbon::now()->subHour(6))
->forceDelete();
->delete();
}
}

View File

@@ -41,7 +41,7 @@ class AlertController extends Controller
*/
public function delete(int $alert_id): \Illuminate\Http\RedirectResponse
{
Alert::where('id', $alert_id)->forceDelete();
Alert::where('id', $alert_id)->delete();
cache()->forget('alerts');

View File

@@ -105,7 +105,7 @@ class SiteBackgroundController extends Controller
DB::beginTransaction();
$bg = SiteBackground::where('id', $id)->firstOrFail();
$bg->forceDelete();
$bg->delete();
$resolutions = [1440, 1080, 720, 640];
try {

View File

@@ -38,7 +38,7 @@ class SubtitleController extends Controller
// Clear everything
foreach($episode->subtitles as $sub) {
$sub->forceDelete();
$sub->delete();
}
if (! $request->input('subtitles')) {

View File

@@ -32,7 +32,7 @@ class NotificationController extends Controller
->where('id', $request->input('id'))
->firstOrFail();
$notification->forceDelete();
$notification->delete();
return redirect()->back();
}

View File

@@ -105,13 +105,11 @@ class PlaylistController extends Controller
$user = $request->user();
$playlist = Playlist::where('user_id', $user->id)->where('id', $playlist_id)->firstOrFail();
$playlist = Playlist::where('user_id', $user->id)
->where('id', $playlist_id)
->firstOrFail();
// Delete Playlist Episodes
PlaylistEpisode::where('playlist_id', $playlist->id)->forceDelete();
// Delete Playlist
$playlist->forceDelete();
$playlist->delete();
return to_route('profile.playlists');
}
@@ -128,8 +126,14 @@ class PlaylistController extends Controller
], 404);
}
$playlist = Playlist::where('user_id', $request->user()->id)->where('id', (int) $request->input('playlist'))->firstOrFail();
PlaylistEpisode::where('playlist_id', $playlist->id)->where('episode_id', (int) $request->input('episode'))->forceDelete();
$playlist = Playlist::where('user_id', $request->user()->id)
->where('id', (int) $request->input('playlist'))
->firstOrFail();
PlaylistEpisode::where('playlist_id', $playlist->id)
->where('episode_id', (int) $request->input('episode'))
->delete();
$this->playlistService->reorderPositions($playlist);
return response()->json([

View File

@@ -152,13 +152,6 @@ class ProfileController extends Controller
]);
}
// Delete Playlist
$playlists = Playlist::where('user_id', $user->id)->get();
foreach($playlists as $playlist) {
PlaylistEpisode::where('playlist_id', $playlist->id)->forceDelete();
$playlist->forceDelete();
}
// Update comments to deleted user
DB::table('comments')->where('commenter_id', '=', $user->id)->update(['commenter_id' => 1]);
@@ -169,7 +162,7 @@ class ProfileController extends Controller
Auth::logout();
$user->forceDelete();
$user->delete();
$request->session()->invalidate();

View File

@@ -10,7 +10,6 @@ use Livewire\Component;
use Illuminate\Support\Carbon;
use Illuminate\Support\Facades\Auth;
use Illuminate\Support\Facades\Cache;
class DownloadsFree extends Component
{
@@ -51,7 +50,7 @@ class DownloadsFree extends Component
// Check timestamp
if (Carbon::parse($alreadyDownloaded->created_at)->addHours(6) <= Carbon::now()) {
// Already expired
$alreadyDownloaded->forceDelete();
$alreadyDownloaded->delete();
return;
}

View File

@@ -103,7 +103,7 @@ class User extends Authenticatable
{
if ($this->discord_id && $this->discord_avatar && !$this->avatar)
{
return $this->discord_avatar;
return "https://external-content.duckduckgo.com/iu/?u={$this->discord_avatar}";
}
if ($this->avatar)

View File

@@ -91,7 +91,7 @@ class CommentService
if (Config::get('comments.soft_deletes') == true) {
$comment->delete();
} else {
$comment->forceDelete();
$comment->delete();
}
}

View File

@@ -74,7 +74,7 @@ class GalleryService
foreach ($oldGallery as $oldImage) {
Storage::disk('public')->delete($oldImage->image_url);
Storage::disk('public')->delete($oldImage->thumbnail_url);
$oldImage->forceDelete();
$oldImage->delete();
}
}
}

View File

@@ -15,7 +15,7 @@ return new class extends Migration
public function up(): void
{
# Delete entries with "#" as URL
Downloads::where('url', '#')->forceDelete();
Downloads::where('url', '#')->delete();
# Remove duplicate entries
$duplicates = DB::table('downloads')

View File

@@ -155,7 +155,7 @@ return new class extends Migration
->where('playlist_id', '=', $playlist->id)
->delete();
$playlist->forceDelete();
$playlist->delete();
}
}