Initial commit. Implemented OAuth, Linodes, volumes, and images
This commit is contained in:
32
logout/index.html
Normal file
32
logout/index.html
Normal file
@ -0,0 +1,32 @@
|
||||
<!--
|
||||
This file is part of Linode Manager Classic.
|
||||
|
||||
Linode Manager Classic is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
Linode Manager Classic is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with Linode Manager Classic. If not, see <https://www.gnu.org/licenses/>.
|
||||
-->
|
||||
<!DOCTYPE HTML>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
||||
<title>LMC - Logout</title>
|
||||
<link rel="shortcut icon" type="image/x-icon" href="/favicon.ico" />
|
||||
<link rel="stylesheet" type="text/css" href="logout.css" />
|
||||
<script src="logout.js" type="module"></script>
|
||||
</head>
|
||||
<body>
|
||||
<fieldset>
|
||||
<legend>Linode Manager Classic</legend>
|
||||
Logging out...
|
||||
</fieldset>
|
||||
</body>
|
||||
</html>
|
38
logout/logout.css
Normal file
38
logout/logout.css
Normal file
@ -0,0 +1,38 @@
|
||||
/*
|
||||
* This file is part of Linode Manager Classic.
|
||||
*
|
||||
* Linode Manager Classic is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* Linode Manager Classic is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with Linode Manager Classic. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
@import url('/global.css');
|
||||
|
||||
body {
|
||||
background-color: #F8F8F8;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
fieldset {
|
||||
background-color: #FFF;
|
||||
border: 6px solid #999;
|
||||
font-size: 50px;
|
||||
font-weight: bold;
|
||||
margin: 120px auto 10px;
|
||||
padding: 15px;
|
||||
width: 500px;
|
||||
}
|
||||
|
||||
legend {
|
||||
font-size: 36px;
|
||||
font-weight: bold;
|
||||
}
|
59
logout/logout.js
Normal file
59
logout/logout.js
Normal file
@ -0,0 +1,59 @@
|
||||
/*
|
||||
* This file is part of Linode Manager Classic.
|
||||
*
|
||||
* Linode Manager Classic is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* Linode Manager Classic is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with Linode Manager Classic. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
import { settings, elements, oauthPost, parseParams } from "/global.js";
|
||||
import { clientID } from "/clientID.js";
|
||||
|
||||
(function()
|
||||
{
|
||||
// Data recieved from API calls
|
||||
var data = {};
|
||||
|
||||
// Callback for token revoke
|
||||
var redirect = function(response)
|
||||
{
|
||||
localStorage.clear();
|
||||
location.href = "/";
|
||||
};
|
||||
|
||||
// Initial setup
|
||||
var setup = function()
|
||||
{
|
||||
// Parse URL parameters
|
||||
data.params = parseParams();
|
||||
|
||||
// Revoke only if we have an unexpired token
|
||||
if (localStorage.apiKey && localStorage.apiExpire) {
|
||||
var now = new Date();
|
||||
var expires = new Date(parseInt(localStorage.apiExpire));
|
||||
if (expires > now) {
|
||||
var req = new URLSearchParams();
|
||||
req.set("client_id", clientID);
|
||||
req.set("token", localStorage.apiKey);
|
||||
oauthPost("/revoke", req, redirect);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
// Otherwise clear everything and redirect to login
|
||||
localStorage.clear();
|
||||
location.href = "/";
|
||||
};
|
||||
|
||||
// Attach onload handler
|
||||
window.addEventListener("load", setup);
|
||||
})();
|
Reference in New Issue
Block a user