Flynntes / Sleeky

🎨 A sleek and simple frontend & backend theme for YOURLS
http://sleeky.flynntes.com
MIT License
473 stars 102 forks source link

Some URLs are broken #104

Open AlphaJack opened 2 years ago

AlphaJack commented 2 years ago

I have noticed that some URLs are broken at the moment:

Main CSS

As per #91, frontend/header.php contains

<link rel="stylesheet" href="<?php echo $YOURLS_SITE ?>/frontend/dist/styles.css">

But somehow $YOURLS_SITE is empty so the final URL is /frontend/dist/styles.css.

If I change it to YOURLS_SITE, I get the error 500 with the following text:

2022/01/27 00:38:04 [error] 9851#9851: *24768 FastCGI sent in stderr: "PHP message: PHP Fatal error:  Uncaught Error: Undefined constant "YOURLS_SITE" in /usr/share/webapps/yourls/frontend/header.php:15
Stack trace:
#0 /usr/share/webapps/yourls/index.php(1): include()
#1 {main}
  thrown in /usr/share/webapps/yourls/frontend/header.php on line 15" while reading response header from upstream, client: 192.168.1.1, server: example.org, request: "GET /yourls/ HTTP/2.0", upstream: "fastcgi://unix:/run/php-fpm/php-fpm.sock:", host: "example.org"

However, if I hardcode the website URL also inf frontend/config.php

define('YOURLS_SITE', 'https://example.org/yourls');

I can view the CSS file but I get the following warning:

2022/01/27 00:46:51 [error] 9851#9851: *24773 FastCGI sent in stderr: "PHP message: PHP Warning:  Constant YOURLS_SITE already defined in /etc/webapps/yourls/config.php on line 40" while reading response header from upstream, client: 192.168.1.1, server: example.org, request: "GET /yourls/ HTTP/2.0", upstream: "fastcgi://unix:/run/php-fpm/php-fpm.sock:", host: "example.org"

Logo image

index.php

Unlike the icon URL, the logo URL is generating prepending YOURLS_SITE to the path specified for the image. This breaks if the image is outslde YOURLS folder:


<img src="https://example.org/yourlshttps://example.org/logo.png" alt="Logo" width="95px" class="mt-n5">```
SophiaAtkinson commented 2 years ago

to fix this remove echo from <?php echo $YOURLS_SITE ?>/frontend/dist/styles.css"> so it should be this <?php $YOURLS_SITE ?>/frontend/dist/styles.css"> I had this same problem and this fixed the issue.