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
+53
View File
@@ -39,6 +39,59 @@ class LinkRedirectTest extends TestCase
->assertRedirect('https://example.com/target');
}
public function test_direct_redirect_forwards_query_string_dynamically(): void
{
$user = $this->user();
ShortLink::create([
'user_id' => $user->id,
'slug' => 'promo',
'source_app' => 'link',
'source_kind' => 'redirect',
'is_managed_here' => true,
'destination_url' => 'https://example.com/landing?ref=home',
'is_active' => true,
]);
$this->get('https://ladl.link/promo?utm_source=ig&ref=campaign')
->assertRedirect('https://example.com/landing?ref=campaign&utm_source=ig');
}
public function test_direct_redirect_appends_path_suffix_dynamically(): void
{
$user = $this->user();
ShortLink::create([
'user_id' => $user->id,
'slug' => 'docs',
'source_app' => 'link',
'source_kind' => 'redirect',
'is_managed_here' => true,
'destination_url' => 'https://example.com/help',
'is_active' => true,
]);
$this->get('https://ladl.link/docs/getting-started?src=nav')
->assertRedirect('https://example.com/help/getting-started?src=nav');
}
public function test_public_url_uses_config_domain_dynamically(): void
{
config(['link.public_domain' => 'go.example.test']);
$user = $this->user();
$link = ShortLink::create([
'user_id' => $user->id,
'slug' => 'branded',
'source_app' => 'link',
'source_kind' => 'redirect',
'is_managed_here' => true,
'destination_url' => 'https://example.com',
'is_active' => true,
]);
$this->assertSame('https://go.example.test/branded', $link->publicUrl());
$this->assertSame('go.example.test', ShortLink::publicHost());
}
public function test_catalog_qr_links_proxy_to_platform_instead_of_bad_destination(): void
{
$user = $this->user();