diff --git a/README.md b/README.md index d437109..bbb16ea 100644 --- a/README.md +++ b/README.md @@ -85,7 +85,6 @@ git checkout -b my-pr-branch-name + [ ] Comments + [ ] Settings + [ ] Public name - + [ ] Avatar + [ ] Downloads customization + [ ] Address Tracker + [ ] Web Seed @@ -108,8 +107,9 @@ git checkout -b my-pr-branch-name #### Components -* [Icons](https://icons.getbootstrap.com) +* [SVG icons](https://icons.getbootstrap.com) * [PHP Scrapper](https://github.com/medariox/scrapeer) +* [Identicon](https://github.com/dmester/jdenticon-php) #### Feedback diff --git a/composer.json b/composer.json index 1deb105..bd66f90 100644 --- a/composer.json +++ b/composer.json @@ -4,7 +4,8 @@ "type": "library", "require": { "php": "^8.1", - "yggverse/parser": ">=0.2.0" + "yggverse/parser": ">=0.2.0", + "jdenticon/jdenticon": "^1.0" }, "license": "MIT", "autoload": { diff --git a/src/public/action.php b/src/public/action.php index 8dcc207..66e7297 100644 --- a/src/public/action.php +++ b/src/public/action.php @@ -27,6 +27,56 @@ $response = (object) // Begin action request switch (isset($_GET['target']) ? urldecode($_GET['target']) : false) { + case 'profile': + + switch (isset($_GET['toggle']) ? $_GET['toggle'] : false) + { + case 'identicon': + + // Yggdrasil connections only + if (!preg_match(YGGDRASIL_URL_REGEX, $_SERVER['REMOTE_ADDR'])) + { + $response->success = false; + $response->message = _('Yggdrasil connection required for this action'); + } + + // Init session + else if (!$userId = $db->initUserId($_SERVER['REMOTE_ADDR'], USER_DEFAULT_APPROVED, time())) + { + $response->success = false; + $response->message = _('Could not init user session'); + } + + // Get user + else if (!$user = $db->getUser($userId)) + { + $response->success = false; + $response->message = _('Could not init user info'); + } + + // Render icon + else + { + header('Cache-Control: max-age=604800'); + + + $icon = new Jdenticon\Identicon(); + + $icon->setValue($user->address); + $icon->setSize(empty($_GET['size']) ? 100 : (int) $_GET['size']); + $icon->setStyle( + [ + 'backgroundColor' => 'rgba(255, 255, 255, 0)', + ] + ); + $icon->displayImage('webp'); + } + + break; + } + + break; + case 'comment': switch (isset($_GET['toggle']) ? $_GET['toggle'] : false) diff --git a/src/public/assets/theme/default/css/framework.css b/src/public/assets/theme/default/css/framework.css index 0342855..b277e18 100644 --- a/src/public/assets/theme/default/css/framework.css +++ b/src/public/assets/theme/default/css/framework.css @@ -172,6 +172,10 @@ margin-left: 8px; } +.margin-r-4 { + margin-right: 4px; +} + .margin-r-8 { margin-right: 8px; } diff --git a/src/public/magnet.php b/src/public/magnet.php index 4df6090..f89c245 100644 --- a/src/public/magnet.php +++ b/src/public/magnet.php @@ -413,10 +413,16 @@ echo '' . PHP_EOL ?> getMagnetComments($response->magnet->magnetId) as $magnetComment) { ?>