summaryrefslogtreecommitdiff
path: root/routes/web.php
blob: 0e3c02a7a3dea2ffa25d353c10cb73446f0ced58 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
<?php

use Illuminate\Support\Facades\Route;
use App\Http\Controllers\SiteController;
use App\Http\Controllers\ProfileController;
use Illuminate\Http\Request;

Route::get('/', function () {
    return view('home');
});

Route::get('/env', [SiteController::class, 'env']);

Route::get('/dq', [SiteController::class, 'duneQuote']);

Route::post('/f', [SiteController::class, 'uploadFiles']); //TODO later use file resource or FPR service
Route::get('/f/{path}', function($path){
    $storpath = storage_path('app/public/uploads/' . $path);
    if (!file_exists($storpath)){
        return response()->json(['error' => 'file not found ' . $storpath]);
    }
    $mime = Storage::mimeType($storpath);
    return response()->file($storpath, [
        'Content-Type' => $mime,
        'Content-Disposition' => 'inline; filename="'.$path.'"'
    ]);
});

Route::get('/mu/{path}', function(){
    $storpath = storage_path('app/public/band/' . $path);
    if (!file_exists($storpath)){
        return response()->json(['error' => 'file not found ' . $storpath]);
    }
    $mime = Storage::mimeType($storpath);
    return response()->file($storpath, [
        'Content-Type' => $mime,
        'Content-Disposition' => 'inline; filename="'.$path.'"'
    ]);
});

Route::get('/test', [SiteController::class, 'test']);

Route::get('/4', [SiteController::class, 'search4chan']);

Route::get('/dashboard', function () {
    return view('dashboard');
})->middleware(['auth', 'verified'])->name('dashboard');

Route::get('/admin', function(){});

Route::middleware('auth')->group(function () {
    Route::get('/profile', [ProfileController::class, 'edit'])->name('profile.edit');
    Route::patch('/profile', [ProfileController::class, 'update'])->name('profile.update');
    Route::delete('/profile', [ProfileController::class, 'destroy'])->name('profile.destroy');
});

Route::post('/update-session', function(Request $req){
    if ($req->input('key') && $req->input('value')){
        session()->put($req->input('key'), $req->input('value'));
        return redirect()->back();
    }
});

require __DIR__.'/auth.php';

Route::get('/{v}', function($v){
    return view($v);
});