removed TODO about webmentions

This commit is contained in:
sørenpeter 2024-12-25 14:18:04 +01:00
commit e34e18b718
6 changed files with 52 additions and 61 deletions

View file

@ -1,5 +1,6 @@
<?php
# Shows the timeline for a user
declare (strict_types = 1);
# Parameters
@ -15,7 +16,6 @@ declare (strict_types = 1);
# If page is higher than N, shows nothing
#
# hash(string) =
#
require_once('libs/session.php');
require_once('libs/twtxt.php');
@ -38,7 +38,6 @@ if (isset($config['site_title'])) {
// HACKED by sp@darch.dk
if(!empty($_GET['list'])) {
$url = $baseURL.$_GET['list'];
//$url = "https://darch.dk/".$_GET['list'];
}
else {
$url = $config['public_txt_url'];
@ -93,12 +92,10 @@ if (!empty($_GET['url'])) { // Show profile for some user
*/
if (!empty($twtsURL)) {
$parsedTwtxtFile = getTwtsFromTwtxtString($twtsURL);
if (!is_null($parsedTwtxtFile)) {
$parsedTwtxtFiles[$parsedTwtxtFile->mainURL] = $parsedTwtxtFile;
}
} else { // Show timeline for the URL
$parsedTwtxtFiles = [];
foreach ($fileLines as $currentLine) {

View file

@ -3,7 +3,6 @@
$profile = getTwtsFromTwtxtString($config['public_txt_url']);
?>
<!doctype html>
<html>
<head>
@ -12,7 +11,6 @@ $profile = getTwtsFromTwtxtString($config['public_txt_url']);
<link rel="icon" type="image/x-icon" href="<?= $baseURL ?>/media/logo.png">
<?php if( isset($_SESSION['password'])) { ?>
<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" />
<?php } ?>
<link rel="stylesheet" type="text/css" href="<?= $baseURL ?>/libs/simple.css">
@ -26,23 +24,25 @@ $profile = getTwtsFromTwtxtString($config['public_txt_url']);
<header>
<p>
<a href="/">
<a href="<?= $baseURL ?>">
<img class="logo" src="<?= $baseURL ?>/media/logo.png">
<?= $config['site_title']; ?>
</a>
<!-- <a href="/">
<!--
<a href="/">
<img class="logo" src="<?= $profile->avatar ?>" alt="" loading="lazy">
<?= parse_url($profile->mainURL, PHP_URL_HOST); ?>
</a>
<a href="/">
<img class="logo" src="<?= $profile->avatar ?>" alt="" loading="lazy">
<?= $profile->nick ?>@<?= parse_url($profile->mainURL, PHP_URL_HOST); ?>
</a> -->
</a>
-->
</p>
<nav>
<ul class="secondary">
<?php //if ($validSession) { // TODO: Make login seqcure ?>
<?php //if ($validSession) { // TODO: Make login secure ?>
<?php if( isset($_SESSION['password'])) { /*
if($_SESSION['password']=="$password") {*/ // Hacky login ?>
<li><a href="<?= $baseURL ?>/refresh?url=<?= $url ?>"><i class="fa fa-refresh"></i><span>Refresh</span></a></li>

View file

@ -15,6 +15,7 @@ $wf_acct = "";
$wf_nick = "";
$wf_url = "";
$wf_error = "";
$wf_request = "";
if(isset($_POST['submit'])) {
$wf_request = $_POST["webfinger"];

View file

@ -1,4 +1,5 @@
<?php
require_once "libs/twtxt.php";
// Send webmentions
$new_mentions = getMentionsFromTwt($twt);

View file

@ -2,7 +2,6 @@
// TODO: Give a warning if the file is not found
$config = parse_ini_file('private/config.ini');
if ($config['debug_mode']) {
ini_set('display_errors', 1);
ini_set('display_startup_errors', 1);
@ -13,19 +12,13 @@ $txt_file_path = $config['txt_file_path'];
$public_txt_url = $config['public_txt_url'];
$timezone = $config['timezone'];
require_once('libs/session.php');
// if (!has_valid_session()) {
// header('Location: /login.php');
// exit();
// }
require_once 'libs/session.php';
if (!isset($_SESSION['password'])) {
header('Location: ./login');
exit();
}
if (isset($_POST['submit'])) {
$new_post = filter_input(INPUT_POST, 'new_post');
$new_post = trim($new_post);
@ -91,11 +84,10 @@ if (isset($_POST['submit'])) {
//exit;
} else {
require_once("partials/base.php");
require_once "partials/base.php";
$title = "New post - ".$title;
include_once 'partials/header.php';
if (!isset($textareaValue)) {
$textareaValue = '';
}
@ -117,7 +109,6 @@ if (isset($_GET['hash'])) {
include_once 'partials/timeline.php';
}
?>
<article id="new_twt">

View file

@ -5,12 +5,13 @@
// Set path to your mentions twtxt file:
//$logfile = './mentions.txt'; /* Make sure file is writeable */
$config = parse_ini_file('private/config.ini');
$logfile = $config['webmentions_txt_path'];
if (!isset($_POST['source']) || !isset($_POST['target'])) {
print('Please send a propper webmention to this endpoint');
header($_SERVER['SERVER_PROTOCOL'] . ' 400 Bad Request');
print('Please send a propper webmention to this endpoint');
exit;
}