ghost
2 years ago
11 changed files with 251 additions and 57 deletions
@ -1,5 +1,50 @@
@@ -1,5 +1,50 @@
|
||||
# kvazar-network webapp |
||||
Web-oriented content exploring platform for Kevacoin Blockchain |
||||
Web-oriented content exploring platform for Kevacoin Blockchain |
||||
|
||||
### demo |
||||
https://kvazar.ml |
||||
### requirements |
||||
``` |
||||
php-7.4 |
||||
php-curl |
||||
php-mbstring |
||||
php-mysql |
||||
php-sqlite |
||||
php-pdo |
||||
php-bcmath |
||||
php-gd |
||||
``` |
||||
#### database |
||||
|
||||
https://github.com/kvazar-network/database |
||||
|
||||
##### MySQL |
||||
|
||||
https://github.com/kvazar-network/webapp/tree/master |
||||
|
||||
##### SQLite |
||||
|
||||
https://github.com/kvazar-network/webapp/tree/sqlite |
||||
|
||||
#### crontab |
||||
|
||||
``` |
||||
0 0 * * * /path-to/php /path-to/crontab/sitemap.php > /dev/null 2>&1 |
||||
``` |
||||
|
||||
### nginx sef_mode example |
||||
|
||||
``` |
||||
location / { |
||||
try_files $uri $uri/ =404 @sef; |
||||
} |
||||
|
||||
location @sef { |
||||
rewrite ^(/.*)$ /?$1 last; |
||||
} |
||||
``` |
||||
|
||||
### examples |
||||
#### web |
||||
https://kvazar.today |
||||
|
||||
#### yggdrasil |
||||
[http://[203:7693:ae20:18a6:7689:cb63:c53d:43c6]](http://[203:7693:ae20:18a6:7689:cb63:c53d:43c6]) |
||||
|
@ -0,0 +1,59 @@
@@ -0,0 +1,59 @@
|
||||
<?php |
||||
|
||||
require_once(dirname(__FILE__) . '/../config.php'); |
||||
require_once(dirname(__FILE__) . '/../library/mysql.php'); |
||||
|
||||
$db = new MySQL(); |
||||
|
||||
// Generate url sets |
||||
$transaction = '<?xml version="1.0" encoding="UTF-8"?>'; |
||||
$transaction .= '<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9" xmlns:xhtml="http://www.w3.org/1999/xhtml" xmlns:image="http://www.google.com/schemas/sitemap-image/1.1">'; |
||||
|
||||
$namespace = '<?xml version="1.0" encoding="UTF-8"?>'; |
||||
$namespace .= '<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9" xmlns:xhtml="http://www.w3.org/1999/xhtml" xmlns:image="http://www.google.com/schemas/sitemap-image/1.1">'; |
||||
|
||||
$namespaces = []; |
||||
$transactions = []; |
||||
|
||||
foreach ($db->getData(false, false, false, 0, 1000000) as $value) { |
||||
|
||||
if (!in_array($value['namehash'], $namespaces)) { |
||||
$namespace .= '<loc>' . BASE_URL . '/' . $value['namehash'] . '</loc>'; |
||||
} |
||||
|
||||
|
||||
if (!in_array($value['namehash'], $transactions)) { |
||||
$transaction .= '<loc>' . BASE_URL . '/' . $value['txid'] . '</loc>'; |
||||
} |
||||
|
||||
$namespaces[] = $value['namehash']; |
||||
$transactions[] = $value['txid']; |
||||
} |
||||
|
||||
$namespace .= '</urlset>'; |
||||
$transaction .= '</urlset>'; |
||||
|
||||
$handle = fopen(dirname(__FILE__) . '/../public/sitemap.transaction.xml', 'w'); |
||||
fwrite($handle, $transaction); |
||||
fclose($handle); |
||||
|
||||
|
||||
$handle = fopen(dirname(__FILE__) . '/../public/sitemap.namespace.xml', 'w'); |
||||
fwrite($handle, $namespace); |
||||
fclose($handle); |
||||
|
||||
|
||||
// Sitemap |
||||
$sitemap = '<?xml version="1.0" encoding="UTF-8"?>'; |
||||
$sitemap .= '<sitemapindex xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">'; |
||||
$sitemap .= ' <sitemap>'; |
||||
$sitemap .= ' <loc>' . BASE_URL . '/sitemap.namespace.xml</loc>'; |
||||
$sitemap .= ' </sitemap>'; |
||||
$sitemap .= ' <sitemap>'; |
||||
$sitemap .= ' <loc>' . BASE_URL . '/sitemap.transaction.xml</loc>'; |
||||
$sitemap .= ' </sitemap>'; |
||||
$sitemap .= '</sitemapindex>'; |
||||
|
||||
$handle = fopen(dirname(__FILE__) . '/../public/sitemap.xml', 'w'); |
||||
fwrite($handle, $sitemap); |
||||
fclose($handle); |
@ -1,11 +1,36 @@
@@ -1,11 +1,36 @@
|
||||
<?php |
||||
|
||||
require_once('../config.php'); |
||||
require_once('../library/icon.php'); |
||||
|
||||
if (isset($_GET['hash'])) { |
||||
|
||||
$icon = new Icon(); |
||||
$hash = md5($_GET['hash']); |
||||
|
||||
header("Content-Type: image/jpeg"); |
||||
echo $icon->generateImageResource(md5($_GET['hash']), 60, 60, false); |
||||
$width = isset($_GET['width']) ? (int) $_GET['width'] : 60; |
||||
$height = isset($_GET['height']) ? (int) $_GET['height'] : 60; |
||||
|
||||
$radius = isset($_GET['radius']) ? (int) $_GET['radius'] : 0; |
||||
|
||||
header("Content-Type: image/png"); |
||||
|
||||
if (CACHE_ENABLED) { |
||||
|
||||
$filename = dirname(__FILE__) . '/../cache/' . $hash . '.png'; |
||||
|
||||
if (!file_exists($filename)) { |
||||
|
||||
$icon = new Icon(); |
||||
|
||||
file_put_contents($filename, $icon->generateImageResource($hash, $width, $height, false, $radius)); |
||||
} |
||||
|
||||
echo file_get_contents($filename); |
||||
|
||||
} else { |
||||
|
||||
$icon = new Icon(); |
||||
|
||||
echo $icon->generateImageResource($hash, $width, $height, false, $radius); |
||||
} |
||||
} |
||||
|
Loading…
Reference in new issue