Update site name config

This commit is contained in:
Daniel Supernault 2021-05-07 21:47:51 -06:00
parent c6848e99a4
commit 61254b907f
No known key found for this signature in database
GPG key ID: 0DEF1C662C9033F7
8 changed files with 110 additions and 110 deletions

View file

@ -974,7 +974,7 @@ class ApiV1Controller extends Controller
'domain_count' => 0 'domain_count' => 0
], ],
'thumbnail' => config('app.url') . '/img/pixelfed-icon-color.png', 'thumbnail' => config('app.url') . '/img/pixelfed-icon-color.png',
'title' => config('app.name'), 'title' => config_cache('app.name'),
'uri' => config('pixelfed.domain.app'), 'uri' => config('pixelfed.domain.app'),
'urls' => [], 'urls' => [],
'version' => '2.7.2 (compatible; Pixelfed ' . config('pixelfed.version') . ')', 'version' => '2.7.2 (compatible; Pixelfed ' . config('pixelfed.version') . ')',

View file

@ -34,7 +34,7 @@ class InstanceApiController extends Controller {
$res = [ $res = [
'uri' => config('pixelfed.domain.app'), 'uri' => config('pixelfed.domain.app'),
'title' => config('app.name'), 'title' => config_cache('app.name'),
'description' => '', 'description' => '',
'version' => config('pixelfed.version'), 'version' => config('pixelfed.version'),
'urls' => [], 'urls' => [],

View file

@ -8,7 +8,7 @@ use Illuminate\Support\Str;
class Config { class Config {
public static function get() { public static function get() {
return Cache::remember('api:site:configuration:_v0.2', now()->addHours(30), function() { return Cache::remember('api:site:configuration:_v0.2', now()->addMinutes(5), function() {
return [ return [
'open_registration' => config('pixelfed.open_registration'), 'open_registration' => config('pixelfed.open_registration'),
'uploader' => [ 'uploader' => [
@ -39,10 +39,10 @@ class Config {
], ],
'site' => [ 'site' => [
'name' => config('app.name', 'pixelfed'), 'name' => config_cache('app.name'),
'domain' => config('pixelfed.domain.app'), 'domain' => config('pixelfed.domain.app'),
'url' => config('app.url'), 'url' => config('app.url'),
'description' => config('instance.description') 'description' => config_cache('app.short_description')
], ],
'username' => [ 'username' => [

View file

@ -10,68 +10,68 @@ class Nodeinfo {
public static function get() public static function get()
{ {
$res = Cache::remember('api:nodeinfo', now()->addMinutes(15), function () { $res = Cache::remember('api:nodeinfo', now()->addMinutes(15), function () {
$activeHalfYear = Cache::remember('api:nodeinfo:ahy', now()->addHours(12), function() { $activeHalfYear = Cache::remember('api:nodeinfo:ahy', now()->addHours(12), function() {
// todo: replace with last_active_at after July 9, 2021 (96afc3e781) // todo: replace with last_active_at after July 9, 2021 (96afc3e781)
$count = collect([]); $count = collect([]);
$likes = Like::select('profile_id')->with('actor')->where('created_at', '>', now()->subMonths(6)->toDateTimeString())->groupBy('profile_id')->get()->filter(function($like) {return $like->actor && $like->actor->domain == null;})->pluck('profile_id')->toArray(); $likes = Like::select('profile_id')->with('actor')->where('created_at', '>', now()->subMonths(6)->toDateTimeString())->groupBy('profile_id')->get()->filter(function($like) {return $like->actor && $like->actor->domain == null;})->pluck('profile_id')->toArray();
$count = $count->merge($likes); $count = $count->merge($likes);
$statuses = Status::select('profile_id')->whereLocal(true)->where('created_at', '>', now()->subMonths(6)->toDateTimeString())->groupBy('profile_id')->pluck('profile_id')->toArray(); $statuses = Status::select('profile_id')->whereLocal(true)->where('created_at', '>', now()->subMonths(6)->toDateTimeString())->groupBy('profile_id')->pluck('profile_id')->toArray();
$count = $count->merge($statuses); $count = $count->merge($statuses);
$profiles = User::select('profile_id', 'last_active_at') $profiles = User::select('profile_id', 'last_active_at')
->whereNotNull('last_active_at') ->whereNotNull('last_active_at')
->where('last_active_at', '>', now()->subMonths(6)) ->where('last_active_at', '>', now()->subMonths(6))
->pluck('profile_id') ->pluck('profile_id')
->toArray(); ->toArray();
$newProfiles = User::select('profile_id', 'last_active_at', 'created_at') $newProfiles = User::select('profile_id', 'last_active_at', 'created_at')
->whereNull('last_active_at') ->whereNull('last_active_at')
->where('created_at', '>', now()->subMonths(6)) ->where('created_at', '>', now()->subMonths(6))
->pluck('profile_id') ->pluck('profile_id')
->toArray(); ->toArray();
$count = $count->merge($newProfiles); $count = $count->merge($newProfiles);
$count = $count->merge($profiles); $count = $count->merge($profiles);
return $count->unique()->count(); return $count->unique()->count();
}); });
$activeMonth = Cache::remember('api:nodeinfo:am', now()->addHours(2), function() { $activeMonth = Cache::remember('api:nodeinfo:am', now()->addHours(2), function() {
return User::select('last_active_at') return User::select('last_active_at')
->where('last_active_at', '>', now()->subMonths(1)) ->where('last_active_at', '>', now()->subMonths(1))
->orWhere('created_at', '>', now()->subMonths(1)) ->orWhere('created_at', '>', now()->subMonths(1))
->count(); ->count();
}); });
return [ return [
'metadata' => [ 'metadata' => [
'nodeName' => config('pixelfed.domain.app'), 'nodeName' => config_cache('app.name'),
'software' => [ 'software' => [
'homepage' => 'https://pixelfed.org', 'homepage' => 'https://pixelfed.org',
'repo' => 'https://github.com/pixelfed/pixelfed', 'repo' => 'https://github.com/pixelfed/pixelfed',
], ],
'config' => \App\Util\Site\Config::get() 'config' => \App\Util\Site\Config::get()
], ],
'protocols' => [ 'protocols' => [
'activitypub', 'activitypub',
], ],
'services' => [ 'services' => [
'inbound' => [], 'inbound' => [],
'outbound' => [], 'outbound' => [],
], ],
'software' => [ 'software' => [
'name' => 'pixelfed', 'name' => 'pixelfed',
'version' => config('pixelfed.version'), 'version' => config('pixelfed.version'),
], ],
'usage' => [ 'usage' => [
'localPosts' => Status::whereLocal(true)->count(), 'localPosts' => Status::whereLocal(true)->count(),
'localComments' => 0, 'localComments' => 0,
'users' => [ 'users' => [
'total' => User::count(), 'total' => User::count(),
'activeHalfyear' => (int) $activeHalfYear, 'activeHalfyear' => (int) $activeHalfYear,
'activeMonth' => (int) $activeMonth, 'activeMonth' => (int) $activeMonth,
], ],
], ],
'version' => '2.0', 'version' => '2.0',
]; ];
}); });
$res['openRegistrations'] = config('pixelfed.open_registration'); $res['openRegistrations'] = config('pixelfed.open_registration');
return $res; return $res;
} }
public static function wellKnown() public static function wellKnown()
@ -86,4 +86,4 @@ class Nodeinfo {
]; ];
} }
} }

View file

@ -1,7 +1,7 @@
<!DOCTYPE html> <!DOCTYPE html>
<html lang="{{ app()->getLocale() }}"> <html lang="{{ app()->getLocale() }}">
<head> <head>
<meta charset="utf-8"> <meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge"> <meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1"> <meta name="viewport" content="width=device-width, initial-scale=1">
@ -9,10 +9,10 @@
<meta name="robots" content="noimageindex, noarchive"> <meta name="robots" content="noimageindex, noarchive">
<meta name="mobile-web-app-capable" content="yes"> <meta name="mobile-web-app-capable" content="yes">
<title>{{ $title ?? config('app.name', 'Laravel') }}</title> <title>{{ $title ?? config_cache('app.name') }}</title>
@if(isset($title))<meta property="og:site_name" content="{{ config('app.name', 'Laravel') }}"> @if(isset($title))<meta property="og:site_name" content="{{ config_cache('app.name') }}">
<meta property="og:title" content="{{ $title ?? config('app.name', 'Laravel') }}"> <meta property="og:title" content="{{ $title ?? config_cache('app.name') }}">
<meta property="og:type" content="article"> <meta property="og:type" content="article">
<meta property="og:url" content="{{request()->url()}}"> <meta property="og:url" content="{{request()->url()}}">
@endif @endif

View file

@ -1,49 +1,49 @@
<!DOCTYPE html> <!DOCTYPE html>
<html lang="{{ app()->getLocale() }}"> <html lang="{{ app()->getLocale() }}">
<head> <head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta name="csrf-token" content="{{ csrf_token() }}">
<meta name="mobile-web-app-capable" content="yes"> <meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta name="csrf-token" content="{{ csrf_token() }}">
<title>{{ $title ?? config('app.name', 'Laravel') }}</title> <meta name="mobile-web-app-capable" content="yes">
<meta property="og:site_name" content="{{ config('app.name', 'pixelfed') }}"> <title>{{ $title ?? config_cache('app.name') }}</title>
<meta property="og:title" content="{{ $title ?? config('app.name', 'pixelfed') }}">
<meta property="og:type" content="article">
<meta property="og:url" content="{{request()->url()}}">
@stack('meta')
<meta name="medium" content="image"> <meta property="og:site_name" content="{{ config('app.name', 'pixelfed') }}">
<meta name="theme-color" content="#10c5f8"> <meta property="og:title" content="{{ $title ?? config('app.name', 'pixelfed') }}">
<meta name="apple-mobile-web-app-capable" content="yes"> <meta property="og:type" content="article">
<link rel="shortcut icon" type="image/png" href="/img/favicon.png?v=2"> <meta property="og:url" content="{{request()->url()}}">
<link rel="apple-touch-icon" type="image/png" href="/img/favicon.png?v=2"> @stack('meta')
<link rel="canonical" href="{{request()->url()}}">
@if(request()->cookie('dark-mode'))
<link href="{{ mix('css/appdark.css') }}" rel="stylesheet" data-stylesheet="dark">
@else
<link href="{{ mix('css/app.css') }}" rel="stylesheet" data-stylesheet="light">
@endif
@stack('styles')
<script type="text/javascript">window._sharedData = {curUser: {}, version: 0}; window.App = {config: {!!App\Util\Site\Config::json()!!}};</script> <meta name="medium" content="image">
<meta name="theme-color" content="#10c5f8">
<meta name="apple-mobile-web-app-capable" content="yes">
<link rel="shortcut icon" type="image/png" href="/img/favicon.png?v=2">
<link rel="apple-touch-icon" type="image/png" href="/img/favicon.png?v=2">
<link rel="canonical" href="{{request()->url()}}">
@if(request()->cookie('dark-mode'))
<link href="{{ mix('css/appdark.css') }}" rel="stylesheet" data-stylesheet="dark">
@else
<link href="{{ mix('css/app.css') }}" rel="stylesheet" data-stylesheet="light">
@endif
@stack('styles')
<script type="text/javascript">window._sharedData = {curUser: {}, version: 0}; window.App = {config: {!!App\Util\Site\Config::json()!!}};</script>
</head> </head>
<body class="w-100 h-100"> <body class="w-100 h-100">
<main id="content" class="w-100 h-100"> <main id="content" class="w-100 h-100">
@yield('content') @yield('content')
</main> </main>
<script type="text/javascript" src="{{ mix('js/manifest.js') }}"></script> <script type="text/javascript" src="{{ mix('js/manifest.js') }}"></script>
<script type="text/javascript" src="{{ mix('js/vendor.js') }}"></script> <script type="text/javascript" src="{{ mix('js/vendor.js') }}"></script>
<script type="text/javascript" src="{{ mix('js/app.js') }}"></script> <script type="text/javascript" src="{{ mix('js/app.js') }}"></script>
<script type="text/javascript" src="{{ mix('js/components.js') }}"></script> <script type="text/javascript" src="{{ mix('js/components.js') }}"></script>
@stack('scripts') @stack('scripts')
</body> </body>
</html> </html>

View file

@ -2,7 +2,7 @@
<div class="container"> <div class="container">
<a class="navbar-brand d-flex align-items-center" href="{{ route('timeline.personal') }}" title="Logo"> <a class="navbar-brand d-flex align-items-center" href="{{ route('timeline.personal') }}" title="Logo">
<img src="/img/pixelfed-icon-color.svg" height="30px" class="px-2" loading="eager" alt="Pixelfed logo"> <img src="/img/pixelfed-icon-color.svg" height="30px" class="px-2" loading="eager" alt="Pixelfed logo">
<span class="font-weight-bold mb-0 d-none d-sm-block" style="font-size:20px;">{{ config('app.name', 'pixelfed') }}</span> <span class="font-weight-bold mb-0 d-none d-sm-block" style="font-size:20px;">{{ config_cache('app.name') }}</span>
</a> </a>
<div class="collapse navbar-collapse"> <div class="collapse navbar-collapse">

View file

@ -1,4 +1,4 @@
@extends('layouts.anon',['title' => 'About ' . config('app.name')]) @extends('layouts.anon',['title' => 'About ' . config_cache('app.name')])
@section('content') @section('content')