Skip to content

Commit d4066be

Browse files
committed
bump ver
1 parent 25cd24e commit d4066be

File tree

12 files changed

+170
-59
lines changed

12 files changed

+170
-59
lines changed

changelog.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
# v1.4.8
2+
- Bump geode version to support jitless
3+
- Add a new cert validation setting in case HTTPS doesn't work for some reason
14
# v1.4.7
25
- Previews now use CCRenderTexture to optimize performance on large amounts of objects. (New setting: Pre-Render Object Capacity & Pre-Render Full View)
36
- Replaced GDAuth with argon

mod.json

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
2-
"geode": "4.5.0",
2+
"geode": "4.6.1",
33
"gd": {
44
"win": "2.2074",
55
"android": "2.2074",
@@ -8,7 +8,7 @@
88
},
99
"id": "firee.object-workshop",
1010
"name": "Object Workshop",
11-
"version": "v1.4.7",
11+
"version": "v1.4.8",
1212
"developer": "Firee",
1313
"description": "Download, upload, or find custom objects made by other creators!",
1414
"resources": {
@@ -63,6 +63,12 @@
6363
"description": "Whether or not to also pre-render when viewing more information about the object. Do note this will disable particles. (When they get added)",
6464
"type": "bool",
6565
"default": false
66+
},
67+
"cert-valid": {
68+
"name": "Cert Validation",
69+
"description": "Whether or not to validate the certificate when making web requests to Object Workshop. (Only disable if you know what this is for!)",
70+
"type": "bool",
71+
"default": true
6672
}
6773
},
6874
"dependentold": [
@@ -75,12 +81,12 @@
7581
"dependencies": [
7682
{
7783
"id": "alphalaneous.editortab_api",
78-
"version": ">=v1.0.6",
84+
"version": ">=v1.0.16",
7985
"importance": "required"
8086
},
8187
{
8288
"id": "geode.node-ids",
83-
"version": ">=1.14.1",
89+
"version": ">=1.21.1",
8490
"importance": "required"
8591
}
8692
]

src/main.cpp

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -222,6 +222,10 @@ bool CustomObjects::init(LevelEditorLayer* editorLayer) {
222222
myjson.set("token", token);
223223
req.header("Content-Type", "application/json");
224224
req.userAgent(USER_AGENT);
225+
auto certValid = Mod::get()->getSettingValue<bool>("cert-valid");
226+
if (!certValid) {
227+
req.certVerification(certValid);
228+
}
225229
req.bodyJSON(myjson);
226230
m_fields->m_listener.setFilter(req.post(fmt::format("{}/user/@me", HOST_URL)));
227231
}
@@ -425,6 +429,10 @@ class $modify(ProfilePage) {
425429
web::WebRequest req = web::WebRequest();
426430
m_fields->m_profileListener.getFilter().cancel();
427431
req.userAgent(USER_AGENT);
432+
auto certValid = Mod::get()->getSettingValue<bool>("cert-valid");
433+
if (!certValid) {
434+
req.certVerification(certValid);
435+
}
428436
m_fields->m_profileListener.setFilter(req.get(fmt::format("{}/user/{}", HOST_URL, m_accountID)));
429437
}
430438
}

src/nodes/CommentCell.cpp

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -170,6 +170,10 @@ void OWCommentCell::onVote(CCObject*) {
170170
myjson.set("like", (int)like);
171171
req.header("Content-Type", "application/json");
172172
req.userAgent(USER_AGENT);
173+
auto certValid = Mod::get()->getSettingValue<bool>("cert-valid");
174+
if (!certValid) {
175+
req.certVerification(certValid);
176+
}
173177
req.bodyJSON(myjson);
174178
m_listener.setFilter(req.post(fmt::format("{}/objects/{}/comments/{}/vote", HOST_URL, m_data.objectID, m_data.id)));
175179
})->show();
@@ -202,6 +206,10 @@ void OWCommentCell::onPin(CCObject*) {
202206
req.header("Content-Type", "application/json");
203207
req.bodyJSON(myjson);
204208
req.userAgent(USER_AGENT);
209+
auto certValid = Mod::get()->getSettingValue<bool>("cert-valid");
210+
if (!certValid) {
211+
req.certVerification(certValid);
212+
}
205213
m_listener.setFilter(req.post(fmt::format("{}/objects/{}/comments/{}/pin", HOST_URL, m_data.objectID, m_data.id)));
206214
}
207215
},
@@ -237,6 +245,10 @@ void OWCommentCell::onDelete(CCObject*) {
237245
req.header("Content-Type", "application/json");
238246
req.bodyJSON(myjson);
239247
req.userAgent(USER_AGENT);
248+
auto certValid = Mod::get()->getSettingValue<bool>("cert-valid");
249+
if (!certValid) {
250+
req.certVerification(certValid);
251+
}
240252
m_listener.setFilter(req.post(fmt::format("{}/objects/{}/comments/{}/delete", HOST_URL, m_data.objectID, m_data.id)));
241253
}
242254
},

src/ui/ObjectWorkshop.cpp

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,10 @@ bool ObjectWorkshop::setup(bool authenticated) {
2424

2525
web::WebRequest req = web::WebRequest();
2626
req.userAgent(USER_AGENT);
27+
auto certValid = Mod::get()->getSettingValue<bool>("cert-valid");
28+
if (!certValid) {
29+
req.certVerification(certValid);
30+
}
2731
m_tagsListener.getFilter().cancel();
2832
m_tagsListener.bind([this] (web::WebTask::Event* e) {
2933
if (web::WebResponse* value = e->getValue()) {
@@ -251,6 +255,10 @@ bool ObjectWorkshop::setup(bool authenticated) {
251255
});
252256
web::WebRequest req = web::WebRequest();
253257
req.userAgent(USER_AGENT);
258+
auto certValid = Mod::get()->getSettingValue<bool>("cert-valid");
259+
if (!certValid) {
260+
req.certVerification(certValid);
261+
}
254262
auto myjson = matjson::Value();
255263
myjson.set("token", m_token);
256264
req.header("Content-Type", "application/json");
@@ -502,6 +510,10 @@ void ObjectWorkshop::load() {
502510
log::debug("Loading objects...");
503511
web::WebRequest request = web::WebRequest();
504512
request.userAgent(USER_AGENT);
513+
auto certValid = Mod::get()->getSettingValue<bool>("cert-valid");
514+
if (!certValid) {
515+
request.certVerification(certValid);
516+
}
505517
m_listener1.getFilter().cancel();
506518
m_listener2.getFilter().cancel();
507519
categoryItems->setVisible(false);
@@ -640,6 +652,10 @@ void ObjectWorkshop::load() {
640652
myjson.set("token", m_token);
641653
request2.header("Content-Type", "application/json");
642654
request2.userAgent(USER_AGENT);
655+
auto certValid = Mod::get()->getSettingValue<bool>("cert-valid");
656+
if (!certValid) {
657+
request2.certVerification(certValid);
658+
}
643659
request2.bodyJSON(myjson);
644660
m_listener2.setFilter(request2.get(fmt::format("{}/user/@me/objects?page=0&limit=true", HOST_URL)));
645661
} else if (currentMenuIndexGD == -1) {
@@ -1817,6 +1833,10 @@ void ObjectWorkshop::onUpload(CCObject*) {
18171833
m_filterTags.clear();
18181834
web::WebRequest req = web::WebRequest();
18191835
req.userAgent(USER_AGENT);
1836+
auto certValid = Mod::get()->getSettingValue<bool>("cert-valid");
1837+
if (!certValid) {
1838+
req.certVerification(certValid);
1839+
}
18201840
auto myjson = matjson::Value();
18211841
myjson.set("token", m_token);
18221842
myjson.set("name", obj.name);

src/ui/auth/AuthMenu.cpp

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -104,6 +104,10 @@ void AuthMenu::testAuth(std::string token, std::function<void(int)> callback) {
104104
if (!hasEmitted) {
105105
web::WebRequest req = web::WebRequest();
106106
req.userAgent(USER_AGENT);
107+
auto certValid = Mod::get()->getSettingValue<bool>("cert-valid");
108+
if (!certValid) {
109+
req.certVerification(certValid);
110+
}
107111
if (auto gm = GameManager::sharedState()) {
108112
auto myjson = matjson::Value();
109113
std::vector<matjson::Value> iconSet;
@@ -144,6 +148,10 @@ void AuthMenu::testAuth(std::string token, std::function<void(int)> callback) {
144148
req.header("Content-Type", "application/json");
145149
req.bodyJSON(myjson);
146150
req.userAgent(USER_AGENT);
151+
auto certValid = Mod::get()->getSettingValue<bool>("cert-valid");
152+
if (!certValid) {
153+
req.certVerification(certValid);
154+
}
147155
m_authListener.setFilter(req.post(fmt::format("{}/verify", HOST_URL)));
148156
}
149157
void AuthMenu::genAuthToken(AuthMethod method, std::string token, bool showFLAlert, std::function<void(int)> callback) {
@@ -205,6 +213,10 @@ void AuthMenu::genAuthToken(AuthMethod method, std::string token, bool showFLAle
205213
}
206214
req.bodyJSON(myjson);
207215
req.userAgent(USER_AGENT);
216+
auto certValid = Mod::get()->getSettingValue<bool>("cert-valid");
217+
if (!certValid) {
218+
req.certVerification(certValid);
219+
}
208220
switch (method) {
209221
case AuthMethod::Argon:
210222
m_authListener.setFilter(req.post(fmt::format("{}/argon", HOST_URL)));

src/ui/popups/CommentPopup.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -112,6 +112,10 @@ void CommentPopup::onSubmit(CCObject*) {
112112
});
113113
web::WebRequest req = web::WebRequest();
114114
req.userAgent(USER_AGENT);
115+
auto certValid = Mod::get()->getSettingValue<bool>("cert-valid");
116+
if (!certValid) {
117+
req.certVerification(certValid);
118+
}
115119
auto myjson = matjson::Value();
116120
myjson.set("token", token);
117121

src/ui/popups/CommentsPopup.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -188,6 +188,10 @@ void CommentsPopup::onLoadComments(CCObject*) {
188188
});
189189
web::WebRequest req = web::WebRequest();
190190
req.userAgent(USER_AGENT);
191+
auto certValid = Mod::get()->getSettingValue<bool>("cert-valid");
192+
if (!certValid) {
193+
req.certVerification(certValid);
194+
}
191195
m_listener.setFilter(req.get(fmt::format("{}/objects/{}/comments?limit=10&page={}&filter={}", HOST_URL, m_object.id, m_object.commentPage, m_currentFilter)));
192196
}
193197

src/ui/popups/EditPopup.cpp

Lines changed: 65 additions & 55 deletions
Original file line numberDiff line numberDiff line change
@@ -80,67 +80,69 @@ bool EditPopup::setup(ObjectData obj, std::unordered_set<std::string> availableT
8080
auto previewLabel = CCLabelBMFont::create("Select an Object (For overwriting)", "goldFont.fnt");
8181
previewLabel->setScale(0.425F);
8282
m_previewBG->addChildAtPosition(previewLabel, Anchor::Top, {0,-8});
83-
83+
8484
if (auto editor = EditorUI::get()) {
85-
auto scrollLayer = ScrollLayerExt::create({ 0, 0, 275.0F, 280.0F }, true);
86-
scrollLayer->setContentSize({275.0F, 60.0F});
87-
scrollLayer->setAnchorPoint({0.5, 1.0});
88-
auto content = CCMenu::create();
89-
content->setScale(0.675F);
90-
content->setZOrder(2);
91-
content->setPositionX(20);
92-
content->registerWithTouchDispatcher();
93-
94-
scrollLayer->m_contentLayer->addChild(content);
95-
scrollLayer->setTouchEnabled(true);
96-
CCArrayExt<CreateMenuItem*> customItems = editor->createCustomItems();
97-
int size = customItems.size() - 4;
98-
for (int i = 0; i < size; i++) {
99-
customItems[i]->setID(fmt::format("{}", i));
100-
if (i > 17) {
101-
customItems[i]->setEnabled(false);
102-
}
103-
content->addChild(customItems[i]);
104-
}
105-
m_previewBG->addChild(scrollLayer);
106-
content->setLayout(
107-
RowLayout::create()
108-
->setAxisAlignment(AxisAlignment::Start)
109-
->setCrossAxisAlignment(AxisAlignment::End)
110-
->setAutoScale(true)
111-
->setCrossAxisOverflow(false)
112-
->setGap(5)
113-
->setGrowCrossAxis(true)
114-
);
115-
content->setContentSize({400.0F, 400.0F});
116-
content->setAnchorPoint({0.5, 1.0});
117-
content->setPosition({137, 280});
118-
content->updateLayout();
119-
cocos::handleTouchPriority(scrollLayer);
120-
scrollLayer->moveToTop();
121-
scrollLayer->fixTouchPrio();
122-
scrollLayer->setCallbackMove([size, content]() {
123-
if (content == nullptr) return;
85+
if (obj.authorAccId == user.account_id) {
86+
auto scrollLayer = ScrollLayerExt::create({ 0, 0, 275.0F, 280.0F }, true);
87+
scrollLayer->setContentSize({275.0F, 60.0F});
88+
scrollLayer->setAnchorPoint({0.5, 1.0});
89+
auto content = CCMenu::create();
90+
content->setScale(0.675F);
91+
content->setZOrder(2);
92+
content->setPositionX(20);
93+
content->registerWithTouchDispatcher();
94+
95+
scrollLayer->m_contentLayer->addChild(content);
96+
scrollLayer->setTouchEnabled(true);
97+
CCArrayExt<CreateMenuItem*> customItems = editor->createCustomItems();
98+
int size = customItems.size() - 4;
12499
for (int i = 0; i < size; i++) {
125-
if (auto child = typeinfo_cast<CreateMenuItem*>(content->getChildByID(fmt::format("{}", i)))) {
126-
child->setEnabled(false);
100+
customItems[i]->setID(fmt::format("{}", i));
101+
if (i > 17) {
102+
customItems[i]->setEnabled(false);
127103
}
104+
content->addChild(customItems[i]);
128105
}
129-
});
130-
scrollLayer->setCallbackEnd([size, content, scrollLayer]() {
131-
if (content == nullptr) return;
132-
for (int i = 0; i < size; i++) {
133-
if (auto child = typeinfo_cast<CreateMenuItem*>(content->getChildByID(fmt::format("{}", i)))) {
134-
float contentYPos = scrollLayer->m_contentLayer->getPositionY();
135-
float childYPos = (child->getPositionY());
106+
m_previewBG->addChild(scrollLayer);
107+
content->setLayout(
108+
RowLayout::create()
109+
->setAxisAlignment(AxisAlignment::Start)
110+
->setCrossAxisAlignment(AxisAlignment::End)
111+
->setAutoScale(true)
112+
->setCrossAxisOverflow(false)
113+
->setGap(5)
114+
->setGrowCrossAxis(true)
115+
);
116+
content->setContentSize({400.0F, 400.0F});
117+
content->setAnchorPoint({0.5, 1.0});
118+
content->setPosition({137, 280});
119+
content->updateLayout();
120+
cocos::handleTouchPriority(scrollLayer);
121+
scrollLayer->moveToTop();
122+
scrollLayer->fixTouchPrio();
123+
scrollLayer->setCallbackMove([size, content]() {
124+
if (content == nullptr) return;
125+
for (int i = 0; i < size; i++) {
126+
if (auto child = typeinfo_cast<CreateMenuItem*>(content->getChildByID(fmt::format("{}", i)))) {
127+
child->setEnabled(false);
128+
}
129+
}
130+
});
131+
scrollLayer->setCallbackEnd([size, content, scrollLayer]() {
132+
if (content == nullptr) return;
133+
for (int i = 0; i < size; i++) {
134+
if (auto child = typeinfo_cast<CreateMenuItem*>(content->getChildByID(fmt::format("{}", i)))) {
135+
float contentYPos = scrollLayer->m_contentLayer->getPositionY();
136+
float childYPos = (child->getPositionY());
136137

137-
child->setEnabled(!Utils::isInScrollSnapRange(contentYPos, childYPos));
138+
child->setEnabled(!Utils::isInScrollSnapRange(contentYPos, childYPos));
139+
}
138140
}
139-
}
140-
if (scrollLayer->m_contentLayer->getPositionY() > -220.F) {
141-
scrollLayer->m_contentLayer->setPositionY(Utils::getSnappedYPosition(scrollLayer->m_contentLayer->getPositionY(), 300)); // or 290
142-
}
143-
});
141+
if (scrollLayer->m_contentLayer->getPositionY() > -220.F) {
142+
scrollLayer->m_contentLayer->setPositionY(Utils::getSnappedYPosition(scrollLayer->m_contentLayer->getPositionY(), 300)); // or 290
143+
}
144+
});
145+
}
144146
m_mainLayer->addChildAtPosition(m_previewBG, Anchor::Center, {0, 65});
145147
}
146148
m_previewBG->setVisible(false);
@@ -196,6 +198,10 @@ void EditPopup::onUpdateBtn(CCObject*) {
196198
m_object.objectString = gameManager->stringForCustomObject(editor->m_selectedObjectIndex);
197199
web::WebRequest req = web::WebRequest();
198200
req.userAgent(USER_AGENT);
201+
auto certValid = Mod::get()->getSettingValue<bool>("cert-valid");
202+
if (!certValid) {
203+
req.certVerification(certValid);
204+
}
199205
auto myjson = matjson::Value();
200206
myjson.set("token", token);
201207
myjson.set("data", m_object.objectString);
@@ -231,6 +237,10 @@ void EditPopup::onUpdateBtn(CCObject*) {
231237
}
232238
web::WebRequest req = web::WebRequest();
233239
req.userAgent(USER_AGENT);
240+
auto certValid = Mod::get()->getSettingValue<bool>("cert-valid");
241+
if (!certValid) {
242+
req.certVerification(certValid);
243+
}
234244
auto myjson = matjson::Value();
235245
myjson.set("token", token);
236246
myjson.set("name", m_object.name);

0 commit comments

Comments
 (0)