overdid it with the image upload auth, making it a regular upload

This commit is contained in:
Ro 2021-08-02 15:34:21 -07:00
parent cad32ace74
commit b3c47d6721
4 changed files with 27 additions and 22 deletions

View file

@ -188,21 +188,30 @@ class APIControl
break; break;
case "settings": case "settings":
$token = $request->getHeader("fipamo-access-token"); if (isset($body)) {
if (Session::verifyToken($token[0])) { $postBody = $body;
if (isset($body)) { } else {
$postBody = $body; $postBody = null;
} else { }
$postBody = null; $task = $args["fourth"];
} if ($task == "add-feature-background" || $task == "add-avatar") {
$result = SettingsAPI::handleSettingsTask($request, $args, $postBody); $result = SettingsAPI::handleSettingsTask($request, $args, $postBody);
} else { } else {
$result = [ $token = $request->getHeader("fipamo-access-token");
"message" => "API access denied, homie", if (Session::verifyToken($token[0])) {
"type" => "API_ERROR", $result = SettingsAPI::handleSettingsTask(
]; $request,
$args,
$postBody
);
} else {
$result = [
"message" => "API access denied, homie",
"type" => "API_ERROR",
];
}
} }
break; break;
case "mailer": case "mailer":
$result = MailerAPI::handleMail($request, $body, $response); $result = MailerAPI::handleMail($request, $body, $response);

File diff suppressed because one or more lines are too long

View file

@ -266,8 +266,7 @@ class MaintenanceManager {
} }
}; };
if (requestType == REQUEST_TYPE_PUT || requestType == REQUEST_TYPE_POST) { if (requestType == REQUEST_TYPE_PUT || requestType == REQUEST_TYPE_POST) {
if (eventType === TASK_UPLOAD_FILES) //if (eventType === TASK_UPLOAD_FILES) request.setRequestHeader("fipamo-access-token", self.token);
request.setRequestHeader("fipamo-access-token", self.token);
switch (contentType) { switch (contentType) {
case CONTENT_TYPE_JSON: case CONTENT_TYPE_JSON:
request.setRequestHeader( request.setRequestHeader(

View file

@ -18,10 +18,7 @@ export default class SettingsIndex {
null, null,
"fe79df250470815bf32dcea70221384c89163cad3a827a9c3da25d87159ed55a" "fe79df250470815bf32dcea70221384c89163cad3a827a9c3da25d87159ed55a"
); );
this.mm = new Maintenance( this.mm = new Maintenance(null, null);
null,
"fe79df250470815bf32dcea70221384c89163cad3a827a9c3da25d87159ed55a"
);
} }
//-------------------------- //--------------------------
// methods // methods