Capeling / dashauth

WIP

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

DashAuth

A work-in-progress mod that aims to make developers' lives easier for implementing GD message based authentication.

example usage:

#include <Geode/Geode.hpp>
#include <rooot.dashauth/include/dashauth.hpp>

using namespace geode::prelude;

using namespace dashauth;

#include <Geode/modify/MenuLayer.hpp>
class $modify(MyMenuLayer, MenuLayer) {
	bool init() {
		if (!MenuLayer::init()) {
			return false;
		}

		auto myButton = CCMenuItemSpriteExtra::create(
			CCSprite::createWithSpriteFrameName("GJ_likeBtn_001.png"),
			this,
			menu_selector(MyMenuLayer::onMyButton)
		);

		auto menu = this->getChildByID("bottom-menu");
		menu->addChild(myButton);

		myButton->setID("my-button"_spr);

		menu->updateLayout();

		return true;
	}

	void onMyButton(CCObject*) {
		DashAuthRequest().getToken(Mod::get(), "http://localhost:61475/api/v1")->except([]() {
			log::info("failed to get token :c");
			FLAlertLayer::create("DashAuth Error", "Failed to get token. why? idfk lmfao", "OK")->show();
		})->then([](std::string const& token) {
			log::info("got token!! {} :3", token);
			FLAlertLayer::create("meow", fmt::format("{}", token), "bomb brazil")->show();
		});
	}
};

About

WIP


Languages

Language:C++ 91.7%Language:CMake 8.3%