Skip to content

Commit 801a7cb

Browse files
committed
Optimized internal favicon API
1 parent 031c323 commit 801a7cb

File tree

7 files changed

+21
-19
lines changed

7 files changed

+21
-19
lines changed

resources/views/components/favicon.blade.php

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2432,4 +2432,13 @@ function get_headers($url,$format=0)
24322432
return $favicon;
24332433
}
24342434
2435+
?>
2436+
2437+
<?php
2438+
if($_SERVER['QUERY_STRING'] !== '' and $_SERVER['REMOTE_ADDR'] == $_SERVER['SERVER_ADDR']){
2439+
header("HTTP/1.1 302 Found");
2440+
$header = getFavIcon($_SERVER['QUERY_STRING']);
2441+
header("Location: $header");
2442+
exit();
2443+
}
24352444
?>

resources/views/components/pageitems/link-display.blade.php

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,9 @@
33
44
@endphp
55

6-
@include('components.favicon')
7-
86
<a class="button button-custom button button-hover icon-hover" rel="noopener noreferrer nofollow" href="{{ route('clickNumber') . '/' . $link->id . '/' . $link->link}}" @if(theme('open_links_in_same_tab') !="true" )target="_blank" @endif>
97
@if($params->GetSiteIcon ?? true)
10-
<img alt="button-icon" class="icon hvr-icon" src="{{getFavIcon($BaseURL)}}">
8+
<img alt="button-icon" class="icon hvr-icon" src="{{url('ico').'?'.$BaseURL}}" loading="lazy">
119
@endif
1210

1311
{{ $link->title }}

resources/views/home.blade.php

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -128,8 +128,6 @@ function themeAsset($path){
128128
}
129129
</style>
130130

131-
@include('components.favicon')
132-
133131
</head>
134132
<body>
135133

@@ -215,9 +213,9 @@ function themeAsset($path){
215213
@elseif($button['button'] === "buy me a coffee")
216214
<div style="--delay: {{ $initial++ }}s" class="button-entrance"><a class="button button-coffee button button-hover icon-hover" rel="noopener noreferrer nofollow" href="{{ $button['link'] }}" @if(theme('open_links_in_same_tab') != "true")target="_blank"@endif ><img alt="button-icon" class="icon hvr-icon" src="@if(theme('use_custom_icons') == "true"){{ url('themes/' . $GLOBALS['themeName'] . '/extra/custom-icons')}}/coffee{{theme('custom_icon_extension')}} @else{{ asset('\/littlelink/icons\/')}}coffee.svg @endif">Buy me a Coffee</a></div>
217215
@elseif($button['button'] === "custom_website" and ($button['custom_css'] === "" or $button['custom_css'] === "NULL") or (theme('allow_custom_buttons') == "false" and $button['button'] === "custom_website"))
218-
<div style="--delay: {{ $initial++ }}s" class="button-entrance"><a class="button button-custom_website button button-hover icon-hover" rel="noopener noreferrer nofollow" href="{{ $button['link'] }}" @if(theme('open_links_in_same_tab') != "true")target="_blank"@endif ><img alt="button-icon" class="icon hvr-icon" src="{{getFavIcon($button['link'])}}">{{ $button['title'] }}</a></div>
216+
<div style="--delay: {{ $initial++ }}s" class="button-entrance"><a class="button button-custom_website button button-hover icon-hover" rel="noopener noreferrer nofollow" href="{{ $button['link'] }}" @if(theme('open_links_in_same_tab') != "true")target="_blank"@endif ><img alt="button-icon" class="icon hvr-icon" src="{{url('ico').'?'.$button['link']}}" loading="lazy">{{ $button['title'] }}</a></div>
219217
@elseif($button['button'] === "custom_website" and $button['custom_css'] != "")
220-
<div style="--delay: {{ $initial++ }}s" class="button-entrance"><a class="button button-hover icon-hover" style="{{ $button['custom_css'] }}" rel="noopener noreferrer nofollow" href="{{ $button['link'] }}" @if(theme('open_links_in_same_tab') != "true")target="_blank"@endif ><img alt="button-icon" class="icon hvr-icon" src="{{getFavIcon($button['link'])}}">{{ $button['title'] }}</a></div>
218+
<div style="--delay: {{ $initial++ }}s" class="button-entrance"><a class="button button-hover icon-hover" style="{{ $button['custom_css'] }}" rel="noopener noreferrer nofollow" href="{{ $button['link'] }}" @if(theme('open_links_in_same_tab') != "true")target="_blank"@endif ><img alt="button-icon" class="icon hvr-icon" src="{{url('ico').'?'.$button['link']}}" loading="lazy">{{ $button['title'] }}</a></div>
221219
@elseif($button['button'] === "space")
222220
<?php
223221
if (is_numeric($button['title']) and $button['title'] < 10)

resources/views/littlelink.blade.php

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -151,8 +151,6 @@ function themeAsset($path){
151151
<!-- End of parallax background animations -->
152152
@endif
153153

154-
@include('components.favicon')
155-
156154
<?php ////begin share button//// ?>
157155

158156
@if(config('advanced-config.display_share_button') != '')
@@ -277,9 +275,9 @@ function get_operating_system() {
277275
@elseif($link->name === "mastodon")
278276
<div style="--delay: {{ $initial++ }}s" class="button-entrance"><a class="button button-{{ $link->name }} button button-hover icon-hover" rel="me noopener noreferrer nofollow" href="{{ route('clickNumber') . '/' . $link->id }}" @if(theme('open_links_in_same_tab') != "true")target="_blank"@endif ><img alt="button-icon" class="icon hvr-icon" src="@if(theme('use_custom_icons') == "true"){{ url('themes/' . $GLOBALS['themeName'] . '/extra/custom-icons')}}/{{$linkName}}{{theme('custom_icon_extension')}} @else{{ asset('\/littlelink/icons\/') . $linkName }}.svg @endif">{{ $link->title }}</a></div>
279277
@elseif($link->name === "custom_website"and $link->custom_css === "" or $link->custom_css === "NULL" or (theme('allow_custom_buttons') == "false" and $link->name === "custom"))
280-
<div style="--delay: {{ $initial++ }}s" class="button-entrance"><a class="button button-custom_website button button-hover icon-hover" rel="noopener noreferrer nofollow" href="{{ route('clickNumber') . '/' . $link->id }}" @if(theme('open_links_in_same_tab') != "true")target="_blank"@endif ><img alt="button-icon" class="icon hvr-icon" src="{{getFavIcon($link->link)}}">{{ $link->title }}</a></div>
278+
<div style="--delay: {{ $initial++ }}s" class="button-entrance"><a class="button button-custom_website button button-hover icon-hover" rel="noopener noreferrer nofollow" href="{{ route('clickNumber') . '/' . $link->id }}" @if(theme('open_links_in_same_tab') != "true")target="_blank"@endif ><img alt="button-icon" class="icon hvr-icon" src="{{url('ico').'?'.$link->link}}" loading="lazy">{{ $link->title }}</a></div>
281279
@elseif($link->name === "custom_website" and $link->custom_css != "")
282-
<div style="--delay: {{ $initial++ }}s" class="button-entrance"><a class="button button-hover icon-hover" style="{{ $link->custom_css }}" rel="noopener noreferrer nofollow" href="{{ route('clickNumber') . '/' . $link->id }}" @if(theme('open_links_in_same_tab') != "true")target="_blank"@endif ><img alt="button-icon" class="icon hvr-icon" src="{{getFavIcon($link->link)}}">{{ $link->title }}</a></div>
280+
<div style="--delay: {{ $initial++ }}s" class="button-entrance"><a class="button button-hover icon-hover" style="{{ $link->custom_css }}" rel="noopener noreferrer nofollow" href="{{ route('clickNumber') . '/' . $link->id }}" @if(theme('open_links_in_same_tab') != "true")target="_blank"@endif ><img alt="button-icon" class="icon hvr-icon" src="{{url('ico').'?'.$link->link}}" loading="lazy">{{ $link->title }}</a></div>
283281
@elseif($link->name === "space")
284282
<?php
285283
if (is_numeric($link->title) and $link->title < 10)

resources/views/studio/button-editor.blade.php

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
11
@if(env('ENABLE_BUTTON_EDITOR') === true)
22
@extends('layouts.sidebar')
33

4-
@include('components.favicon')
5-
64
@section('content')
75
@push('sidebar-scripts')
86
<?php function strp($urlStrp){return str_replace(array('http://', 'https://'), '', $urlStrp);} ?>
@@ -218,7 +216,7 @@
218216
@if($buttonId == 1)
219217
<center><div id="sample" style="--delay: 1s; border-radius:8px !important; max-width: 400px; width: 80%; class="button-entrance"><div class="button-demo button hvr-grow hvr-icon-wobble-vertical"><img class="icon hvr-icon" src="{{ asset('\/littlelink/icons\/') . 'custom' }}.svg">{{ $title }}</div></div></center>
220218
@else
221-
<center><div id="sample" style="--delay: 1s; border-radius:8px !important; max-width: 400px; width: 80%; class="button-entrance"><div class="button-demo button hvr-grow hvr-icon-wobble-vertical"><img class="wicon hvr-icon" src="{{getFavIcon($link)}}">{{ $title }}</div></div></center>
219+
<center><div id="sample" style="--delay: 1s; border-radius:8px !important; max-width: 400px; width: 80%; class="button-entrance"><div class="button-demo button hvr-grow hvr-icon-wobble-vertical"><img class="wicon hvr-icon" src="{{url('ico').'?'.$link}}" loading="lazy">{{ $title }}</div></div></center>
222220
@endif
223221

224222
</section>
@@ -257,9 +255,9 @@
257255
@if($custom_css === "" or $custom_css === "NULL" and $buttonId == 1)
258256
<center><div style="--delay: 1s" class="button-entrance"><div class="button-demo button-custom button hvr-grow hvr-icon-wobble-vertical"><img class="icon hvr-icon fa {{$custom_icon}}">{{ $title }}</div></div></center>
259257
@elseif($custom_css === "" or $custom_css === "NULL" and $buttonId == 2)
260-
<center><div style="--delay: 1s" class="button-entrance"><div class="button-custom_website button hvr-grow hvr-icon-wobble-vertical"><img class="wicon hvr-icon" src="{{getFavIcon($link)}}">{{ $title }}</div></div></center>
258+
<center><div style="--delay: 1s" class="button-entrance"><div class="button-custom_website button hvr-grow hvr-icon-wobble-vertical"><img class="wicon hvr-icon" src="{{url('ico').'?'.$link}}" loading="lazy">{{ $title }}</div></div></center>
261259
@elseif($custom_css != "" and $buttonId == 2)
262-
<center><div style="--delay: 1s" class="button-entrance"><div style="{{ $custom_css }}" class="button-custom_website button hvr-grow hvr-icon-wobble-vertical"><img class="wicon hvr-icon" src="{{getFavIcon($link)}}">{{ $title }}</div></div></center>
260+
<center><div style="--delay: 1s" class="button-entrance"><div style="{{ $custom_css }}" class="button-custom_website button hvr-grow hvr-icon-wobble-vertical"><img class="wicon hvr-icon" src="{{url('ico').'?'.$link}}" loading="lazy">{{ $title }}</div></div></center>
263261
@else
264262
<center><div style="--delay: 1s" class="button-entrance"><div style="{{ $custom_css }}" class="button-demo hvr-grow hvr-icon-wobble-vertical"><i style="color: {{$custom_icon}}" class="icon hvr-icon fa {{$custom_icon}}"></i>{{ $title }}</div></div></center>
265263
@endif

resources/views/studio/links.blade.php

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,6 @@
3030
</style>
3131
@endpush
3232

33-
@include('components.favicon')
34-
3533
<?php function strp($urlStrp){return str_replace(array('http://', 'https://'), '', $urlStrp);} ?>
3634

3735
<div style="text-align: right;"><a href="{{ url('/studio/links') }}/10">10</a> | <a href="{{ url('/studio/links') }}/20">20</a> | <a href="{{ url('/studio/links') }}/30">30</a> | <a href="{{ url('/studio/links') }}/all">all</a></div>
@@ -70,7 +68,7 @@
7068
<span class='h6'>
7169
<?php $button = Button::find($link->button_id); if(isset($button->name)){$buttonName = $button->name;}else{$buttonName = 0;} ?>
7270
@if($button->name == "custom_website")
73-
<span style="border: 1px solid #d0d4d7 !important;border-radius:5px;background-color:#6c757d;width:25px!important;height:25px!important;"><img style="margin-bottom:3px;margin-left:4px;margin-right:4px;max-width:15px;max-height:15px;" alt="button-icon" class="icon hvr-icon" src="{{getFavIcon($link->link)}}"></span>
71+
<span style="border: 1px solid #d0d4d7 !important;border-radius:5px;background-color:#6c757d;width:25px!important;height:25px!important;"><img style="margin-bottom:3px;margin-left:4px;margin-right:4px;max-width:15px;max-height:15px;" alt="button-icon" class="icon hvr-icon" src="{{url('ico').'?'.$link->link}}" loading="lazy"></span>
7472
@elseif($button->name == "space")
7573
<span style="border: 1px solid #d0d4d7 !important;border-radius:5px;background-color:#6c757d;width:25px!important;height:25px!important;"><i style="margin-left:2.83px;margin-right:-1px;color:#fff;" class='bi bi-distribute-vertical'>&nbsp;</i></span>
7674
@elseif($button->name == "heading")

routes/web.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,9 @@
8282
Route::get('/pages/{name}', [AdminController::class, 'pages'])->name('pages');
8383
Route::get('/theme/@{littlelink}', [UserController::class, 'theme'])->name('theme');
8484

85+
//API
86+
Route::get('/ico', function () {return view('components.favicon');});
87+
8588
//User route
8689
Route::group([
8790
'middleware' => env('REGISTER_AUTH'),

0 commit comments

Comments
 (0)