Restored cookie authentication in EEPROM.

This commit is contained in:
flash 2023-11-10 14:20:05 +00:00
parent 4304b956dd
commit 5c2931cb54
2 changed files with 9 additions and 2 deletions

View file

@ -110,7 +110,8 @@ EEPROM.EEPROMDeleteTask = function(authorization, fileInfo) {
obj.start = function() { obj.start = function() {
xhr.open('DELETE', obj.fileInfo.urlf); xhr.open('DELETE', obj.fileInfo.urlf);
xhr.setRequestHeader('Authorization', obj.authorization); if(obj.authorization) xhr.setRequestHeader('Authorization', obj.authorization);
else xhr.withCredentials = true;
xhr.send(); xhr.send();
}; };
@ -203,7 +204,8 @@ EEPROM.EEPROMUploadTask = function(srcId, endpoint, authorization, file) {
obj.start = function() { obj.start = function() {
xhr.open('POST', obj.endpoint); xhr.open('POST', obj.endpoint);
xhr.setRequestHeader('Authorization', obj.authorization); if(obj.authorization) xhr.setRequestHeader('Authorization', obj.authorization);
else xhr.withCredentials = true;
xhr.send(fd); xhr.send(fd);
}; };

View file

@ -16,6 +16,11 @@ class AuthRoutes extends RouteHandler {
#[Route('/')] #[Route('/')]
public function getIndex($response, $request) { public function getIndex($response, $request) {
$auth = $request->getHeaderLine('Authorization'); $auth = $request->getHeaderLine('Authorization');
if(empty($auth)) {
$cookie = (string)$request->getCookie('msz_auth');
if(!empty($cookie))
$auth = sprintf('Misuzu %s', $cookie);
}
if(!empty($auth)) { if(!empty($auth)) {
$authParts = explode(' ', $auth, 2); $authParts = explode(' ', $auth, 2);