mirror of
https://github.com/lrsjng/h5ai.git
synced 2025-05-27 05:24:25 -04:00
Add optional info page protection.
This commit is contained in:
parent
db4932b9ce
commit
96480a5c50
7 changed files with 218 additions and 54 deletions
|
@ -8,7 +8,7 @@ class Api {
|
|||
|
||||
public function __construct($app) {
|
||||
|
||||
$this->actions = array("get", "getThumbHref", "download", "upload", "delete", "rename");
|
||||
$this->actions = array("login", "logout", "get", "getThumbHref", "download");
|
||||
$this->app = $app;
|
||||
$this->options = $app->get_options();
|
||||
}
|
||||
|
@ -24,6 +24,21 @@ class Api {
|
|||
}
|
||||
|
||||
|
||||
private function on_login() {
|
||||
|
||||
$pass = use_request_param("pass");
|
||||
$_SESSION[AS_ADMIN_SESSION_KEY] = sha1($pass) === PASSHASH;
|
||||
json_exit(array("as_admin" => $_SESSION[AS_ADMIN_SESSION_KEY]));
|
||||
}
|
||||
|
||||
|
||||
private function on_logout() {
|
||||
|
||||
$_SESSION[AS_ADMIN_SESSION_KEY] = false;
|
||||
json_exit(array("as_admin" => $_SESSION[AS_ADMIN_SESSION_KEY]));
|
||||
}
|
||||
|
||||
|
||||
private function on_get() {
|
||||
|
||||
$response = array();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue