diff options
author | RaindropsSys <raindrops@equestria.dev> | 2023-11-17 23:25:29 +0100 |
---|---|---|
committer | RaindropsSys <raindrops@equestria.dev> | 2023-11-17 23:25:29 +0100 |
commit | 953ddd82e48dd206cef5ac94456549aed13b3ad5 (patch) | |
tree | 8f003106ee2e7f422e5a22d2ee04d0db302e66c0 /includes/jobs | |
parent | 62a9199846b0c07c03218703b33e8385764f42d9 (diff) | |
download | pluralconnect-953ddd82e48dd206cef5ac94456549aed13b3ad5.tar.gz pluralconnect-953ddd82e48dd206cef5ac94456549aed13b3ad5.tar.bz2 pluralconnect-953ddd82e48dd206cef5ac94456549aed13b3ad5.zip |
Updated 30 files and deleted 2976 files (automated)
Diffstat (limited to 'includes/jobs')
-rw-r--r-- | includes/jobs/FrontersNotification.php | 2 | ||||
-rw-r--r-- | includes/jobs/UpdateAssets.php | 3 | ||||
-rw-r--r-- | includes/jobs/UpdateContactMethods.php | 61 | ||||
-rw-r--r-- | includes/jobs/UpdateLogo.php | 197 |
4 files changed, 5 insertions, 258 deletions
diff --git a/includes/jobs/FrontersNotification.php b/includes/jobs/FrontersNotification.php index d342303..bf0ced4 100644 --- a/includes/jobs/FrontersNotification.php +++ b/includes/jobs/FrontersNotification.php @@ -22,6 +22,8 @@ if ($system === "gdapd") { $name = "Raindrops System"; } elseif ($system === "ynmuc") { $name = "Cloudburst System"; +} elseif ($system === "hrbom") { + $name = "Moonglow"; } elseif (isset($app["other"]) && $system === $app["other"]["id"]) { $name = $app["other"]["name"]; } else { diff --git a/includes/jobs/UpdateAssets.php b/includes/jobs/UpdateAssets.php index c355a54..ee94537 100644 --- a/includes/jobs/UpdateAssets.php +++ b/includes/jobs/UpdateAssets.php @@ -102,6 +102,9 @@ downloadAssets("gdapd"); echo("Downloading for ynmuc\n"); downloadAssets("ynmuc"); +echo("Downloading for hrbom\n"); +downloadAssets("hrbom"); + if (isset($app["other"]) && isset($app["other"]["id"]) && isset($app["other"]["token"])) { echo("Downloading for other\n"); downloadAssets($app["other"]["id"], "other"); diff --git a/includes/jobs/UpdateContactMethods.php b/includes/jobs/UpdateContactMethods.php deleted file mode 100644 index cbd0239..0000000 --- a/includes/jobs/UpdateContactMethods.php +++ /dev/null @@ -1,61 +0,0 @@ -<?php - -$options = json_decode($argv[1], true); -$_SERVER['DOCUMENT_ROOT'] = "/_ch"; -require_once $_SERVER['DOCUMENT_ROOT'] . '/includes/composer/vendor/autoload.php'; -use ColorThief\ColorThief; - -echo("Loading...\n"); - -$app = json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/app.json"), true); -$id = $options["contact"]; - -$methods = json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/contactmethods.json"), true); -$contacts = json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/addressbook/contacts.json"), true); -$cache = json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/addressbook/saved.json"), true); - -echo("Processing for contact $id\n"); - -if (!isset($contacts[$id])) { - echo("Contact was deleted since then, aborting\n"); - die(); -} - -$contact = $contacts[$id]; - -foreach ($methods as $name => $method) { - if (isset($contacts[$id][$name])) { - echo("Contact makes use of $name, gathering information\n"); - - if (!isset($cache[$name])) $cache[$name] = []; - if (!isset($cache[$name][$contacts[$id][$name]])) $cache[$name][$contacts[$id][$name]] = [ - "data" => null, - "update" => 0 - ]; - - if (time() - $cache[$name][$contacts[$id][$name]]["update"] > 86400 || isset($cache[$name][$contacts[$id][$name]]["data"]["error"])) { - echo(" Information is out of date, updating it\n"); - - $return = []; - $cmd = "cd \"$_SERVER[DOCUMENT_ROOT]/includes/external/addressbook\" && node \"$_SERVER[DOCUMENT_ROOT]/includes/external/addressbook/$name.js\" \"" . str_replace('"', "''", $contacts[$id][$name]) . "\""; - - exec("nice -n 19 " . $cmd, $return); - $json = trim(implode("\n", $return)); - - $cache[$name][$contacts[$id][$name]] = [ - "data" => json_decode($json), - "update" => time() - ]; - - echo(" Information updated\n"); - } else { - echo(" Information is up to date, not updating it\n"); - } - } else { - echo("Contact does not makes use of $name\n"); - } -} - -echo("Done!\n"); - -file_put_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/addressbook/saved.json", json_encode($cache));
\ No newline at end of file diff --git a/includes/jobs/UpdateLogo.php b/includes/jobs/UpdateLogo.php deleted file mode 100644 index e6c605f..0000000 --- a/includes/jobs/UpdateLogo.php +++ /dev/null @@ -1,197 +0,0 @@ -<?php - -$options = json_decode($argv[1], true); -$_SERVER['DOCUMENT_ROOT'] = "../.."; -require_once $_SERVER['DOCUMENT_ROOT'] . '/includes/composer/vendor/autoload.php'; -use ColorThief\ColorThief; - -echo("Loading...\n"); - -require_once $_SERVER['DOCUMENT_ROOT'] . "/includes/util/functions.inc"; -require_once $_SERVER['DOCUMENT_ROOT'] . "/includes/util/bitset.inc"; -require_once $_SERVER['DOCUMENT_ROOT'] . "/includes/util/score.inc"; - -echo("Generating public logo\n"); - -$columns = ceil(sqrt(count(scoreOrderGlobal()))); -echo(" Using " . $columns . " columns\n"); - -$members = scoreOrderGlobal(); - -usort($members, function ($a, $b) { - $vr = hexdec(substr($a["color"], 0, 2)); - $vg = hexdec(substr($a["color"], 2, 2)); - $vb = hexdec(substr($a["color"], 4, 2)); - - $hsl = rgbToHsl($vr, $vg, $vb); - if ($hsl[0] == 0) $hsl[0] = 360; - $ra = $hsl[0]; - - $vr = hexdec(substr($b["color"], 0, 2)); - $vg = hexdec(substr($b["color"], 2, 2)); - $vb = hexdec(substr($b["color"], 4, 2)); - - $hsl = rgbToHsl($vr, $vg, $vb); - if ($hsl[0] == 0) $hsl[0] = 360; - $rb = $hsl[0]; - - return $ra - $rb; -}); - -echo(" " . count($members) . " members\n"); - -$packs = []; -$currentPack = []; - -foreach ($members as $member) { - if (count($currentPack) >= $columns) { - $packs[] = $currentPack; - $currentPack = []; - } - - $currentPack[] = $member["color"]; -} - -if (count($currentPack) > 0) $packs[] = $currentPack; - -$newPacks = []; -foreach ($packs as $pack) { - usort($pack, function ($a, $b) { - $vra = hexdec(substr($a, 0, 2)); - $vga = hexdec(substr($a, 2, 2)); - $vba = hexdec(substr($a, 4, 2)); - - $hsla = rgbToHsl($vra, $vga, $vba); - $ra = $hsla[2] * $hsla[1]; - - $vrb = hexdec(substr($b, 0, 2)); - $vgb = hexdec(substr($b, 2, 2)); - $vbb = hexdec(substr($b, 4, 2)); - - $hslb = rgbToHsl($vrb, $vgb, $vbb); - $rb = $hslb[2] * $hslb[1]; - - return $rb < $ra; - }); - - while (count($pack) < $columns) $pack[] = "ffffff"; - - $newPacks[] = $pack; -} - -$img = imagecreatetruecolor($columns, $columns); -$factor = 64; - -for ($y = 0; $y < $columns; ++$y) { - for ($x = 0; $x < $columns; ++$x) { - if (isset($newPacks[$y][$x])) { - imagesetpixel($img, $x, $y, imagecolorallocate($img, hexdec(substr($newPacks[$y][$x], 0, 2)), hexdec(substr($newPacks[$y][$x], 2, 2)), hexdec(substr($newPacks[$y][$x], 4, 2)))); - } else { - imagesetpixel($img, $x, $y, imagecolorallocate($img, 255, 255, 255)); - } - } -} - -$img2 = imagecreatetruecolor($columns * $factor, $columns * $factor); -imagecopyresampled($img2, $img, 0, 0, 0, 0, $columns * $factor, $columns * $factor, $columns, $columns); - -imagepng($img2, "/tmp/image.png"); -$img3 = imageCreateCorners("/tmp/image.png", $columns * 10); -unlink("/tmp/image.png"); - -imagepng($img3, $_SERVER['DOCUMENT_ROOT'] . "/assets/logo/newlogo.png"); -imagepng($img3, "/tmp/ponieslogo1.png"); - -$isLoggedIn = true; -$isLowerLoggedIn = false; - -echo("Generating private logo\n"); - -$columns = ceil(sqrt(count(array_filter(scoreOrderGlobal())))); -echo(" Using " . $columns . " columns\n"); - -$members = array_values(array_filter(scoreOrderGlobal())); - -usort($members, function ($a, $b) { - $vr = hexdec(substr($a["color"], 0, 2)); - $vg = hexdec(substr($a["color"], 2, 2)); - $vb = hexdec(substr($a["color"], 4, 2)); - - $hsl = rgbToHsl($vr, $vg, $vb); - if ($hsl[0] == 0) $hsl[0] = 360; - $ra = $hsl[0]; - - $vr = hexdec(substr($b["color"], 0, 2)); - $vg = hexdec(substr($b["color"], 2, 2)); - $vb = hexdec(substr($b["color"], 4, 2)); - - $hsl = rgbToHsl($vr, $vg, $vb); - if ($hsl[0] == 0) $hsl[0] = 360; - $rb = $hsl[0]; - - return $ra - $rb; -}); - -echo(" " . count($members) . " members\n"); - -$packs = []; -$currentPack = []; - -foreach ($members as $member) { - if (count($currentPack) >= $columns) { - $packs[] = $currentPack; - $currentPack = []; - } - - $currentPack[] = $member["color"]; -} - -if (count($currentPack) > 0) $packs[] = $currentPack; - -$newPacks = []; -foreach ($packs as $pack) { - usort($pack, function ($a, $b) { - $vra = hexdec(substr($a, 0, 2)); - $vga = hexdec(substr($a, 2, 2)); - $vba = hexdec(substr($a, 4, 2)); - - $hsla = rgbToHsl($vra, $vga, $vba); - $ra = $hsla[2] * $hsla[1]; - - $vrb = hexdec(substr($b, 0, 2)); - $vgb = hexdec(substr($b, 2, 2)); - $vbb = hexdec(substr($b, 4, 2)); - - $hslb = rgbToHsl($vrb, $vgb, $vbb); - $rb = $hslb[2] * $hslb[1]; - - return $rb < $ra; - }); - - while (count($pack) < $columns) $pack[] = "ffffff"; - - $newPacks[] = $pack; -} - -$img = imagecreatetruecolor($columns, $columns); -$factor = 64; - -for ($y = 0; $y < $columns; ++$y) { - for ($x = 0; $x < $columns; ++$x) { - if (isset($newPacks[$y][$x])) { - imagesetpixel($img, $x, $y, imagecolorallocate($img, hexdec(substr($newPacks[$y][$x], 0, 2)), hexdec(substr($newPacks[$y][$x], 2, 2)), hexdec(substr($newPacks[$y][$x], 4, 2)))); - } else { - imagesetpixel($img, $x, $y, imagecolorallocate($img, 255, 255, 255)); - } - } -} - -$img2 = imagecreatetruecolor($columns * $factor, $columns * $factor); -imagecopyresampled($img2, $img, 0, 0, 0, 0, $columns * $factor, $columns * $factor, $columns, $columns); - -imagepng($img2, "/tmp/image.png"); -$img3 = imageCreateCorners("/tmp/image.png", $columns * 10); -unlink("/tmp/image.png"); - -imagepng($img3, $_SERVER['DOCUMENT_ROOT'] . "/assets/logo/newlogo3.png"); -imagepng($img3, "/tmp/ponieslogo1b.png");
\ No newline at end of file |