planiverse

A minimalist, no-JS front-end for Mastodon.
git clone https://git.mulligrubs.me/planiverse
Log | Files | Refs | README | LICENSE

commit d6b3c8eae1576a4412ec3d360559b04ae987e448
parent a765bb5552c0ae11b1ebedf6563345159cd6a082
Author: St John Karp <stjohn@fuzzjunket.com>
Date:   Sun,  7 Oct 2018 20:50:15 -0700

Implement basic account page

Created a new page to display account info. Just shows a link
to the user's home instance and their bio, plus indicators showing
whether the user is a bot and whether their account is locked.

Diffstat:
Aapp/Http/Controllers/AccountController.php | 26++++++++++++++++++++++++++
Mpublic/css/styles.css | 2+-
Aresources/views/account.blade.php | 34++++++++++++++++++++++++++++++++++
Mresources/views/event_info.blade.php | 2+-
Mroutes/web.php | 4++++
5 files changed, 66 insertions(+), 2 deletions(-)

diff --git a/app/Http/Controllers/AccountController.php b/app/Http/Controllers/AccountController.php @@ -0,0 +1,26 @@ +<?php + +namespace App\Http\Controllers; + +use App\Http\Controllers\Controller; +use Mastodon; +use Illuminate\Http\Request; + +class AccountController extends Controller +{ + public function view_account(Request $request, string $account_id) + { + $user = session('user'); + + $account = Mastodon::domain(env('MASTODON_DOMAIN')) + ->token($user->token) + ->get('/accounts/' . $account_id); + + $vars = [ + 'account' => $account, + 'mastodon_domain' => explode('//', env('MASTODON_DOMAIN'))[1] + ]; + + return view('account', $vars); + } +} diff --git a/public/css/styles.css b/public/css/styles.css @@ -50,7 +50,7 @@ article figure img, article video { max-width: 100%; } -article img.avatar { +img.avatar { max-width: 48px; } diff --git a/resources/views/account.blade.php b/resources/views/account.blade.php @@ -0,0 +1,34 @@ +<!doctype html> +<html lang="{{ app()->getLocale() }}"> + <head> + <meta charset="utf-8"> + <meta http-equiv="X-UA-Compatible" content="IE=edge"> + <meta name="viewport" content="width=device-width, initial-scale=1"> + + <title>{{ $mastodon_domain }} | {{ $account['acct'] }}</title> + + <link rel="stylesheet" href="{{ url('css/styles.css') }}" /> + </head> + <body> + <h1>{{ $mastodon_domain }} | {{ $account['acct'] }}</h1> + + @component('navigation') + @endcomponent + + <div> + <span class="account" title="{{ $account['acct'] }}"> + <a href="{{ $account['url'] }}"> + <img + src="{{ $account['avatar'] }}" + alt="{{ $account['acct'] }}" + class="avatar" + /> + {{ $account['display_name'] }} + @if ($account['bot'] ?? false) &#129302; @endif + @if ($account['locked']) &#128274; @endif + </a> + </span> + {!! $account['note'] !!} + </div> + </body> +</html> diff --git a/resources/views/event_info.blade.php b/resources/views/event_info.blade.php @@ -1,6 +1,6 @@ <aside> <span class="account" title="{{ $account['acct'] }}"> - <a href="{{ $account['url'] }}"> + <a href="{{ route('account', ['account_id' => $account['id']]) }}"> <img src="{{ $account['avatar'] }}" alt="{{ $account['acct'] }}" diff --git a/routes/web.php b/routes/web.php @@ -59,6 +59,10 @@ Route::get('/notifications', 'NotificationsController@get_notifications') ->name('notifications') ->middleware('authorize'); +Route::get('/account/{account_id}', 'AccountController@view_account') + ->name('account') + ->middleware('authorize'); + Route::get('/login', 'LoginController@login') ->name('login');