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,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>
<html lang="">
<html lang="en">
<head>
<link rel="stylesheet" href="/assets/common.css" />
<link rel="stylesheet" href="/assets/index.css" />
<link rel="stylesheet" href="/assets/common.css"/>
<link rel="stylesheet" href="/assets/index.css"/>
<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>
<body>
<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>
<?php
$filtered_request = urldecode(strtok(substr($_SERVER['REQUEST_URI'], 1), '?'));
foreach(glob($filtered_request . '*.mp3') as $file) {
foreach ($files as $file) {
echo '<a class="card" href="/' . $file . '">
<img src="artwork.jpg" alt="" />
<div class="content">
<span class="title">' . str_replace($filtered_request, '', $file) . '</span>
</div>
<img src="artwork.jpg" alt="" />
<div class="content">
<span class="title">' . str_replace($filtered_request, '', $file) . '</span>
</div>
</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>
</html>
</html>

View file

@ -1,20 +1,26 @@
<!DOCTYPE html>
<html lang="">
<html lang="en">
<head>
<link rel="stylesheet" href="/assets/common.css" />
<link rel="stylesheet" href="/assets/root.css" />
<link rel="stylesheet" href="/assets/common.css"/>
<link rel="stylesheet" href="/assets/root.css"/>
<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>
<body>
<?php
foreach(glob('[!assets]*', GLOB_ONLYDIR) as $dir) {
echo '<a class="card" href="'. $dir .'">
<img src="/'. $dir .'/artwork.jpg" alt="" />
<div class="content">'. $dir .'</div>
foreach (glob('[!assets]*', GLOB_ONLYDIR) as $dir) {
echo '<a class="card" href="' . $dir . '">
<img src="/' . $dir . '/artwork.jpg" alt="" />
<div class="content">' . $dir . '</div>
</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>
</html>