Make Ladill Link short URLs fully dynamic at click time.
Deploy Ladill Link / deploy (push) Successful in 1m55s

Forward query strings and path suffixes to the live destination, resolve public hosts from config/custom domains instead of hardcoding ladl.link, and keep proxy Location rewrites on the visitor host.
This commit is contained in:
isaacclad
2026-07-16 20:05:43 +00:00
parent a9ddd600db
commit d45f4b5c58
14 changed files with 195 additions and 28 deletions
@@ -41,6 +41,8 @@ class LinkController extends Controller
'canCreate' => $this->billing->canCreate($account),
'pricePerLink' => \App\Models\LinkWallet::pricePerLink(),
'topupUrl' => ladill_account_url('wallet'),
'publicHost' => parse_url($account->publicLinkBaseUrl(), PHP_URL_HOST) ?: ShortLink::publicHost(),
'publicBaseUrl' => $account->publicLinkBaseUrl(),
]);
}
@@ -51,6 +53,8 @@ class LinkController extends Controller
return view('links.create', [
'canCreate' => $this->billing->canCreate($account),
'pricePerLink' => \App\Models\LinkWallet::pricePerLink(),
'publicHost' => parse_url($account->publicLinkBaseUrl(), PHP_URL_HOST) ?: ShortLink::publicHost(),
'publicBaseUrl' => $account->publicLinkBaseUrl(),
]);
}
@@ -29,6 +29,8 @@ class OverviewController extends Controller
'wallet' => $wallet,
'recentLinks' => $recentLinks,
'pricePerLink' => \App\Models\LinkWallet::pricePerLink(),
'publicHost' => parse_url($account->publicLinkBaseUrl(), PHP_URL_HOST) ?: ShortLink::publicHost(),
'publicBaseUrl' => $account->publicLinkBaseUrl(),
]);
}
}
@@ -33,7 +33,9 @@ class SettingsController extends Controller
if ($validated['domain'] === 'platform') {
LinkCustomDomain::where('user_id', $account->id)->update(['is_default' => false]);
return back()->with('success', 'Default short-link domain set to ladl.link.');
$domain = (string) config('link.public_domain', 'ladl.link');
return back()->with('success', 'Default short-link domain set to '.$domain.'.');
}
$domain = LinkCustomDomain::query()
@@ -5,7 +5,6 @@ namespace App\Http\Controllers\Public;
use App\Http\Controllers\Controller;
use App\Services\Link\LinkManagerService;
use App\Services\Link\LinkPlatformProxy;
use App\Support\LadillLink;
use Illuminate\Http\RedirectResponse;
use Illuminate\Http\Request;
use Symfony\Component\HttpFoundation\Response;
@@ -19,13 +18,15 @@ class LinkRedirectController extends Controller
public function resolve(Request $request, string $slug, ?string $path = null): RedirectResponse|Response
{
if ($path === null || $path === '') {
$link = $this->links->resolve($request, $slug);
if ($link !== null && $link->isDirectRedirect()) {
return redirect()->away($link->destination_url, 302);
}
$link = $this->links->resolve($request, $slug);
if ($link !== null && $link->isDirectRedirect()) {
$target = $link->resolveRedirectUrl($request, $path);
return redirect()->away($target, 302);
}
// Catalog / QR ecosystem slugs: proxy so destination stays live in the source app.
return $this->platform->forward($request, $slug, $path);
}
}