Add Open Graph protocol support

This commit is contained in:
Macintxsh 2024-09-23 15:23:16 +03:00
parent fabe40da8c
commit caf4807894
Signed by: mctaylors
GPG key ID: 4EEF4F949A266EE2
2 changed files with 41 additions and 22 deletions

View file

@ -1,26 +1,39 @@
<?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 Preview"/>
<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">
<span class="title">' . str_replace($filtered_request, '', $file) . '</span> <span class="title">' . str_replace($filtered_request, '', $file) . '</span>
</div> </div>
</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,20 +1,26 @@
<!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 Preview"/>
<meta property="og:description" content="Splatunes Network</a> Preview, exists because it wants to. ©"/>
</head> </head>
<body> <body>
<?php <?php
foreach(glob('[!assets]*', GLOB_ONLYDIR) as $dir) { foreach (glob('[!assets]*', GLOB_ONLYDIR) as $dir) {
echo '<a class="card" href="'. $dir .'"> echo '<a class="card" href="' . $dir . '">
<img src="/'. $dir .'/artwork.jpg" alt="" /> <img src="/' . $dir . '/artwork.jpg" alt="" />
<div class="content">'. $dir .'</div> <div class="content">' . $dir . '</div>
</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>