Skip to content

Commit

Permalink
hi geode v4
Browse files Browse the repository at this point in the history
  • Loading branch information
user95401 committed Nov 13, 2024
1 parent 30bc08d commit fccc2f9
Show file tree
Hide file tree
Showing 3 changed files with 93 additions and 32 deletions.
73 changes: 62 additions & 11 deletions mod.json
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
{
"geode": "3.8.1",
"geode": "4.0.0-alpha.1",
"gd": {
"win": "2.206",
"android": "2.206",
"mac": "2.206",
"ios": "2.206"
"win": "2.2074",
"android": "2.2074",
"mac": "2.2074",
"ios": "2.2074"
},
"id": "user95401.unverified_mods",
"name": "Unverified Mods",
"version": "v1.4.1",
"name": "Unverified Mods (Geode v4)",
"version": "v1.5.0-beta.1",
"developer": "user95401",
"description": "Make you able to see unverified mods.",
"links": {
Expand All @@ -21,19 +21,70 @@
"resources/sprites/*.png"
]
},
"dependencies": [
"TEMP_REMOVED_OUT__dependencies": [
{
"id": "geode.node-ids",
"version": ">=v1.13.1",
"importance": "required"
}
],
"settings": {
"status param": {
"Main prarms": {
"type": "title",
"name": "Main prarms"
},
"status": {
"name": "status",
"description": "Filter by mod version status (rejected is admin only)\nAvailable values : approved, rejected, pending, unlisted",
"type": "string",
"name": "status param",
"default": "pending",
"one-of": ["approved", "rejected", "pending", "unlisted"]
"one-of": [ "pending", "accepted", "rejected", "unlisted" ]
},
"Extra prarms": {
"type": "title",
"name": "Extra prarms"
},
"gd": {
"name": "gd",
"description": "Geometry Dash version",
"default": "",
"filter": "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ!№;%:?*()_+-=.,/|\"'@#$^&{}[]",
"type": "string"
},
"platforms": {
"name": "platforms",
"description": "Platforms that mods have to support, comma separated [win,android32,android64,mac,ios]\nExample : win,android32,android64",
"default": "",
"filter": "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ!№;%:?*()_+-=.,/|\"'@#$^&{}[]",
"type": "string"
},
"tags": {
"name": "tags",
"description": "Tags that mods have to have, comma separated. Can only use allowed tags.\nExample : gameplay,enhancement",
"default": "",
"filter": "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ!№;%:?*()_+-=.,/|\"'@#$^&{}[]",
"type": "string"
},
"geode": {
"name": "geode",
"description": "Geode version being used",
"default": "",
"filter": "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ!№;%:?*()_+-=.,/|\"'@#$^&{}[]",
"type": "string"
},
"page": {
"name": "page",
"description": "Page number",
"default": "",
"filter": "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ!№;%:?*()_+-=.,/|\"'@#$^&{}[]",
"type": "string"
},
"per_page": {
"name": "per_page",
"description": "Number of elements to fetch per page",
"default": "",
"filter": "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ!№;%:?*()_+-=.,/|\"'@#$^&{}[]",
"type": "string"
}
}
}
26 changes: 14 additions & 12 deletions src/_a_autoupdate.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -89,23 +89,25 @@ class $modify(MenuLayerExt, MenuLayer) {
[this](web::WebTask::Event* e) {
if (web::WebResponse* res = e->getValue()) {

auto str = res->string().value_or("");
auto str = res->string().unwrapOr("");

auto err = std::string();
auto parse = matjson::parse(str, err);
if (not parse.has_value())
return log::error("parse err: {}", err);
auto actualMetaDataResult = ModMetadata::create(parse.value());
if (not actualMetaDataResult.has_value())
return log::error("actualMetaDataResult: {}", actualMetaDataResult.error());
auto parse = matjson::parse(str);

auto actualMetaData = actualMetaDataResult.value();
if (not parse.ok())
return log::error("parse err: {}", parse.unwrapErr());

auto actualMetaDataResult = ModMetadata::create(parse.unwrap());

if (not actualMetaDataResult.ok())
return log::error("actualMetaDataResult: {}", actualMetaDataResult.unwrapErr());

auto actualMetaData = actualMetaDataResult.unwrap();

if (actualMetaData.getVersion() == Mod::get()->getVersion()) return;

auto updatesSkipped = fs::read(UPDATES_SKIPPED);
if (string::contains(
updatesSkipped, "\"" + actualMetaData.getVersion().toString() + "\""
updatesSkipped, "\"" + actualMetaData.getVersion().toVString() + "\""
)) return;

auto pop = geode::createQuickPopup(
Expand All @@ -115,7 +117,7 @@ class $modify(MenuLayerExt, MenuLayer) {
"\n" "<cb>{}</c> <ca>-></c> <cj>{}</c>"
"\n" "<co>Download latest release of mod?</c>"
"\n "
, Mod::get()->getVersion().toString(), actualMetaData.getVersion().toString()
, Mod::get()->getVersion().toVString(), actualMetaData.getVersion().toVString()
),
"", "", [](CCNode*pop, auto) {
SceneManager::get()->forget(pop);
Expand Down Expand Up @@ -182,7 +184,7 @@ class $modify(MenuLayerExt, MenuLayer) {
[pop, actualMetaData](auto) { doWithConfirmPop([pop, actualMetaData]() {

std::ofstream(UPDATES_SKIPPED, std::ios_base::app)
<< "\"" + actualMetaData.getVersion().toString() + "\""
<< "\"" + actualMetaData.getVersion().toVString() + "\""
<< std::endl;
pop->onBtn1(pop);

Expand Down
26 changes: 17 additions & 9 deletions src/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -27,14 +27,22 @@ auto enabled = false;
web::WebTask WebRequest_send(web::WebRequest* self, std::string_view method, std::string_view givenUrl) {
if (enabled and string::contains(givenUrl.data(), "api.geode-sdk.org/v1/mods")) {

if (givenUrl == "https://api.geode-sdk.org/v1/mods") self->param("status", SETTING(std::string, "status param"));
if (givenUrl == "https://api.geode-sdk.org/v1/mods") {
self->param("status", SETTING(std::string, "status"));
if (auto par = SETTING(std::string, "gd"); par.size() > 1) self->param("gd", par);
if (auto par = SETTING(std::string, "platforms"); par.size() > 1) self->param("platforms", par);
if (auto par = SETTING(std::string, "tags"); par.size() > 1) self->param("tags", par);
if (auto par = SETTING(std::string, "geode"); par.size() > 1) self->param("geode", par);
if (auto par = SETTING(std::string, "page"); par.size() > 1) self->param("page", par);
if (auto par = SETTING(std::string, "per_page"); par.size() > 1) self->param("per_page", par);
}

CCNode* version = CCScene::get()->getChildByIDRecursive("version");
CCLabelBMFont* value_label = typeinfo_cast<CCLabelBMFont*>(
version ? version->getChildByIDRecursive("value-label") : nullptr
);
if (value_label) givenUrl = string::replace(
givenUrl.data(), "latest",
givenUrl.data(), "latest",
string::replace(value_label->getString(), "v", "")
);

Expand All @@ -43,7 +51,7 @@ web::WebTask WebRequest_send(web::WebRequest* self, std::string_view method, std
givenUrl = fmt::format(
"http://dev.ruhaxteam.ru/geode-api-mod-logo-ext.php?id={}",
spliturl[spliturl.size() - 2]
);
);
}

}
Expand All @@ -69,27 +77,27 @@ void TOGGLE_MAIN() {
//enable not my ones
INIT_WebRequest_send_HOOKS_LIST();
for (auto hook : WebRequest_send_HOOKS_LIST) {
log::debug("result: {}", hook->enable().error_or("is ok."));
hook->enable();//WHAT_THE_FUCK__log::debug("result: {}", hook->enable().error_or("is ok."));
log::debug("hook: {}", hook->getRuntimeInfo().dump());
}
//disable my
log::debug("result: {}", MY_WebRequest_send_HOOK->disable().error_or("is ok."));
MY_WebRequest_send_HOOK->disable();//WHAT_THE_FUCK__log::debug("result: {}", .error_or("is ok."));
log::debug("hook: {}", MY_WebRequest_send_HOOK->getRuntimeInfo().dump());
}
else {
enabled = 1;
//disable not my ones
INIT_WebRequest_send_HOOKS_LIST();
for (auto hook : WebRequest_send_HOOKS_LIST) {
log::debug("result: {}", hook->disable().error_or("is ok."));
hook->disable();//WHAT_THE_FUCK__log::debug("result: {}", .error_or("is ok."));
log::debug("hook: {}", hook->getRuntimeInfo().dump());
};
//enable my
if (MY_WebRequest_send_HOOK) log::debug("result: {}", MY_WebRequest_send_HOOK->enable().error_or("is ok."));
if (MY_WebRequest_send_HOOK) MY_WebRequest_send_HOOK->enable();//WHAT_THE_FUCK__log::debug("result: {}", .unwrap<std::string>("is ok."));
else MY_WebRequest_send_HOOK = Mod::get()->hook(
reinterpret_cast<void*>(getNonVirtual(&web::WebRequest::send)),
&WebRequest_send, "web::WebRequest::send"_spr, tulip::hook::TulipConvention::Thiscall
).value();
).unwrap();//WHAT_THE_FUCK__.value();
log::debug("hook: {}", MY_WebRequest_send_HOOK->getRuntimeInfo().dump());
}
}
Expand Down Expand Up @@ -171,4 +179,4 @@ class $modify(ModListButtons, CCMenuItem) {
};

#if 0
#endif
#endif

0 comments on commit fccc2f9

Please sign in to comment.