Update things
This commit is contained in:
parent
ee3ce8aced
commit
b74b7a548b
15 changed files with 188 additions and 53 deletions
|
@ -16,6 +16,13 @@ $showNowPlaying = !empty($is_index) || !empty($do_fullscreen_header);
|
||||||
<?php if(isset($styles) && is_array($styles)) foreach($styles as $style): ?>
|
<?php if(isset($styles) && is_array($styles)) foreach($styles as $style): ?>
|
||||||
<link href="<?=$style;?>" type="text/css" rel="stylesheet"/>
|
<link href="<?=$style;?>" type="text/css" rel="stylesheet"/>
|
||||||
<?php endforeach;?>
|
<?php endforeach;?>
|
||||||
|
<?php if(isset($is_365) && $is_365): ?>
|
||||||
|
<style type="text/css">
|
||||||
|
body {
|
||||||
|
transform: rotate(<?=date('z');?>deg);
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
<?php endif; ?>
|
||||||
</head>
|
</head>
|
||||||
<body class="<?php if(isset($is_index)) { echo 'index ';} if(isset($do_fullscreen_header)) { echo 'fullscreen-header ';} if(isset($is_now_playing)) { echo 'now-playing ';} ?>">
|
<body class="<?php if(isset($is_index)) { echo 'index ';} if(isset($do_fullscreen_header)) { echo 'fullscreen-header ';} if(isset($is_now_playing)) { echo 'now-playing ';} ?>">
|
||||||
<div class="header">
|
<div class="header">
|
||||||
|
|
|
@ -120,12 +120,14 @@ if($reqPath === '/donate') {
|
||||||
return FM_HIT | 302;
|
return FM_HIT | 302;
|
||||||
}
|
}
|
||||||
|
|
||||||
if($reqPath === '/') {
|
if($reqPath === '/' || $reqPath === '/365') {
|
||||||
if($reqMethod !== 'GET')
|
if($reqMethod !== 'GET')
|
||||||
return FM_ERR | 405;
|
return FM_ERR | 405;
|
||||||
if($reqHead)
|
if($reqHead)
|
||||||
return FM_HIT;
|
return FM_HIT;
|
||||||
|
|
||||||
|
$is365 = $reqPath === '/365';
|
||||||
|
|
||||||
$legacyPage = filter_input(INPUT_GET, 'p', FILTER_SANITIZE_STRING);
|
$legacyPage = filter_input(INPUT_GET, 'p', FILTER_SANITIZE_STRING);
|
||||||
if(!empty($legacyPage)) {
|
if(!empty($legacyPage)) {
|
||||||
$legacyPages = [
|
$legacyPages = [
|
||||||
|
@ -185,6 +187,7 @@ if($reqPath === '/') {
|
||||||
fm_component('header', [
|
fm_component('header', [
|
||||||
'title' => 'flash.moe',
|
'title' => 'flash.moe',
|
||||||
'is_index' => true,
|
'is_index' => true,
|
||||||
|
'is_365' => $is365,
|
||||||
]);
|
]);
|
||||||
?>
|
?>
|
||||||
<div class="index-menu">
|
<div class="index-menu">
|
||||||
|
|
|
@ -14,6 +14,9 @@ define('HTML_INORI', 5);
|
||||||
define('HTML_GECKSCAPE', 5);
|
define('HTML_GECKSCAPE', 5);
|
||||||
define('HTML_N3DS', 6);
|
define('HTML_N3DS', 6);
|
||||||
|
|
||||||
|
if(isset($_GET['jvdg']))
|
||||||
|
define('FWH_MODE', FWH_JVDG);
|
||||||
|
|
||||||
function html_browser(): int {
|
function html_browser(): int {
|
||||||
static $browser = null;
|
static $browser = null;
|
||||||
|
|
||||||
|
|
|
@ -3,9 +3,9 @@ define('KEY_CHARS', 'AaBbCcDdEeFfGgHhIiJjKkLlMmNnOoPpQqRrSsTtUuVvWwXxYyZz0123456
|
||||||
define('KEY_CHARS_LENGTH', strlen(KEY_CHARS));
|
define('KEY_CHARS_LENGTH', strlen(KEY_CHARS));
|
||||||
|
|
||||||
function generateKey(int $length): string {
|
function generateKey(int $length): string {
|
||||||
$bytes = random_bytes($length);
|
$bytes = str_repeat("\0", $length);
|
||||||
for($i = 0; $i < $length; ++$i)
|
for($i = 0; $i < $length; ++$i)
|
||||||
$bytes[$i] = KEY_CHARS[ord($bytes[$i]) % KEY_CHARS_LENGTH];
|
$bytes[$i] = KEY_CHARS[random_int(0, KEY_CHARS_LENGTH - 1)];
|
||||||
return $bytes;
|
return $bytes;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -19,7 +19,8 @@ if(isset($_GET['length'])) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
echo '16: ' . generateKey(8) . PHP_EOL;
|
echo '8: ' . generateKey(8) . PHP_EOL;
|
||||||
echo '32: ' . generateKey(16) . PHP_EOL;
|
echo '16: ' . generateKey(16) . PHP_EOL;
|
||||||
echo '64: ' . generateKey(32) . PHP_EOL;
|
echo '32: ' . generateKey(32) . PHP_EOL;
|
||||||
echo '128: ' . generateKey(64) . PHP_EOL;
|
echo '64: ' . generateKey(64) . PHP_EOL;
|
||||||
|
echo '128: ' . generateKey(128) . PHP_EOL;
|
||||||
|
|
BIN
public/signature/bg4.png
Normal file
BIN
public/signature/bg4.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 54 KiB |
BIN
public/signature/bg5.png
Normal file
BIN
public/signature/bg5.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 113 KiB |
|
@ -1,6 +1,6 @@
|
||||||
<?php
|
<?php
|
||||||
define('SIG_WIDTH', 600);
|
define('SIG_WIDTH', 600);
|
||||||
define('SIG_HEIGHT', 80);
|
define('SIG_HEIGHT', 100);
|
||||||
define('SIG_STATIC', 'signature.png');
|
define('SIG_STATIC', 'signature.png');
|
||||||
define('SIG_AGE', 60);
|
define('SIG_AGE', 60);
|
||||||
define('FW_FONT_FAM', __DIR__ . '/../assets/Electrolize-Regular.ttf');
|
define('FW_FONT_FAM', __DIR__ . '/../assets/Electrolize-Regular.ttf');
|
||||||
|
@ -13,8 +13,16 @@ define('NP_FILE', 'np.json');
|
||||||
define('NP_URL', 'https://now.flash.moe/get.php?u=flashwave_');
|
define('NP_URL', 'https://now.flash.moe/get.php?u=flashwave_');
|
||||||
define('NP_COVER', 'cover.png');
|
define('NP_COVER', 'cover.png');
|
||||||
define('NP_COVER_URL', 'cover_url.txt');
|
define('NP_COVER_URL', 'cover_url.txt');
|
||||||
|
define('NP_COVER_URL_DEFAULT', 'https://lastfm.freetls.fastly.net/i/u/174s/2a96cbd8b46e442fc41c2b86b821562f.png');
|
||||||
define('NP_COVER_DEFAULT', '/www/now.flash.moe/public/resources/no-cover.png');
|
define('NP_COVER_DEFAULT', '/www/now.flash.moe/public/resources/no-cover.png');
|
||||||
define('BG_IMAGE', 'bg3.png');
|
|
||||||
|
$currentDate = (int)ltrim(date('md'), '0');
|
||||||
|
|
||||||
|
if($currentDate > 1205 && $currentDate < 1227) {
|
||||||
|
define('BG_IMAGE', 'bg5.png');
|
||||||
|
} else {
|
||||||
|
define('BG_IMAGE', 'bg4.png');
|
||||||
|
}
|
||||||
|
|
||||||
if(!isset($_GET['_force']) && is_file(SIG_STATIC) && time() - filemtime(SIG_STATIC) < SIG_AGE) {
|
if(!isset($_GET['_force']) && is_file(SIG_STATIC) && time() - filemtime(SIG_STATIC) < SIG_AGE) {
|
||||||
$imagick = new Imagick(SIG_STATIC);
|
$imagick = new Imagick(SIG_STATIC);
|
||||||
|
@ -28,7 +36,7 @@ if(!isset($_GET['_force']) && is_file(SIG_STATIC) && time() - filemtime(SIG_STAT
|
||||||
if(is_array($np)) {
|
if(is_array($np)) {
|
||||||
file_put_contents(NP_FILE, $npRaw);
|
file_put_contents(NP_FILE, $npRaw);
|
||||||
|
|
||||||
if(empty($np[0]->images->large)) {
|
if(empty($np[0]->images->large) || $np[0]->images->large === NP_COVER_URL_DEFAULT) {
|
||||||
unlink(NP_COVER);
|
unlink(NP_COVER);
|
||||||
file_put_contents(NP_COVER_URL, '');
|
file_put_contents(NP_COVER_URL, '');
|
||||||
} elseif(!empty($np[0]->images->large) && $np[0]->images->large !== file_get_contents(NP_COVER_URL)) {
|
} elseif(!empty($np[0]->images->large) && $np[0]->images->large !== file_get_contents(NP_COVER_URL)) {
|
||||||
|
@ -54,39 +62,42 @@ if(!isset($_GET['_force']) && is_file(SIG_STATIC) && time() - filemtime(SIG_STAT
|
||||||
$imagick->compositeImage($footer, Imagick::COMPOSITE_MATHEMATICS, 0, SIG_HEIGHT - $footer->getImageHeight());
|
$imagick->compositeImage($footer, Imagick::COMPOSITE_MATHEMATICS, 0, SIG_HEIGHT - $footer->getImageHeight());
|
||||||
$footer->destroy();
|
$footer->destroy();
|
||||||
|
|
||||||
if($nowPlaying) {
|
$hasCover = $nowPlaying && is_file(NP_COVER);
|
||||||
$npCover = new Imagick(is_file(NP_COVER) ? NP_COVER : NP_COVER_DEFAULT);
|
|
||||||
$npCover->resizeImage(60, 60, Imagick::FILTER_CATROM, 0.9, true);
|
if($hasCover) {
|
||||||
$imagick->compositeImage($npCover, Imagick::COMPOSITE_COPY, SIG_WIDTH - 70, 10);
|
$npCover = new Imagick(/*is_file(NP_COVER) ?*/ NP_COVER /*: NP_COVER_DEFAULT*/);
|
||||||
|
$npCover->resizeImage(80, 80, Imagick::FILTER_CATROM, 0.9, true);
|
||||||
|
$imagick->compositeImage($npCover, Imagick::COMPOSITE_COPY, SIG_WIDTH - 90, 10);
|
||||||
$npCover->destroy();
|
$npCover->destroy();
|
||||||
}
|
}
|
||||||
|
|
||||||
$imagickDraw = new ImagickDraw;
|
$imagickDraw = new ImagickDraw;
|
||||||
$imagickDraw->setFillColor($ip_fff);
|
$imagickDraw->setFillColor(BG_IMAGE === 'bg4.png' ? $ip_000 : $ip_fff);
|
||||||
$imagickDraw->setFont(FW_FONT_FAM);
|
$imagickDraw->setFont(FW_FONT_FAM);
|
||||||
$imagickDraw->setFontSize(FW_FONT_SIZE);
|
$imagickDraw->setFontSize(FW_FONT_SIZE);
|
||||||
|
|
||||||
$imagickLogo = new Imagick();
|
$imagickLogo = new Imagick();
|
||||||
$imagickLogo->newImage($imagick->getImageWidth(), $imagick->getImageHeight(), new ImagickPixel('none'), 'png');
|
$imagickLogo->newImage($imagick->getImageWidth(), $imagick->getImageHeight(), new ImagickPixel('none'), 'png');
|
||||||
$imagickLogo->annotateImage($imagickDraw, 15, 35, 0, FW_TEXT);
|
$imagickLogo->annotateImage($imagickDraw, $hasCover ? 367 : 457, 60, 0, FW_TEXT);
|
||||||
|
|
||||||
$imagickShadow = clone $imagickLogo;
|
$imagickShadow = clone $imagickLogo;
|
||||||
$imagickShadow->shadowImage(80, 2, 0, 0);
|
$imagickShadow->shadowImage(80, 5, 0, 0);
|
||||||
$imagickShadow->compositeImage($imagickLogo, Imagick::COMPOSITE_OVER, 4, 2);
|
$imagickShadow->compositeImage($imagickLogo, Imagick::COMPOSITE_OVER, 4, 2);
|
||||||
$imagickLogo->destroy();
|
$imagickLogo->destroy();
|
||||||
|
|
||||||
$imagick->compositeImage($imagickShadow, Imagick::COMPOSITE_OVER, -4, -2);
|
$imagick->compositeImage($imagickShadow, Imagick::COMPOSITE_OVER, -4, -2);
|
||||||
$imagickShadow->destroy();
|
$imagickShadow->destroy();
|
||||||
|
|
||||||
|
$imagickDraw->setFillColor($ip_fff);
|
||||||
$imagickDraw->setFont(NP_FONT_FAM);
|
$imagickDraw->setFont(NP_FONT_FAM);
|
||||||
$imagickDraw->setFontSize(NP_FONT_SIZE);
|
$imagickDraw->setFontSize(NP_FONT_SIZE);
|
||||||
|
|
||||||
if($nowPlaying) {
|
if($nowPlaying) {
|
||||||
$imagick->annotateImage($imagickDraw, 40, 71, 0, sprintf('%s - %s', $np[0]->artist->name ?? '', $np[0]->name ?? ''));
|
$imagick->annotateImage($imagickDraw, 40, 91, 0, sprintf('%s - %s', $np[0]->artist->name ?? '', $np[0]->name ?? ''));
|
||||||
$imagickDraw->setFont(FA_FONT_FAM);
|
$imagickDraw->setFont(FA_FONT_FAM);
|
||||||
$imagick->annotateImage($imagickDraw, 10, 71, 0, "\u{f001}");
|
$imagick->annotateImage($imagickDraw, 10, 91, 0, "\u{f001}");
|
||||||
} else {
|
} else {
|
||||||
$imagick->annotateImage($imagickDraw, 10, 71, 0, "If it ain't broke, I'll break it");
|
$imagick->annotateImage($imagickDraw, 10, 91, 0, "If it ain't broke, I'll break it");
|
||||||
}
|
}
|
||||||
|
|
||||||
file_put_contents(SIG_STATIC, $imagick->getImageBlob());
|
file_put_contents(SIG_STATIC, $imagick->getImageBlob());
|
||||||
|
|
|
@ -7,7 +7,7 @@ $json = !empty($_GET['j']);
|
||||||
|
|
||||||
header('Content-Type: ' . ($json ? 'application/json; charset=utf-8' : 'text/plain; charset=us-ascii'));
|
header('Content-Type: ' . ($json ? 'application/json; charset=utf-8' : 'text/plain; charset=us-ascii'));
|
||||||
|
|
||||||
$keys = $pdo->prepare('SELECT *, UNIX_TIMESTAMP(`key_created`) AS `key_created` FROM `fm_public_keys` WHERE `key_deprecated` IS NULL AND `key_level` >= :level');
|
$keys = $pdo->prepare('SELECT *, UNIX_TIMESTAMP(`key_created`) AS `key_created` FROM `fm_public_keys` WHERE `key_deprecated` IS NULL AND `key_level` >= :level ORDER BY `key_level` DESC, `key_id`');
|
||||||
$keys->bindValue('level', $minLevel);
|
$keys->bindValue('level', $minLevel);
|
||||||
$keys->execute();
|
$keys->execute();
|
||||||
$keys = $keys->fetchAll(PDO::FETCH_OBJ);
|
$keys = $keys->fetchAll(PDO::FETCH_OBJ);
|
||||||
|
|
135
public/temp.php
135
public/temp.php
|
@ -1,12 +1,32 @@
|
||||||
<?php
|
<?php
|
||||||
require_once __DIR__ . '/_v4/includes.php';
|
|
||||||
|
|
||||||
define('FM_TEMP_KEY', 'kND861svbydCLywutu78tRmlpWdzoRLPcVZSrnxerh3KbLwfwvfvgC5hzax8gvYm');
|
define('FM_TEMP_KEY', 'kND861svbydCLywutu78tRmlpWdzoRLPcVZSrnxerh3KbLwfwvfvgC5hzax8gvYm');
|
||||||
define('FM_TEMP_INT', 10);
|
define('FM_TEMP_INT', 10);
|
||||||
|
|
||||||
ini_set('display_errors', 'on');
|
ini_set('display_errors', 'on');
|
||||||
error_reporting(-1);
|
error_reporting(-1);
|
||||||
|
|
||||||
|
date_default_timezone_set('UTC');
|
||||||
|
mb_internal_encoding('UTF-8');
|
||||||
|
|
||||||
|
try {
|
||||||
|
$pdo = new PDO('mysql:unix_socket=/var/run/mysqld/mysqld.sock;dbname=website;charset=utf8mb4', 'website', 'A3NjVvHRkHAxiYgk8MM4ZrCwrLVyPIYX', [
|
||||||
|
PDO::ATTR_CASE => PDO::CASE_NATURAL,
|
||||||
|
PDO::ATTR_ERRMODE => PDO::ERRMODE_EXCEPTION,
|
||||||
|
PDO::ATTR_ORACLE_NULLS => PDO::NULL_NATURAL,
|
||||||
|
PDO::ATTR_STRINGIFY_FETCHES => false,
|
||||||
|
PDO::ATTR_EMULATE_PREPARES => false,
|
||||||
|
PDO::MYSQL_ATTR_INIT_COMMAND => "
|
||||||
|
SET SESSION
|
||||||
|
sql_mode = 'STRICT_TRANS_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_ENGINE_SUBSTITUTION',
|
||||||
|
time_zone = '+00:00';
|
||||||
|
",
|
||||||
|
]);
|
||||||
|
} catch(Exception $ex) {
|
||||||
|
http_response_code(500);
|
||||||
|
echo '<h3>Unable to connect to database</h3>';
|
||||||
|
die($ex->getMessage());
|
||||||
|
}
|
||||||
|
|
||||||
if(isset($_POST['temp']) && isset($_POST['hash']) && isset($_POST['time'])) {
|
if(isset($_POST['temp']) && isset($_POST['hash']) && isset($_POST['time'])) {
|
||||||
$temp = (string)filter_input(INPUT_POST, 'temp', FILTER_SANITIZE_STRING);
|
$temp = (string)filter_input(INPUT_POST, 'temp', FILTER_SANITIZE_STRING);
|
||||||
$hash = (string)filter_input(INPUT_POST, 'hash', FILTER_SANITIZE_STRING);
|
$hash = (string)filter_input(INPUT_POST, 'hash', FILTER_SANITIZE_STRING);
|
||||||
|
@ -35,11 +55,32 @@ if(isset($_GET['since'])) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if(isset($_GET['since_3mo'])) {
|
||||||
|
$since = (int)filter_input(INPUT_GET, 'since_3mo', FILTER_SANITIZE_NUMBER_INT);
|
||||||
|
$temps = $pdo->prepare('SELECT MAX(`temp_celcius`) AS `temp_celcius_max`, AVG(`temp_celcius`) AS `temp_celcius_avg`, MIN(`temp_celcius`) AS `temp_celcius_min`, UNIX_TIMESTAMP(DATE(`temp_datetime`)) AS `temp_datetime` FROM `fm_temperature` WHERE `temp_datetime` > DATE(FROM_UNIXTIME(:since)) AND `temp_datetime` > NOW() - INTERVAL 3 MONTH GROUP BY DATE(`temp_datetime`) ORDER BY `temp_datetime` ASC LIMIT 92');
|
||||||
|
$temps->bindValue('since', $since);
|
||||||
|
$temps->execute();
|
||||||
|
header('Content-Type: application/json; charset=utf-8');
|
||||||
|
echo json_encode($temps->fetchAll(PDO::FETCH_ASSOC));
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if(isset($_GET['since_6mo'])) {
|
||||||
|
$since = (int)filter_input(INPUT_GET, 'since_6mo', FILTER_SANITIZE_NUMBER_INT);
|
||||||
|
$temps = $pdo->prepare('SELECT MAX(`temp_celcius`) AS `temp_celcius_max`, AVG(`temp_celcius`) AS `temp_celcius_avg`, MIN(`temp_celcius`) AS `temp_celcius_min`, UNIX_TIMESTAMP(DATE(`temp_datetime`)) AS `temp_datetime` FROM `fm_temperature` WHERE `temp_datetime` > DATE(FROM_UNIXTIME(:since)) AND `temp_datetime` > NOW() - INTERVAL 6 MONTH GROUP BY DATE(`temp_datetime`) ORDER BY `temp_datetime` ASC LIMIT 92');
|
||||||
|
$temps->bindValue('since', $since);
|
||||||
|
$temps->execute();
|
||||||
|
header('Content-Type: application/json; charset=utf-8');
|
||||||
|
echo json_encode($temps->fetchAll(PDO::FETCH_ASSOC));
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if(!empty($_GET['siri'])) {
|
if(!empty($_GET['siri'])) {
|
||||||
header('Content-Type: text/plain; charset=utf-8');
|
header('Content-Type: text/plain; charset=utf-8');
|
||||||
$temps = $pdo->prepare('SELECT `temp_celcius`, UNIX_TIMESTAMP(`temp_datetime`) AS `temp_datetime` FROM `fm_temperature` ORDER BY `temp_datetime` DESC LIMIT 1');
|
$temps = $pdo->prepare('SELECT `temp_celcius`, UNIX_TIMESTAMP(`temp_datetime`) AS `temp_datetime` FROM `fm_temperature` ORDER BY `temp_datetime` DESC LIMIT 1');
|
||||||
$temps->execute();
|
$temps->execute();
|
||||||
$temps = $temps->fetch(PDO::FETCH_ASSOC);
|
$temps = $temps->fetch(PDO::FETCH_ASSOC);
|
||||||
|
date_default_timezone_set('Europe/Amsterdam');
|
||||||
printf('It was %2$.1f°C at %1$s.', date('H:i:s', $temps['temp_datetime']), $temps['temp_celcius']);
|
printf('It was %2$.1f°C at %1$s.', date('H:i:s', $temps['temp_datetime']), $temps['temp_celcius']);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -106,15 +147,21 @@ if(!empty($_GET['siri'])) {
|
||||||
<div class="chart">
|
<div class="chart">
|
||||||
<canvas id="-chart" width="400" height="170"></canvas>
|
<canvas id="-chart" width="400" height="170"></canvas>
|
||||||
</div>
|
</div>
|
||||||
|
<div class="chart">
|
||||||
|
<canvas id="-chart-mo" width="400" height="170"></canvas>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<script type="text/javascript" src="https://cdn.jsdelivr.net/npm/chart.js@3.3.2/dist/chart.min.js"></script>
|
<script type="text/javascript" src="https://cdn.jsdelivr.net/npm/chart.js@3.3.2/dist/chart.min.js"></script>
|
||||||
<script type="text/javascript">
|
<script type="text/javascript">
|
||||||
var temp = {
|
var temp = {
|
||||||
last: 0,
|
last: 0,
|
||||||
|
lastMo: 0,
|
||||||
history: [],
|
history: [],
|
||||||
|
historyMo: [],
|
||||||
lastTemp: null,
|
lastTemp: null,
|
||||||
lastDateTime: null,
|
lastDateTime: null,
|
||||||
chart: null,
|
chart: null,
|
||||||
|
chartMo: null,
|
||||||
};
|
};
|
||||||
temp.getLastTemperature = function() {
|
temp.getLastTemperature = function() {
|
||||||
if(this.history.length === 0)
|
if(this.history.length === 0)
|
||||||
|
@ -152,6 +199,39 @@ if(!empty($_GET['siri'])) {
|
||||||
|
|
||||||
this.chart.update();
|
this.chart.update();
|
||||||
};
|
};
|
||||||
|
temp.refreshMo = function() {
|
||||||
|
var xhr = new XMLHttpRequest;
|
||||||
|
xhr.onload = function() {
|
||||||
|
var temps = JSON.parse(xhr.responseText);
|
||||||
|
for(var i = 0; i < temps.length; ++i) {
|
||||||
|
var temp = temps[i];
|
||||||
|
this.lastMo = temp.temp_datetime;
|
||||||
|
this.historyMo.push(temp);
|
||||||
|
}
|
||||||
|
this.refreshUIMo();
|
||||||
|
}.bind(this);
|
||||||
|
xhr.open('GET', '/temp.php?since_6mo=' + encodeURIComponent(parseInt(this.lastMo).toString()));
|
||||||
|
xhr.send();
|
||||||
|
};
|
||||||
|
temp.refreshUIMo = function() {
|
||||||
|
var take = Math.min(92, this.historyMo.length),
|
||||||
|
datasetMax = this.chartMo.data.datasets[0],
|
||||||
|
datasetAvg = this.chartMo.data.datasets[1],
|
||||||
|
datasetMin = this.chartMo.data.datasets[2];
|
||||||
|
this.chart.data.labels = [];
|
||||||
|
datasetMax.data = [];
|
||||||
|
datasetAvg.data = [];
|
||||||
|
datasetMin.data = [];
|
||||||
|
for(var i = this.historyMo.length - take; i < this.historyMo.length; ++i) {
|
||||||
|
var temp = this.historyMo[i];
|
||||||
|
this.chartMo.data.labels.push(new Date(temp.temp_datetime * 1000).toDateString());
|
||||||
|
datasetMax.data.push(temp.temp_celcius_max);
|
||||||
|
datasetAvg.data.push(temp.temp_celcius_avg);
|
||||||
|
datasetMin.data.push(temp.temp_celcius_min);
|
||||||
|
}
|
||||||
|
|
||||||
|
this.chartMo.update();
|
||||||
|
};
|
||||||
window.onload = function() {
|
window.onload = function() {
|
||||||
temp.lastTemp = document.getElementById('-last-temp');
|
temp.lastTemp = document.getElementById('-last-temp');
|
||||||
temp.lastDateTime = document.getElementById('-last-datetime');
|
temp.lastDateTime = document.getElementById('-last-datetime');
|
||||||
|
@ -194,6 +274,57 @@ if(!empty($_GET['siri'])) {
|
||||||
|
|
||||||
temp.refresh();
|
temp.refresh();
|
||||||
setInterval(temp.refresh.bind(temp), 5 * 60 * 1000);
|
setInterval(temp.refresh.bind(temp), 5 * 60 * 1000);
|
||||||
|
|
||||||
|
var ctxMo = document.getElementById('-chart-mo').getContext('2d');
|
||||||
|
temp.chartMo = new Chart(ctxMo, {
|
||||||
|
type: 'line',
|
||||||
|
data: {
|
||||||
|
datasets: [
|
||||||
|
{
|
||||||
|
label: 'Maximum Temperature',
|
||||||
|
data: [],
|
||||||
|
borderColor: '#400',
|
||||||
|
backgroundColor: '#800',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: 'Average Temperature',
|
||||||
|
data: [],
|
||||||
|
borderColor: '#040',
|
||||||
|
backgroundColor: '#080',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: 'Minimum Temperature',
|
||||||
|
data: [],
|
||||||
|
borderColor: '#004',
|
||||||
|
backgroundColor: '#008',
|
||||||
|
},
|
||||||
|
],
|
||||||
|
},
|
||||||
|
options: {
|
||||||
|
responsive: true,
|
||||||
|
plugins: {
|
||||||
|
legend: {
|
||||||
|
position: 'top',
|
||||||
|
},
|
||||||
|
title: {
|
||||||
|
display: true,
|
||||||
|
text: 'Daily Temperature (6 months)',
|
||||||
|
},
|
||||||
|
},
|
||||||
|
scales: {
|
||||||
|
y: {
|
||||||
|
suggestedMax: 34,
|
||||||
|
suggestedMin: 20,
|
||||||
|
ticks: {
|
||||||
|
stepSize: 1,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
});
|
||||||
|
|
||||||
|
temp.refreshMo();
|
||||||
|
setInterval(temp.refreshMo.bind(temp), 31 * 24 * 60 * 1000);
|
||||||
};
|
};
|
||||||
</script>
|
</script>
|
||||||
</body>
|
</body>
|
||||||
|
|
|
@ -12,13 +12,13 @@ $body .= $indent . '<div class="tmf-godownload">'
|
||||||
. $indent . '</div>';
|
. $indent . '</div>';
|
||||||
|
|
||||||
$body .= $indent . '<h3>Tray Area</h3>';
|
$body .= $indent . '<h3>Tray Area</h3>';
|
||||||
$body .= $indent . '<img src="./ss-main.jpg" alt="Main UI in v1.5.1"/>';
|
$body .= $indent . '<img src="./ss-main-160.jpg" alt="Main UI in v1.6.0"/>';
|
||||||
$body .= $indent . '<p>Top Most Friend runs in your system tray area. When right clicking on it you\'re presented with a menu that contains all currently open windows as well as a number of actions.</p>';
|
$body .= $indent . '<p>Top Most Friend runs in your system tray area. When right clicking on it you\'re presented with a menu that contains all currently open windows as well as a number of actions.</p>';
|
||||||
$body .= $indent . '<p>Clicking any of the windows will toggle its always on top status, Refresh will reload the window list without dismissing the menu, Settings will open the settings menu displayed below, About shows the about window displayed in the screenshot, and Quit closes the program.</p>';
|
$body .= $indent . '<p>Clicking any of the windows will toggle its always on top status, Refresh will reload the window list without dismissing the menu, Settings will open the settings menu displayed below, About shows the about window displayed in the screenshot, and Quit closes the program.</p>';
|
||||||
$body .= $indent . '<div class="tmf-clear"></div>';
|
$body .= $indent . '<div class="tmf-clear"></div>';
|
||||||
|
|
||||||
$body .= $indent . '<h3>Settings</h3>';
|
$body .= $indent . '<h3>Settings</h3>';
|
||||||
$body .= $indent . '<img src="./ss-settings.jpg" alt="Settings in v1.5.1"/>';
|
$body .= $indent . '<img src="./ss-settings-160.jpg" alt="Settings in v1.6.0"/>';
|
||||||
$body .= $indent . '<p>In the settings you can alter program behaviour, set a global hotkey that will toggle the always on top status of whichever window currently has focus and open the title blacklist window.</p>';
|
$body .= $indent . '<p>In the settings you can alter program behaviour, set a global hotkey that will toggle the always on top status of whichever window currently has focus and open the title blacklist window.</p>';
|
||||||
$body .= $indent . '<p>Some windows require administrator privileges to have their top most status toggled, normally the program will prompt you if this is needed but you can also choose to always make the program start itself as administrator. This will have no effect on version of Windows before Vista.</p>';
|
$body .= $indent . '<p>Some windows require administrator privileges to have their top most status toggled, normally the program will prompt you if this is needed but you can also choose to always make the program start itself as administrator. This will have no effect on version of Windows before Vista.</p>';
|
||||||
$body .= $indent . '<p>You can also choose to omit the program list from the taskbar menu if you only plan on using the hotkey functionality, this will make the menu open ever so slightly faster.</p>';
|
$body .= $indent . '<p>You can also choose to omit the program list from the taskbar menu if you only plan on using the hotkey functionality, this will make the menu open ever so slightly faster.</p>';
|
||||||
|
@ -26,12 +26,12 @@ $body .= $indent . '<p>The other options are fairly self explanatory, if you\'ve
|
||||||
$body .= $indent . '<div class="tmf-clear"></div>';
|
$body .= $indent . '<div class="tmf-clear"></div>';
|
||||||
|
|
||||||
$body .= $indent . '<h3>Title Blacklisting</h3>';
|
$body .= $indent . '<h3>Title Blacklisting</h3>';
|
||||||
$body .= $indent . '<img src="./ss-settings-blacklist.jpg" alt="Title blacklist in v1.5.1"/>';
|
$body .= $indent . '<img src="./ss-settings-blacklist-160.jpg" alt="Title blacklist in v1.6.0"/>';
|
||||||
$body .= $indent . '<p>The title blacklist functions as a way to keep the list in the menu clean, it does not affect anything in regards to the hotkey. Depending on your version of Windows, a number of items may be added by default which are either invisible windows or cannot be toggled at all.</p>';
|
$body .= $indent . '<p>The title blacklist functions as a way to keep the list in the menu clean, it does not affect anything in regards to the hotkey. Depending on your version of Windows, a number of items may be added by default which are either invisible windows or cannot be toggled at all.</p>';
|
||||||
$body .= $indent . '<p>You can add, edit and remove entries using a simple text entry screen, as described in the previous section you can also SHIFT+CLICK things in the program list if enable.</p>';
|
$body .= $indent . '<p>You can add, edit and remove entries using a simple text entry screen, as described in the previous section you can also SHIFT+CLICK things in the program list if enable.</p>';
|
||||||
$body .= $indent . '<div class="tmf-clear"></div>';
|
$body .= $indent . '<div class="tmf-clear"></div>';
|
||||||
|
|
||||||
$body .= $indent . '<script src="./simulator.js" charset="utf-8"></script>';
|
//$body .= $indent . '<script src="./simulator.js" charset="utf-8"></script>';
|
||||||
|
|
||||||
$body .= substr($indent, 0, -4);
|
$body .= substr($indent, 0, -4);
|
||||||
|
|
||||||
|
|
BIN
public/topmostfriend/ss-main-160.jpg
Normal file
BIN
public/topmostfriend/ss-main-160.jpg
Normal file
Binary file not shown.
After Width: | Height: | Size: 56 KiB |
BIN
public/topmostfriend/ss-settings-160.jpg
Normal file
BIN
public/topmostfriend/ss-settings-160.jpg
Normal file
Binary file not shown.
After Width: | Height: | Size: 80 KiB |
BIN
public/topmostfriend/ss-settings-blacklist-160.jpg
Normal file
BIN
public/topmostfriend/ss-settings-blacklist-160.jpg
Normal file
Binary file not shown.
After Width: | Height: | Size: 30 KiB |
|
@ -1,13 +1,13 @@
|
||||||
// ==UserScript==
|
// ==UserScript==
|
||||||
// @name Removed Trending tab
|
// @name Remove Trending tab
|
||||||
// @version 6
|
// @version 7
|
||||||
// @grant none
|
// @grant none
|
||||||
// @include https://www.youtube.com/*
|
// @include https://www.youtube.com/*
|
||||||
// ==/UserScript==
|
// ==/UserScript==
|
||||||
|
|
||||||
window.addEventListener('load', function() {
|
window.addEventListener('load', function() {
|
||||||
var checkInterval = setInterval(function() {
|
var checkInterval = setInterval(function() {
|
||||||
var buttons = Array.from(document.querySelectorAll('[href="/feed/explore"], [href="/feed/trending"]'));
|
var buttons = Array.from(document.querySelectorAll('[href="/feed/explore"], [href="/feed/trending"], [href="/channel/UCqVDpXKLmKeBU_yyt_QkItQ"]'));
|
||||||
|
|
||||||
if(buttons.length) {
|
if(buttons.length) {
|
||||||
while(buttons.length)
|
while(buttons.length)
|
||||||
|
|
|
@ -1,27 +1,6 @@
|
||||||
<?php
|
<?php
|
||||||
require_once __DIR__ . '/vendor/autoload.php';
|
require_once __DIR__ . '/vendor/autoload.php';
|
||||||
|
require_once __DIR__ . '/../_v4/includes.php';
|
||||||
error_reporting(-1);
|
|
||||||
ini_set('display_errors', 'on');
|
|
||||||
|
|
||||||
try {
|
|
||||||
$pdo = new PDO('mysql:unix_socket=/var/run/mysqld/mysqld.sock;dbname=flash_website;charset=utf8mb4', 'flash', 'af66a6666b1c9a597063325b14c8b52d', [
|
|
||||||
PDO::ATTR_CASE => PDO::CASE_NATURAL,
|
|
||||||
PDO::ATTR_ERRMODE => PDO::ERRMODE_EXCEPTION,
|
|
||||||
PDO::ATTR_ORACLE_NULLS => PDO::NULL_NATURAL,
|
|
||||||
PDO::ATTR_STRINGIFY_FETCHES => false,
|
|
||||||
PDO::ATTR_EMULATE_PREPARES => false,
|
|
||||||
PDO::MYSQL_ATTR_INIT_COMMAND => "
|
|
||||||
SET SESSION
|
|
||||||
sql_mode = 'STRICT_TRANS_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_ENGINE_SUBSTITUTION',
|
|
||||||
time_zone = '+00:00';
|
|
||||||
",
|
|
||||||
]);
|
|
||||||
|
|
||||||
$pdo->exec('DELETE FROM `fm_whois` WHERE `whois_timestamp` < NOW() - INTERVAL 30 MINUTE');
|
|
||||||
} catch(Exception $ex) {
|
|
||||||
die($ex->getMessage());
|
|
||||||
}
|
|
||||||
|
|
||||||
$domain = isset($_GET['domain']) && is_string($_GET['domain'])
|
$domain = isset($_GET['domain']) && is_string($_GET['domain'])
|
||||||
? idn_to_ascii(mb_strtolower($_GET['domain']), IDNA_NONTRANSITIONAL_TO_ASCII, INTL_IDNA_VARIANT_UTS46)
|
? idn_to_ascii(mb_strtolower($_GET['domain']), IDNA_NONTRANSITIONAL_TO_ASCII, INTL_IDNA_VARIANT_UTS46)
|
||||||
|
@ -105,7 +84,7 @@ if(isset($_GET['ajax'])) {
|
||||||
<div class="title">flash.moe <span style="color: #4a3650;">whois</span></div>
|
<div class="title">flash.moe <span style="color: #4a3650;">whois</span></div>
|
||||||
<div class="nav">
|
<div class="nav">
|
||||||
<a href="/">Home</a>
|
<a href="/">Home</a>
|
||||||
<a href="https://github.com/flashwave/whois-php">Library</a>
|
<!--<a href="https://github.com/flashwave/whois-php">Library</a>-->
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue