patch for site initialization

still finding bugs related to the big routing rewrite, this one being an
error when starting a new set up.

fortunately, it was just a matter of getting the redirects pointing to
where they should, so it's a small fix
This commit is contained in:
RXP 2025-05-27 12:58:04 -06:00
parent ffe2ccdf5c
commit 82db115baf
Signed by: ro
GPG key ID: 976711B5057688B7
2 changed files with 16 additions and 9 deletions

View file

@ -9,6 +9,7 @@ use App\Services\Data\SortingService;
use App\Services\Upkeep\InitService;
use App\Http\Controllers\DashController;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Redirect;
use function _\find;
@ -53,7 +54,7 @@ class FrontController extends Controller
$template = $currentTheme . '.index';
return view($template, $pageData);
} else {
return response()->file('../public/index.html');
return view('back.init', ["status" => false, "title" => "Set Up"]);
}
}
}
@ -127,14 +128,20 @@ class FrontController extends Controller
public static function items()
{
//set permanent links
$items = ['archive', 'archives', 'tags'];
//grab menu items and set to array so router knows to look for them
$settings = json_decode(file_get_contents(env('SETTINGS_PATH')), true);
foreach ($settings['menu'] as $item) {
array_push($items, $item['slug']);
if (file_exists(env('SETTINGS_PATH'))) {
//set permanent links
$items = ['archive', 'archives', 'tags'];
//grab menu items and set to array so router knows to look for them
$settings = json_decode(file_get_contents(env('SETTINGS_PATH')), true);
foreach ($settings['menu'] as $item) {
array_push($items, $item['slug']);
}
return $items;
} else {
//return view('back.init', ["status" => false, "title" => "Set Up"]);
// return redirect()->route('start');
return [];
}
return $items;
}
//setup up a new site or restore from back up

View file

@ -14,7 +14,7 @@ use App\Http\Controllers\RSSController;
Route::prefix('/')
->controller(FrontController::class)
->group(function () {
Route::get("/", 'start');
Route::get("/", 'start')->name('start');
Route::get("/{year}/{month}/{slug}", 'page')
->where(['year' => '[0-9]+', 'month' => '[0-9]+', 'slug' => '[A-Za-z0-9-]+']);
Route::get("/{slug}/{option?}", 'menu')