feat(header): add base_url to logo link

* Also made some cleanup and style fixing
This commit is contained in:
eapl.mx 2024-12-18 16:45:05 -06:00
parent d13e72d11c
commit 79f43372f7
No known key found for this signature in database
2 changed files with 20 additions and 23 deletions

View file

@ -1,5 +1,6 @@
<?php <?php
# Shows the timeline for a user # Shows the timeline for a user
declare (strict_types = 1); declare (strict_types = 1);
# Parameters # Parameters
@ -15,7 +16,6 @@ declare (strict_types = 1);
# If page is higher than N, shows nothing # If page is higher than N, shows nothing
# #
# hash(string) = # hash(string) =
#
require_once('libs/session.php'); require_once('libs/session.php');
require_once('libs/twtxt.php'); require_once('libs/twtxt.php');
@ -36,13 +36,12 @@ if (isset($config['site_title'])) {
} }
// HACKED by sp@darch.dk // HACKED by sp@darch.dk
if(!empty($_GET['list'])) { if(!empty($_GET['list'])) {
$url = $baseURL.$_GET['list']; $url = $baseURL.$_GET['list'];
//$url = "https://darch.dk/".$_GET['list']; }
} else {
else { $url = $config['public_txt_url'];
$url = $config['public_txt_url']; }
}
/* /*
if(isset($_GET['selectList'])){ if(isset($_GET['selectList'])){
@ -93,12 +92,10 @@ if (!empty($_GET['url'])) { // Show profile for some user
*/ */
if (!empty($twtsURL)) { if (!empty($twtsURL)) {
$parsedTwtxtFile = getTwtsFromTwtxtString($twtsURL); $parsedTwtxtFile = getTwtsFromTwtxtString($twtsURL);
if (!is_null($parsedTwtxtFile)) { if (!is_null($parsedTwtxtFile)) {
$parsedTwtxtFiles[$parsedTwtxtFile->mainURL] = $parsedTwtxtFile; $parsedTwtxtFiles[$parsedTwtxtFile->mainURL] = $parsedTwtxtFile;
} }
} else { // Show timeline for the URL } else { // Show timeline for the URL
$parsedTwtxtFiles = []; $parsedTwtxtFiles = [];
foreach ($fileLines as $currentLine) { foreach ($fileLines as $currentLine) {
@ -141,7 +138,7 @@ if (!empty($_GET['search'])) {
$twts = array_filter($twts, function ($twt) use ($pattern) { $twts = array_filter($twts, function ($twt) use ($pattern) {
return preg_match($pattern, $twt->content); return preg_match($pattern, $twt->content);
}); });
} }
*/ */
// TODO: (re)move or rename `?hash=` to something/where else? // TODO: (re)move or rename `?hash=` to something/where else?

View file

@ -1,9 +1,8 @@
<?php <?php
$profile = getTwtsFromTwtxtString($config['public_txt_url']); $profile = getTwtsFromTwtxtString($config['public_txt_url']);
?> ?>
<!doctype html> <!doctype html>
<html> <html>
<head> <head>
@ -12,8 +11,7 @@ $profile = getTwtsFromTwtxtString($config['public_txt_url']);
<link rel="icon" type="image/x-icon" href="<?= $baseURL ?>/media/logo.png"> <link rel="icon" type="image/x-icon" href="<?= $baseURL ?>/media/logo.png">
<?php if( isset($_SESSION['password'])) { ?> <?php if( isset($_SESSION['password'])) { ?>
<script src="<?= $baseURL ?>/libs/tiny-mde.min.js"></script> <script src="<?= $baseURL ?>/libs/tiny-mde.min.js"></script>
<!-- <link rel="stylesheet" type="text/css" href="<?= $baseURL ?>/libs/tiny-mde.min.css" /> --> <link rel="stylesheet" type="text/css" href="<?= $baseURL ?>/libs/tiny-mde.css" />
<link rel="stylesheet" type="text/css" href="<?= $baseURL ?>/libs/tiny-mde.css" />
<?php } ?> <?php } ?>
<link rel="stylesheet" type="text/css" href="<?= $baseURL ?>/libs/simple.css"> <link rel="stylesheet" type="text/css" href="<?= $baseURL ?>/libs/simple.css">
<link rel="stylesheet" type="text/css" href="<?= $baseURL ?>/libs/timeline.css"> <link rel="stylesheet" type="text/css" href="<?= $baseURL ?>/libs/timeline.css">
@ -26,31 +24,33 @@ $profile = getTwtsFromTwtxtString($config['public_txt_url']);
<header> <header>
<p> <p>
<a href="/"> <a href="<?= $baseURL ?>">
<img class="logo" src="<?= $baseURL ?>/media/logo.png"> <img class="logo" src="<?= $baseURL ?>/media/logo.png">
<?= $config['site_title']; ?> <?= $config['site_title']; ?>
</a> </a>
<!-- <a href="/"> <!--
<a href="/">
<img class="logo" src="<?= $profile->avatar ?>" alt="" loading="lazy"> <img class="logo" src="<?= $profile->avatar ?>" alt="" loading="lazy">
<?= parse_url($profile->mainURL, PHP_URL_HOST); ?> <?= parse_url($profile->mainURL, PHP_URL_HOST); ?>
</a> </a>
<a href="/"> <a href="/">
<img class="logo" src="<?= $profile->avatar ?>" alt="" loading="lazy"> <img class="logo" src="<?= $profile->avatar ?>" alt="" loading="lazy">
<?= $profile->nick ?>@<?= parse_url($profile->mainURL, PHP_URL_HOST); ?> <?= $profile->nick ?>@<?= parse_url($profile->mainURL, PHP_URL_HOST); ?>
</a> --> </a>
</p> -->
</p>
<nav> <nav>
<ul class="secondary"> <ul class="secondary">
<?php //if ($validSession) { // TODO: Make login seqcure ?> <?php //if ($validSession) { // TODO: Make login secure ?>
<?php if( isset($_SESSION['password'])) { /* <?php if( isset($_SESSION['password'])) { /*
if($_SESSION['password']=="$password") {*/ // Hacky login ?> if($_SESSION['password']=="$password") {*/ // Hacky login ?>
<li><a href="<?= $baseURL ?>/refresh?url=<?= $url ?>"><i class="fa fa-refresh"></i><span>Refresh</span></a></li> <li><a href="<?= $baseURL ?>/refresh?url=<?= $url ?>"><i class="fa fa-refresh"></i><span>Refresh</span></a></li>
<li><a href="<?= $baseURL ?>"><i class="fa fa-comments-o"></i><span>Timeline</span></a></li> <li><a href="<?= $baseURL ?>"><i class="fa fa-comments-o"></i><span>Timeline</span></a></li>
<?php if (!empty($config['public_webmentions'])) { ?> <?php if (!empty($config['public_webmentions'])) { ?>
<li><a href="<?= $baseURL ?>/profile?url=<?= $config['public_webmentions'] ?>"><i class="fa fa-at"></i><span>Mentions</span></a></li> <li><a href="<?= $baseURL ?>/profile?url=<?= $config['public_webmentions'] ?>"><i class="fa fa-at"></i><span>Mentions</span></a></li>
<?php } ?> <?php } ?>
<li><a href="<?= $baseURL ?>/profile"><i class="fa fa-user-circle"></i><span>Profile</span></a></li> <li><a href="<?= $baseURL ?>/profile"><i class="fa fa-user-circle"></i><span>Profile</span></a></li>
<li><a href="<?= $baseURL ?>/gallery?url=<?= $config['public_txt_url'] ?>"><i class="fa fa-picture-o"></i><span>Gallery</span></a></li> <li><a href="<?= $baseURL ?>/gallery?url=<?= $config['public_txt_url'] ?>"><i class="fa fa-picture-o"></i><span>Gallery</span></a></li>
<li><a href="<?= $baseURL ?>/following"><i class="fa fa-users"></i><span>Following <?php // echo count($twtFollowingList); ?></span></a></li> <li><a href="<?= $baseURL ?>/following"><i class="fa fa-users"></i><span>Following <?php // echo count($twtFollowingList); ?></span></a></li>
<li><a href="<?= $baseURL ?>/add"><i class="fa fa-user-plus"></i><span>Add feed</span></a></li> <li><a href="<?= $baseURL ?>/add"><i class="fa fa-user-plus"></i><span>Add feed</span></a></li>