Add Open Graph protocol support

This commit is contained in:
Macintxsh 2024-09-23 15:19:12 +03:00
parent fabe40da8c
commit b371b6e201
2 changed files with 41 additions and 22 deletions

View file

@ -1,18 +1,29 @@
<?php
$filtered_request = urldecode(strtok(substr($_SERVER['REQUEST_URI'], 1), '?'));
$files = glob($filtered_request . '*.mp3');
$count = count($files);
$artist = substr(urldecode($_SERVER['REQUEST_URI']), 1, -1);
?>
<!DOCTYPE html> <!DOCTYPE html>
<html lang=""> <html lang="en">
<head> <head>
<link rel="stylesheet" href="/assets/common.css"/> <link rel="stylesheet" href="/assets/common.css"/>
<link rel="stylesheet" href="/assets/index.css"/> <link rel="stylesheet" href="/assets/index.css"/>
<title>Splatunes Network Preview</title> <title>Splatunes Network Preview</title>
<meta name="viewport" content="initial-scale=0.75 user-scalable=no"/> <meta name="viewport" content="initial-scale=0.75 user-scalable=no"/>
<meta property="og:title" content="<?php echo $artist ?>"/>
<meta property="og:site_name" content="Splatunes Network"/>
<meta property="og:description"
content="<?php echo "Listen to " . $count . " tracks by " . $artist . " on Splatunes Network." ?>"/>
<meta property="og:image" content="<?php echo "/" . $artist . "/artwork.jpg" ?>"/>
</head> </head>
<body> <body>
<a class="card" href=".."> <a class="card" href="..">
<img src="/assets/svg/arrow_back.svg" alt="" class="svg button"/> <img src="/assets/svg/arrow_back.svg" alt="" class="svg button"/>
</a> </a>
<?php <?php
$filtered_request = urldecode(strtok(substr($_SERVER['REQUEST_URI'], 1), '?')); foreach ($files as $file) {
foreach(glob($filtered_request . '*.mp3') as $file) {
echo '<a class="card" href="/' . $file . '"> echo '<a class="card" href="/' . $file . '">
<img src="artwork.jpg" alt="" /> <img src="artwork.jpg" alt="" />
<div class="content"> <div class="content">
@ -21,6 +32,8 @@ foreach(glob($filtered_request . '*.mp3') as $file) {
</a>'; </a>';
} }
?> ?>
<div class="footer"><a href="https://git.mctaylors.ru/mctaylors/SplatunesNetwork">Splatunes Network</a> Preview, exists because it wants to. ©</div> <div class="footer"><a href="https://git.mctaylors.ru/mctaylors/SplatunesNetwork">Splatunes Network</a> Preview, exists
because it wants to. ©
</div>
</body> </body>
</html> </html>

View file

@ -1,10 +1,14 @@
<!DOCTYPE html> <!DOCTYPE html>
<html lang=""> <html lang="en">
<head> <head>
<link rel="stylesheet" href="/assets/common.css"/> <link rel="stylesheet" href="/assets/common.css"/>
<link rel="stylesheet" href="/assets/root.css"/> <link rel="stylesheet" href="/assets/root.css"/>
<title>Splatunes Network Preview</title> <title>Splatunes Network Preview</title>
<meta name="viewport" content="initial-scale=0.75 user-scalable=no"/> <meta name="viewport" content="initial-scale=0.75 user-scalable=no"/>
<meta property="og:title" content="Home"/>
<meta property="og:site_name" content="Splatunes Network"/>
<meta property="og:description" content="Splatunes Network</a> Preview, exists because it wants to. ©"/>
</head> </head>
<body> <body>
<?php <?php
@ -15,6 +19,8 @@ foreach(glob('[!assets]*', GLOB_ONLYDIR) as $dir) {
</a>'; </a>';
} }
?> ?>
<div class="footer"><a href="https://git.mctaylors.ru/mctaylors/SplatunesNetwork">Splatunes Network</a> Preview, exists because it wants to. ©</div> <div class="footer"><a href="https://git.mctaylors.ru/mctaylors/SplatunesNetwork">Splatunes Network</a> Preview, exists
because it wants to. ©
</div>
</body> </body>
</html> </html>