mirror of
https://github.com/lrsjng/h5ai.git
synced 2025-05-28 14:04:45 -04:00
Changes some API things.
This commit is contained in:
parent
811994423d
commit
a60d5556af
13 changed files with 36 additions and 33 deletions
|
@ -77,7 +77,7 @@ class Api {
|
|||
}
|
||||
|
||||
|
||||
else if ($action === "getthumbsrc") {
|
||||
else if ($action === "getThumbHref") {
|
||||
|
||||
if (!$options["thumbnails"]["enabled"]) {
|
||||
json_fail(1, "thumbnails disabled");
|
||||
|
@ -100,7 +100,7 @@ class Api {
|
|||
}
|
||||
|
||||
|
||||
else if ($action === "archive") {
|
||||
else if ($action === "createArchive") {
|
||||
|
||||
json_fail(1, "downloads disabled", !$options["download"]["enabled"]);
|
||||
|
||||
|
@ -120,7 +120,7 @@ class Api {
|
|||
}
|
||||
|
||||
|
||||
else if ($action === "getarchive") {
|
||||
else if ($action === "getArchive") {
|
||||
|
||||
json_fail(1, "downloads disabled", !$options["download"]["enabled"]);
|
||||
|
||||
|
@ -222,11 +222,6 @@ class Api {
|
|||
|
||||
json_exit();
|
||||
}
|
||||
|
||||
|
||||
else {
|
||||
json_fail(100, "unsupported action");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -292,7 +292,7 @@ class App {
|
|||
|
||||
return array(
|
||||
"backend" => "php",
|
||||
"apiHref" => $this->app_abs_href . "server/php/api.php",
|
||||
"api" => true,
|
||||
"name" => strtolower(preg_replace("/\\/.*$/", "", getenv("SERVER_SOFTWARE"))),
|
||||
"version" => strtolower(preg_replace("/^.*\\//", "", preg_replace("/\\s.*$/", "", getenv("SERVER_SOFTWARE"))))
|
||||
);
|
||||
|
|
|
@ -77,6 +77,7 @@ class Archive {
|
|||
|
||||
$real_file = $this->app->get_abs_path($href);
|
||||
$archived_file = preg_replace("!^" . normalize_path($this->app->get_root_abs_path(), true) . "!", "", $real_file);
|
||||
// $archived_file = preg_replace("!^" . normalize_path($this->app->get_abs_path(), true) . "!", "", $real_file);
|
||||
|
||||
if (is_dir($real_file)) {
|
||||
$this->add_dir($real_file, $archived_file);
|
||||
|
|
|
@ -19,14 +19,25 @@ normalized_require_once("/server/php/inc/util.php");
|
|||
normalized_require_once("/server/php/inc/App.php");
|
||||
normalized_require_once("/server/php/inc/Entry.php");
|
||||
|
||||
$APP = new App(APP_ABS_PATH, APP_ABS_HREF, ABS_HREF);
|
||||
$app = new App(APP_ABS_PATH, APP_ABS_HREF, ABS_HREF);
|
||||
|
||||
if (array_key_exists("api", $_REQUEST)) {
|
||||
if (count($_REQUEST)) {
|
||||
|
||||
header("Content-type: application/json;h5ai={{pkg.version}}");
|
||||
|
||||
use_request_params("api");
|
||||
normalized_require_once("/server/php/inc/Api.php");
|
||||
$api = new Api($APP);
|
||||
$api = new Api($app);
|
||||
$api->apply();
|
||||
|
||||
json_fail(100, "unsupported request");
|
||||
|
||||
} else {
|
||||
|
||||
header("Content-type: text/html;h5ai={{pkg.version}}");
|
||||
|
||||
$HREF = $app->get_app_abs_href();
|
||||
$JSON = $app->get_generic_json();
|
||||
$FALLBACK = $app->get_no_js_fallback();
|
||||
}
|
||||
|
||||
?>
|
|
@ -1,9 +1,8 @@
|
|||
|<?php require_once(str_replace("\\", "/", dirname(__FILE__)) . "/inc/init.php"); ?>
|
||||
|<?php header("Content-type: text/html;h5ai={{pkg.version}}"); ?>
|
||||
|
||||
- var href = "<?php echo $APP->get_app_abs_href(); ?>"
|
||||
- var json = "<?php echo $APP->get_generic_json(); ?>"
|
||||
- var fallback = "<?php echo $APP->get_no_js_fallback(); ?>"
|
||||
- var href = "<?php echo $HREF; ?>"
|
||||
- var json = "<?php echo $JSON; ?>"
|
||||
- var fallback = "<?php echo $FALLBACK; ?>"
|
||||
|
||||
doctype 5
|
||||
//if lt IE 9
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue