From 95112b1eb06a4be531ded59563d53a63a8d614e8 Mon Sep 17 00:00:00 2001 From: Minteck Date: Sun, 8 Aug 2021 12:04:30 +0200 Subject: Opening! --- includes/stats/apis.php | 46 +++++++++---------- includes/stats/neutron.json | 39 ++++++++++++++++ includes/stats/neutron2.json | 20 ++++----- includes/stats/refresh.php | 104 +++++++++++++++++++++---------------------- includes/stats/stats.json | 8 ++-- 5 files changed, 128 insertions(+), 89 deletions(-) (limited to 'includes/stats') diff --git a/includes/stats/apis.php b/includes/stats/apis.php index 5e8d05b..060ba18 100644 --- a/includes/stats/apis.php +++ b/includes/stats/apis.php @@ -1,23 +1,23 @@ -keys = json_decode(file_get_contents("./credentials.json"), true); - } - - public function GitHub(string $path) { - exec("curl -A \"Minteck-Space/0.0.0 (nekostarfan@gmail.com)\" -H \"Authorization: token " . $this->keys["github"] . "\" https://api.github.com/" . $path, $op); - $result = implode("\n", $op); - - return $result; - } - - public function Reddit(string $path) { - exec("curl -A \"Minteck-Space/0.0.0 (nekostarfan@gmail.com)\" https://www.reddit.com/" . $path . ".json", $op); - $result = implode("\n", $op); - - return $result; - } -} +keys = json_decode(file_get_contents("./credentials.json"), true); + } + + public function GitHub(string $path) { + exec("curl -A \"Minteck-Space/0.0.0 (nekostarfan@gmail.com)\" -H \"Authorization: token " . $this->keys["github"] . "\" https://api.github.com/" . $path, $op); + $result = implode("\n", $op); + + return $result; + } + + public function Reddit(string $path) { + exec("curl -A \"Minteck-Space/0.0.0 (nekostarfan@gmail.com)\" https://www.reddit.com/" . $path . ".json", $op); + $result = implode("\n", $op); + + return $result; + } +} diff --git a/includes/stats/neutron.json b/includes/stats/neutron.json index 875bbef..32ee47d 100644 --- a/includes/stats/neutron.json +++ b/includes/stats/neutron.json @@ -1,4 +1,43 @@ [ + { + "url": "https:\/\/api.github.com\/repos\/Minteck-Projects\/Neutron-Core\/releases\/46937809", + "assets_url": "https:\/\/api.github.com\/repos\/Minteck-Projects\/Neutron-Core\/releases\/46937809\/assets", + "upload_url": "https:\/\/uploads.github.com\/repos\/Minteck-Projects\/Neutron-Core\/releases\/46937809\/assets{?name,label}", + "html_url": "https:\/\/github.com\/Minteck-Projects\/Neutron-Core\/releases\/tag\/10.0.217.50", + "id": 46937809, + "author": { + "login": "Minteck", + "id": 46352972, + "node_id": "MDQ6VXNlcjQ2MzUyOTcy", + "avatar_url": "https:\/\/avatars.githubusercontent.com\/u\/46352972?v=4", + "gravatar_id": "", + "url": "https:\/\/api.github.com\/users\/Minteck", + "html_url": "https:\/\/github.com\/Minteck", + "followers_url": "https:\/\/api.github.com\/users\/Minteck\/followers", + "following_url": "https:\/\/api.github.com\/users\/Minteck\/following{\/other_user}", + "gists_url": "https:\/\/api.github.com\/users\/Minteck\/gists{\/gist_id}", + "starred_url": "https:\/\/api.github.com\/users\/Minteck\/starred{\/owner}{\/repo}", + "subscriptions_url": "https:\/\/api.github.com\/users\/Minteck\/subscriptions", + "organizations_url": "https:\/\/api.github.com\/users\/Minteck\/orgs", + "repos_url": "https:\/\/api.github.com\/users\/Minteck\/repos", + "events_url": "https:\/\/api.github.com\/users\/Minteck\/events{\/privacy}", + "received_events_url": "https:\/\/api.github.com\/users\/Minteck\/received_events", + "type": "User", + "site_admin": false + }, + "node_id": "MDc6UmVsZWFzZTQ2OTM3ODA5", + "tag_name": "10.0.217.50", + "target_commitish": "trunk", + "name": "Neutron 10 Release Candidate 1", + "draft": false, + "prerelease": true, + "created_at": "2021-07-26T02:07:52Z", + "published_at": "2021-07-28T22:23:03Z", + "assets": [], + "tarball_url": "https:\/\/api.github.com\/repos\/Minteck-Projects\/Neutron-Core\/tarball\/10.0.217.50", + "zipball_url": "https:\/\/api.github.com\/repos\/Minteck-Projects\/Neutron-Core\/zipball\/10.0.217.50", + "body": "" + }, { "url": "https:\/\/api.github.com\/repos\/Minteck-Projects\/Neutron-Core\/releases\/46737727", "assets_url": "https:\/\/api.github.com\/repos\/Minteck-Projects\/Neutron-Core\/releases\/46737727\/assets", diff --git a/includes/stats/neutron2.json b/includes/stats/neutron2.json index b953c0c..373d655 100644 --- a/includes/stats/neutron2.json +++ b/includes/stats/neutron2.json @@ -1,4 +1,14 @@ [ + { + "name": "10.0.217.50", + "zipball_url": "https:\/\/api.github.com\/repos\/Minteck-Projects\/Neutron-Core\/zipball\/refs\/tags\/10.0.217.50", + "tarball_url": "https:\/\/api.github.com\/repos\/Minteck-Projects\/Neutron-Core\/tarball\/refs\/tags\/10.0.217.50", + "commit": { + "sha": "f5f4ac7aa73d86335766ed4a09e4ba71d9edee45", + "url": "https:\/\/api.github.com\/repos\/Minteck-Projects\/Neutron-Core\/commits\/f5f4ac7aa73d86335766ed4a09e4ba71d9edee45" + }, + "node_id": "MDM6UmVmMzM1NzU4MDQ4OnJlZnMvdGFncy8xMC4wLjIxNy41MA==" + }, { "name": "10.0.205.49", "zipball_url": "https:\/\/api.github.com\/repos\/Minteck-Projects\/Neutron-Core\/zipball\/refs\/tags\/10.0.205.49", @@ -288,15 +298,5 @@ "url": "https:\/\/api.github.com\/repos\/Minteck-Projects\/Neutron-Core\/commits\/2bf3a0bdc8a56f033f2622108e5dea815f11a0d3" }, "node_id": "MDM6UmVmMzM1NzU4MDQ4OnJlZnMvdGFncy8yLjAuMQ==" - }, - { - "name": "2.0", - "zipball_url": "https:\/\/api.github.com\/repos\/Minteck-Projects\/Neutron-Core\/zipball\/refs\/tags\/2.0", - "tarball_url": "https:\/\/api.github.com\/repos\/Minteck-Projects\/Neutron-Core\/tarball\/refs\/tags\/2.0", - "commit": { - "sha": "45585c983312edd77adefc4cb1bbafd817870ef6", - "url": "https:\/\/api.github.com\/repos\/Minteck-Projects\/Neutron-Core\/commits\/45585c983312edd77adefc4cb1bbafd817870ef6" - }, - "node_id": "MDM6UmVmMzM1NzU4MDQ4OnJlZnMvdGFncy8yLjA=" } ] \ No newline at end of file diff --git a/includes/stats/refresh.php b/includes/stats/refresh.php index 4ff5487..531a057 100644 --- a/includes/stats/refresh.php +++ b/includes/stats/refresh.php @@ -1,52 +1,52 @@ - [] -]; - -// ------------------------------------ -// GitHub - -$events = json_decode($api->GitHub("users/Minteck/events"), true); -$last = null; - -foreach ($events as $event) { - if ($event["type"] === "PushEvent") { - $last = $event; - break; - } -} - -$data["github"]["project"] = $last["repo"]["name"]; -$data["github"]["sha"] = substr($last["payload"]["commits"][0]["sha"], 0, 7); -$data["github"]["message"] = $last["payload"]["commits"][0]["message"]; - -// ------------------------------------ -// Reddit -$posts = json_decode($api->Reddit("user/Minteck"), true)["data"]["children"]; -$last = null; - -foreach ($posts as $post) { - if (!$post["pinned"]) { - $last = $post["data"]; - break; - } -} - -$data["reddit"]["sub"] = $last["subreddit"]; -$data["reddit"]["title"] = $last["title"]; -$data["reddit"]["score"] = $last["score"]; - -// ------------------------------------ -// Neutron Releases -$neutron = json_decode($api->GitHub("repos/Minteck-Projects/Neutron-Core/releases"), true); -file_put_contents("./neutron.json", json_encode($neutron, JSON_PRETTY_PRINT)); -$neutron = json_decode($api->GitHub("repos/Minteck-Projects/Neutron-Core/tags"), true); -file_put_contents("./neutron2.json", json_encode($neutron, JSON_PRETTY_PRINT)); - -// ------------------------------------ -// Dump - -file_put_contents("./stats.json", json_encode($data, JSON_PRETTY_PRINT)); + [] +]; + +// ------------------------------------ +// GitHub + +$events = json_decode($api->GitHub("users/Minteck/events"), true); +$last = null; + +foreach ($events as $event) { + if ($event["type"] === "PushEvent") { + $last = $event; + break; + } +} + +$data["github"]["project"] = $last["repo"]["name"]; +$data["github"]["sha"] = substr($last["payload"]["commits"][0]["sha"], 0, 7); +$data["github"]["message"] = $last["payload"]["commits"][0]["message"]; + +// ------------------------------------ +// Reddit +$posts = json_decode($api->Reddit("user/Minteck"), true)["data"]["children"]; +$last = null; + +foreach ($posts as $post) { + if (!$post["pinned"]) { + $last = $post["data"]; + break; + } +} + +$data["reddit"]["sub"] = $last["subreddit"]; +$data["reddit"]["title"] = $last["title"]; +$data["reddit"]["score"] = $last["score"]; + +// ------------------------------------ +// Neutron Releases +$neutron = json_decode($api->GitHub("repos/Minteck/Neutron/releases"), true); +file_put_contents("./neutron.json", json_encode($neutron, JSON_PRETTY_PRINT)); +$neutron = json_decode($api->GitHub("repos/Minteck/Neutron/tags"), true); +file_put_contents("./neutron2.json", json_encode($neutron, JSON_PRETTY_PRINT)); + +// ------------------------------------ +// Dump + +file_put_contents("./stats.json", json_encode($data, JSON_PRETTY_PRINT)); diff --git a/includes/stats/stats.json b/includes/stats/stats.json index 15e6d1b..a8aab2d 100644 --- a/includes/stats/stats.json +++ b/includes/stats/stats.json @@ -1,12 +1,12 @@ { "github": { - "project": "Minteck\/UnchainedTech-Content", - "sha": "8703ba3", - "message": "Update how-was-windows-2000-made.md" + "project": "Minteck\/Website", + "sha": "87303b0", + "message": "SVN Confirmed!" }, "reddit": { "sub": "unixporn", "title": "[tty] Nintendo 3DS", - "score": 2274 + "score": 2285 } } \ No newline at end of file -- cgit