Skip to content

Commit

Permalink
141
Browse files Browse the repository at this point in the history
  • Loading branch information
user95401 committed Oct 20, 2024
1 parent e33f35d commit 4bd3aad
Show file tree
Hide file tree
Showing 6 changed files with 141 additions and 10 deletions.
8 changes: 5 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
# Unverified Mods
add new button in geode mods menu that shows unverified mods.
see for toggle in search filters!

Make you able to see unverified mods.

See for toggle button in search filters! (where tags select goes)

- featuring *"integrated"* custom ui in geode mods layer
- ability to download unverified mods
- ability to see and download unverified mods
- supports search query and tags

**unverified mods can has some problems since wasnt checked by geode index admins, mod allows see and download them on your own risk**
Expand Down
8 changes: 5 additions & 3 deletions about.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
# Unverified Mods
add new button in geode mods menu that shows unverified mods.
see for toggle in search filters!

Make you able to see unverified mods.

See for toggle button in search filters! (where tags select goes)

- featuring *"integrated"* custom ui in geode mods layer
- ability to download unverified mods
- ability to see and download unverified mods
- supports search query and tags

**unverified mods can has some problems since wasnt checked by geode index admins, mod allows see and download them on your own risk**
Expand Down
13 changes: 13 additions & 0 deletions changelog.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,16 @@
# 1.4.1
- fix button activate crash
- update meta info
- load mod logos

# 1.4
now intercepts web requests and changes them, this leads to:
- listing mods in the native interface
- native downloading system
- more lifeful filtering and sorting

and mod was reneamed to Unverified Mods

# 1.3.0
- small fixes
- new vars for view btn: `get`, `update`, `view`
Expand Down
4 changes: 2 additions & 2 deletions mod.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@
},
"id": "user95401.unverified_mods",
"name": "Unverified Mods",
"version": "v1.4.0",
"version": "v1.4.1",
"developer": "user95401",
"description": "add new button in geode mods menu that shows unverified mods",
"description": "Make you able to see unverified mods.",
"links": {
"community": "https://discord.com/invite/9e43WMKzhp",
"homepage": "https://geode-sdk.org/mods?status=pending&per_page=10&sort=downloads",
Expand Down
105 changes: 105 additions & 0 deletions server/geode-api-mod-logo-ext.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,105 @@
<?php
if (!isset($_GET["id"])) exit("
<meta name='viewport' content='width=device-width, height=device-height'>
<div style='
display: flex;
flex-direction: column;
zoom: 1.5;
text-align: center;
'>
<h4>Give `id` param pls.</h4>
<form method='get'><input name='id'><input type='submit'>
<br><br>{$_SERVER['REQUEST_URI']}?id={mod.id}
");
$id = $_GET["id"];

$url = "https://api.geode-sdk.org/v1/mods/$id/logo";
if (@file_get_contents($url)) {
header('Location: '.$url); exit();
}

$url = "https://api.geode-sdk.org/v1/mods/$id";
$content = file_get_contents($url);
$array = json_decode($content, 1);

$mod = $array["payload"];

$source = array_key_exists("source", is_array($mod["links"]) ? $mod["links"] : array()) ? @$mod["links"]["source"] : "";
$source = empty($source) ? @$mod["repository"] : $source;
if (!empty($source)) {

if (strstr($source, "github.com")) {

$repo = "";
$last_peace = ""; $bam = 0;
foreach (explode("/", $source) as $peace) {
if ($last_peace == "github.com" or $bam == 1) {
$repo .= ($bam == 1 ? "/" : "")."$peace";
$bam += 1;
}
$last_peace = $peace;
}

$raw = "https://raw.githubusercontent.com/$repo";

$url = $raw."/".$mod["versions"][0]["version"]."/logo.png";
if (@file_get_contents($url)) {
header('Location: '.$url); exit();
}

$url = $raw."/v".$mod["versions"][0]["version"]."/logo.png";
if (@file_get_contents($url)) {
header('Location: '.$url); exit();
}

$url = $raw."/main/logo.png";
if (@file_get_contents($url)) {
header('Location: '.$url); exit();
}

$url = $raw."/master/logo.png";
if (@file_get_contents($url)) {
header('Location: '.$url); exit();
}

}

//https://gitlab.com/thebearodactyl/gay-wave-trail/-/raw/main/logo.png?ref_type=heads&inline=false
if (strstr($source, "gitlab.com")) {

$repo = "";
$last_peace = ""; $bam = 0;
foreach (explode("/", $source) as $peace) {
if ($last_peace == "gitlab.com" or $bam == 1) {
$repo .= ($bam == 1 ? "/" : "")."$peace";
$bam += 1;
}
$last_peace = $peace;
}

$raw = "https://gitlab.com/$repo/-/raw";

$url = $raw."/".$mod["versions"][0]["version"]."/logo.png";
if (@file_get_contents($url)) {
header('Location: '.$url); exit();
}

$url = $raw."/v".$mod["versions"][0]["version"]."/logo.png";
if (@file_get_contents($url)) {
header('Location: '.$url); exit();
}

$url = $raw."/main/logo.png";
if (@file_get_contents($url)) {
header('Location: '.$url); exit();
}

$url = $raw."/master/logo.png";
if (@file_get_contents($url)) {
header('Location: '.$url); exit();
}

}
}

http_response_code(404);
13 changes: 11 additions & 2 deletions src/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,14 @@ web::WebTask WebRequest_send(web::WebRequest* self, std::string_view method, std
string::replace(value_label->getString(), "v", "")
);

if (string::contains(givenUrl.data(), "/logo")) {
auto spliturl = string::split(givenUrl.data(), "/");
givenUrl = fmt::format(
"http://dev.ruhaxteam.ru/geode-api-mod-logo-ext.php?id={}",
spliturl[spliturl.size() - 2]
);
}

}
log::debug("{}(std::string_view {}, std::string_view {})", __func__, method, givenUrl);
return self->send(method, givenUrl);
Expand Down Expand Up @@ -90,10 +98,11 @@ void TOGGLE_MAIN() {
class $modify(ModListButtons, CCMenuItem) {
$override void activate() {
CCMenuItem::activate();
if (!this->m_pListener) return;
if (this == nullptr) return;
if (this->m_pListener == nullptr) return;
if (!typeinfo_cast<CCNode*>(this->m_pListener)) return;

auto listener = typeinfo_cast<CCNode*>(this->m_pListener);
Ref<CCNode> listener = typeinfo_cast<CCNode*>(this->m_pListener);

if (listener->getID() == "ModList") {

Expand Down

0 comments on commit 4bd3aad

Please sign in to comment.