Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Problems installing Timeline #18

Open
eapl-gemugami opened this issue Dec 5, 2024 · 17 comments
Open

Problems installing Timeline #18

eapl-gemugami opened this issue Dec 5, 2024 · 17 comments
Labels
bug Something isn't working

Comments

@eapl-gemugami
Copy link
Collaborator

I created a Timeline sandbox (WIP) here, to run some tests:
https://twtxt-sandbox.eapl.me/timeline/
https://twtxt-sandbox.eapl.me/twtxt.txt

Password: sandbox and then 12345
(Could be changed and shared somewhere else if it's risky)

I'm cloning the repo (to get the latest main) with the command

git clone https://github.com/sorenpeter/timeline.git

And then following the steps as found in https://github.com/sorenpeter/timeline?tab=readme-ov-file#-installation-and-setup

I added this line to .htaccess although I have to check if that's still needed (or perhaps it is causing more errors)

RewriteBase /timeline

The debug mode is enabled to watch warning and errors.

1. private/cache folder is missing

As empty folders are not saved on Git, a dummy file will be required for the folder to be created when pulling.
Had to create that folder manually to remove an error on first refresh.

2. Undefined 'url' key stops redirecting on main URL

URL: https://twtxt-sandbox.eapl.me/timeline/
image

To join the site, I had to use another URL such as https://twtxt-sandbox.eapl.me/timeline/profile

Redirects should be done before the HTML content is output. The warning is stopping the redirect to work.

3. Log in gives a header error on redirect

image

Redirects should be done before the HTML content is output, so I think some template code is running before the redirect.

@sorenpeter
Copy link
Owner

Great and yes, we should change the password;)

  1. Depending on your setup I'm not sure you need the RewriteBase rule... If you want to have any visitor to the root of your domain being forwarded to timeline, then you should simple put the files in the root and have a DirectoryIndex index.html index.php

  2. Yes we need to add a .gitkeep file in private/cache

  3. It says in the Readme "Edit your twtxt.txt and config.ini with the correct path" which should fix the URL error

  4. Not sure what happens here. It might be related to the .htaccess Rewrite rules aboube

@eapl-gemugami
Copy link
Collaborator Author

eapl-gemugami commented Dec 6, 2024

-1. My idea was to have a 'public' sandbox which could auto-restore the twtxt.txt file every X hours so the public can try it before installing

  1. I think I changed that due to the ./php-server.sh not working right, but I'll have to check again in both environments.

  2. Cool, do you want to do it? Otherwise I could push it, perhaps during the weekend

  3. Here right?
    https://github.com/sorenpeter/timeline/blob/main/views/home.php#L27
    I think $config['public_txt_url'] is set correctly, but I'll double-check

  4. Same as 0

@sorenpeter
Copy link
Owner

-1. Ah, I see also

  1. I already did it with the VERSION commit I just made

  2. The user shoud only need to edit the twtxt.txt with the URL path for this to work

@sorenpeter
Copy link
Owner

Hmm looking at my error_log I now notice
[06-Dec-2024 16:35:38 UTC] PHP Warning: Undefined array key "url" in /home/XXXXX/public_html/timeline/views/home.php on line 27

@eapl-gemugami
Copy link
Collaborator Author

  1. The user shoud only need to edit the twtxt.txt with the URL path for this to work

Oh, I see it now it was wrong, thanks!

#         url = http://example.net/twtxt.txt

I'm thinking of having a startup.php or something which checks for basic settings in the first run.

@sorenpeter
Copy link
Owner

anything http://example.net/ is still wrong, since that is not where your twtxt.txt lives ;)

I have also had the idea of a setup.php, but so much other that i wanted to implement first.

I also want to make a docker image, so we can have timeline on https://www.pikapods.com and similar services.

@eapl-gemugami
Copy link
Collaborator Author

eapl-gemugami commented Dec 6, 2024

Personally I'm not a big fan of docker images, I think they make the process a bit more complex and it's not so friendly with shared Hosting. I'm not against it, although I think that for PHP is not that necessary.

That said, a Single-click install is a great idea. I don't know about pikapods, but it seems to be something similar.

For example I used the following on Ionos Shared Hosting to install a Wordpress blog:
https://www.ionos.com/help/hosting/click-build-applications/frequently-asked-questions-about-click-build-applications/
https://www.ionos.com/help/hosting/click-build-applications/overview-of-applications/

@eapl-gemugami
Copy link
Collaborator Author

With the default .htaccess it doesn't seem to work

RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php [NC,L]

Also config.ini looks OK to me:

txt_file_path = "../twtxt.txt"
public_txt_url = "https://twtxt-sandbox.eapl.me/twtxt.txt"

https://twtxt-sandbox.eapl.me/timeline/ <- Looking here
https://twtxt-sandbox.eapl.me/timeline/profile/ <- Or there

Any clues?

@sorenpeter
Copy link
Owner

anything in error_log ?

@eapl-gemugami
Copy link
Collaborator Author

I can't find an error_log, I think I'll have to enable it manually
https://www.ionos.com/help/hosting/troubleshooting-for-php/enabling-error-logs/

@aelaraji
Copy link
Contributor

aelaraji commented Dec 8, 2024

Hmm looking at my error_log I now notice [06-Dec-2024 16:35:38 UTC] PHP Warning: Undefined array key "url" in /home/XXXXX/public_html/timeline/views/home.php on line 27

I'm not sure if this is of any help or even if it's the correct way, but I got this one fixed with this modification:

diff --git a/views/home.php b/views/home.php
index e9cda6a..126992e 100644
--- a/views/home.php
+++ b/views/home.php
@@ -24,9 +24,11 @@ $title = "Timeline for ".$title;

 // Redirect guests to Profile view, if url not set til home twtxt.txt

-if (!isset($_SESSION['password']) && ($_GET['url'] != $config['public_txt_url']) ) {
-    header('Location: ./profile');
-    exit();
+if (!isset($_SESSION['password']) && (isset($_GET['url']))) {
+       if ($_GET['url'] != $config['public_txt_url']) {
+               header('Location: ./profile');
+               exit();
+       }
 }

 include_once 'partials/header.php';
@@ -43,4 +45,4 @@ if (isset($_SESSION['password'])) {

 include_once 'partials/timeline.php';

-include_once 'partials/footer.php';
\ No newline at end of file
+include_once 'partials/footer.php';

@sorenpeter
Copy link
Owner

@aelaraji looks legit. Care to make a PR with it?

@aelaraji
Copy link
Contributor

aelaraji commented Dec 8, 2024

@sorenpeter sure!

@eapl-gemugami
Copy link
Collaborator Author

I've pulled the latest main here: https://twtxt-sandbox.eapl.me/timeline/

Thanks @aelaraji

@eapl-gemugami
Copy link
Collaborator Author

eapl-gemugami commented Dec 10, 2024

Oops, it seems the redirects are now broken: https://twtxt-sandbox.eapl.me/timeline/login

It seems RewriteBase /timeline is needed, at least for my server.

@sorenpeter
Copy link
Owner

I don't get how to log in with two passwords?!

@eapl-gemugami
Copy link
Collaborator Author

Just join them, first the word and then the numbers.

@eapl-gemugami eapl-gemugami added good first issue Good for newcomers bug Something isn't working and removed good first issue Good for newcomers labels Jan 3, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants