Added Theme Credit page

A short page that displays the contents of a Theme's readme.md.

Currently, a link to this page is only visible in the HTML meta tags if viewed as page source.
This page can always be accessed on your.domain.com/theme/@littlelink_name.
(For example your.domain.com/theme/@admin)
This commit is contained in:
Julian Prieber 2022-05-31 14:11:26 +02:00
parent 1fd768057f
commit e98d942b04
4 changed files with 82 additions and 1 deletions

View File

@ -376,4 +376,23 @@ if($request->name != '' ) {
}
return back();
}
//Show user theme credit page
public function theme(request $request)
{
$littlelink_name = $request->littlelink;
$id = User::select('id')->where('littlelink_name', $littlelink_name)->value('id');
if (empty($id)) {
return abort(404);
}
$userinfo = User::select('name', 'littlelink_name', 'littlelink_description', 'theme')->where('id', $id)->first();
$information = User::select('name', 'littlelink_name', 'littlelink_description', 'theme')->where('id', $id)->get();
$links = DB::table('links')->join('buttons', 'buttons.id', '=', 'links.button_id')->select('links.link', 'links.id', 'links.button_id', 'links.title', 'links.custom_css', 'links.custom_icon', 'buttons.name')->where('user_id', $id)->orderBy('up_link', 'asc')->orderBy('order', 'asc')->get();
return view('components/theme', ['userinfo' => $userinfo, 'information' => $information, 'links' => $links, 'littlelink_name' => $littlelink_name]);
}
}

View File

@ -0,0 +1,55 @@
@extends('layouts.updater')
@foreach($information as $info)
@Push('updater-head')
<title>{{ $userinfo->name }} 🌇 {{ ucfirst(trans($info->theme)) }} </title>
<meta name="robots" content="noindex">
<style>
.container-theme {
position: absolute;
left: 50%;
top: 50%;
-webkit-transform: translate(-50%, -50%);
transform: translate(-50%, -50%);
}
.container-theme pre {
display: inline-block;
text-align: left;
}
</style>
@endpush
@Push('updater-body')
@if(file_exists(base_path("themes/$info->theme/readme.md")))
<div class="container-theme">
<h1>Theme: {{ ucfirst(trans($info->theme)) }}</h1>
<?php
$reg_exUrl = "/(http|https|ftp|ftps)\:\/\/[a-zA-Z0-9\-\.]+\.[a-zA-Z]{2,3}(\/\S*)?/";
$text = file_get_contents('themes/' . $info->theme . '/readme.md');
if(preg_match($reg_exUrl, $text, $url)) {
$txtspc = '<pre>' . preg_replace($reg_exUrl, "<a href=" . $url[0] . ">$url[0]</a> ", $text) . '</pre>';
echo preg_replace('/[ \t]+/', ' ', preg_replace('/\s\S*$^\s\S*/m', "\n", $txtspc));
} else {
echo '<pre>' . preg_replace('/[ \t]+/', ' ', preg_replace('/\s\S*$^\s\S*/m', "\n", $txtspc)) . '</pre>';
}
?>
</div>
@else
<div class="container"><p>File not found</p></div>
@endif
@endforeach
@endpush

View File

@ -53,10 +53,16 @@
@foreach($information as $info)
@if($info->theme != '' and $info->theme != 'default')
<!-- LittleLink Custom Theme: "{{$info->theme}}" -->
<!-- Theme details: -->
<meta name="designer" href="{{ url('') . "/theme/@" . $littlelink_name}}" content="{{ url('') . "/theme/@" . $littlelink_name}}">
<link rel="stylesheet" href="themes/{{$info->theme}}/share.button.css">
<link rel="stylesheet" href="themes/{{$info->theme}}/brands.css">
<link rel="stylesheet" href="themes/{{$info->theme}}/skeleton-auto.css">
@if(file_exists(base_path("themes/{{$info->theme}}/skeleton-auto.css" )))
@if(file_exists(asset('themes/' . $info->theme . '/animations.css')))
<link rel="stylesheet" href="<?php echo asset('themes/' . $info->theme . '/animations.css') ?>">
@else
<link rel="stylesheet" href="{{ asset('littlelink/css/animations.css') }}">

View File

@ -40,6 +40,7 @@ Route::get('/going/{id?}/{link?}', [UserController::class, 'clickNumber'])->wher
Route::get('/+{littlelink}', [UserController::class, 'littlelink'])->name('littlelink');
Route::get('/@{littlelink}', [UserController::class, 'littlelink'])->name('littlelink');
Route::get('/pages/{name}', [AdminController::class, 'pages'])->name('pages');
Route::get('/theme/@{littlelink}', [UserController::class, 'theme'])->name('theme');
//User route
Route::group([