1
0
Fork 0

removed html/admin, / now redirects to /_admin/aardvark by default

This commit is contained in:
Jan Steemann 2013-08-29 12:59:56 +02:00
parent a9f486a0b0
commit 0aca109a89
12 changed files with 57 additions and 176 deletions

View File

@ -236,18 +236,18 @@ nobase_pkgdata_DATA = \
$(shell find @srcdir@/js/client -name "*.js" -print) \
$(shell find @srcdir@/js/node -type f -print) \
$(shell find @srcdir@/js/npm -type f -print) \
$(shell find @srcdir@/html -name "*.css" -print) \
$(shell find @srcdir@/html -name "*.scss" -print) \
$(shell find @srcdir@/html -name "*.gif" -print) \
$(shell find @srcdir@/html -name "*.html" -print) \
$(shell find @srcdir@/html -name "*.ico" -print) \
$(shell find @srcdir@/html -name "*.js" -print) \
$(shell find @srcdir@/html -name "*.ejs" -print) \
$(shell find @srcdir@/html -name "*.png" -print) \
$(shell find @srcdir@/html -name "*.svg" -print) \
$(shell find @srcdir@/html -name "*.eot" -print) \
$(shell find @srcdir@/html -name "*.ttf" -print) \
$(shell find @srcdir@/html -name "*.woff" -print) \
$(shell find @srcdir@/js/apps -name "*.css" -print) \
$(shell find @srcdir@/js/apps -name "*.scss" -print) \
$(shell find @srcdir@/js/apps -name "*.gif" -print) \
$(shell find @srcdir@/js/apps -name "*.html" -print) \
$(shell find @srcdir@/js/apps -name "*.ico" -print) \
$(shell find @srcdir@/js/apps -name "*.js" -print) \
$(shell find @srcdir@/js/apps -name "*.ejs" -print) \
$(shell find @srcdir@/js/apps -name "*.png" -print) \
$(shell find @srcdir@/js/apps -name "*.svg" -print) \
$(shell find @srcdir@/js/apps -name "*.eot" -print) \
$(shell find @srcdir@/js/apps -name "*.ttf" -print) \
$(shell find @srcdir@/js/apps -name "*.woff" -print) \
$(shell find @srcdir@/js/apps -type f -print)
if ENABLE_MRUBY

View File

@ -303,7 +303,6 @@ void ArangoServer::buildApplicationServer () {
_applicationAdminServer->allowLogViewer();
_applicationAdminServer->allowVersion("arango", TRI_VERSION);
_applicationAdminServer->allowAdminDirectory(); // might be changed later
// .............................................................................
// define server options
@ -384,11 +383,8 @@ void ArangoServer::buildApplicationServer () {
// for this server we display our own options such as port to use
// .............................................................................
bool disableAdminInterface = false;
additional[ApplicationServer::OPTIONS_SERVER + ":help-admin"]
("server.authenticate-system-only", &_authenticateSystemOnly, "use HTTP authentication only for requests to /_api and /_admin")
("server.disable-admin-interface", &disableAdminInterface, "turn off the HTML admin interface")
("server.multiple-databases", &_multipleDatabases, "start in multiple database mode")
("server.disable-replication-logger", &_disableReplicationLogger, "start with replication logger turned off")
("server.disable-replication-applier", &_disableReplicationApplier, "start with replication applier turned off")
@ -464,14 +460,6 @@ void ArangoServer::buildApplicationServer () {
Nonce::create(optionNonceHashSize);
}
// .............................................................................
// disable access to the HTML admin interface
// .............................................................................
if (disableAdminInterface) {
_applicationAdminServer->allowAdminDirectory(false);
}
if (disableStatistics) {
TRI_ENABLE_STATISTICS = false;
}
@ -590,7 +578,6 @@ int ArangoServer::startupServer () {
_applicationV8->setVocbase(_vocbase);
_applicationV8->setConcurrency(_dispatcherThreads);
_applicationV8->setAdminDirectory(_applicationAdminServer->adminDirectory());
if (_applicationServer->programOptions().has("upgrade")) {
_applicationV8->performUpgrade();
@ -703,7 +690,6 @@ int ArangoServer::executeConsole (OperationMode::server_operation_mode_e mode) {
// set-up V8 context
_applicationV8->setVocbase(_vocbase);
_applicationV8->setAdminDirectory(_applicationAdminServer->adminDirectory());
_applicationV8->setConcurrency(1);
if (_applicationServer->programOptions().has("upgrade")) {

View File

@ -193,7 +193,6 @@ ApplicationV8::ApplicationV8 (string const& binaryPath)
_v8Options(""),
_startupLoader(),
_actionLoader(),
_adminDirectory(),
_vocbase(0),
_nrInstances(0),
_contexts(0),
@ -736,7 +735,7 @@ bool ApplicationV8::prepareV8Instance (const size_t i) {
context->_context->Enter();
TRI_InitV8VocBridge(context->_context, _vocbase, _adminDirectory, i);
TRI_InitV8VocBridge(context->_context, _vocbase, i);
TRI_InitV8Queries(context->_context);

View File

@ -194,14 +194,6 @@ namespace triagens {
/// @{
////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////
/// @brief sets the web admin directory for access from V8
////////////////////////////////////////////////////////////////////////////////
void setAdminDirectory (const string& directory) {
_adminDirectory = directory;
}
////////////////////////////////////////////////////////////////////////////////
/// @brief sets the concurrency
////////////////////////////////////////////////////////////////////////////////
@ -539,12 +531,6 @@ namespace triagens {
JSLoader _actionLoader;
////////////////////////////////////////////////////////////////////////////////
/// @brief web admin directory
////////////////////////////////////////////////////////////////////////////////
string _adminDirectory;
////////////////////////////////////////////////////////////////////////////////
/// @brief system database
////////////////////////////////////////////////////////////////////////////////

View File

@ -8518,7 +8518,6 @@ int32_t TRI_GetVocBaseColType () {
void TRI_InitV8VocBridge (v8::Handle<v8::Context> context,
TRI_vocbase_t* vocbase,
const string& adminDirectory,
const size_t threadNumber) {
v8::HandleScope scope;
@ -8772,7 +8771,6 @@ void TRI_InitV8VocBridge (v8::Handle<v8::Context> context,
// current thread number
context->Global()->Set(TRI_V8_SYMBOL("THREAD_NUMBER"), v8::Number::New(threadNumber), v8::ReadOnly);
context->Global()->Set(TRI_V8_SYMBOL("ADMIN_DIRECTORY"), v8::String::New(adminDirectory.c_str(), adminDirectory.size()));
}
////////////////////////////////////////////////////////////////////////////////

View File

@ -90,7 +90,6 @@ int32_t TRI_GetVocBaseColType ();
void TRI_InitV8VocBridge (v8::Handle<v8::Context>,
TRI_vocbase_t*,
const std::string&,
const size_t);
////////////////////////////////////////////////////////////////////////////////

View File

@ -1,11 +0,0 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta http-equiv="refresh" content="0; URL=/_admin/aardvark/index.html">
</head>
<body>
Redirecting...
</body>
</html>

View File

@ -17,7 +17,7 @@
COLOR_BOLD_WHITE, COLOR_YELLOW, COLOR_BOLD_YELLOW, COLOR_CYAN, COLOR_BOLD_CYAN, COLOR_MAGENTA,
COLOR_BOLD_MAGENTA, PRETTY_PRINT, VALGRIND, VERSION, UPGRADE,
BYTES_SENT_DISTRIBUTION, BYTES_RECEIVED_DISTRIBUTION, CONNECTION_TIME_DISTRIBUTION,
REQUEST_TIME_DISTRIBUTION, ADMIN_DIRECTORY, DEVELOPMENT_MODE, THREAD_NUMBER,
REQUEST_TIME_DISTRIBUTION, DEVELOPMENT_MODE, THREAD_NUMBER,
SYS_PLATFORM */
////////////////////////////////////////////////////////////////////////////////
@ -110,17 +110,6 @@
delete THREAD_NUMBER;
}
////////////////////////////////////////////////////////////////////////////////
/// @brief adminDirectory
////////////////////////////////////////////////////////////////////////////////
exports.adminDirectory = null;
if (typeof ADMIN_DIRECTORY !== "undefined") {
exports.adminDirectory = ADMIN_DIRECTORY;
delete ADMIN_DIRECTORY;
}
////////////////////////////////////////////////////////////////////////////////
/// @brief developmentMode
////////////////////////////////////////////////////////////////////////////////

View File

@ -17,7 +17,7 @@
COLOR_BOLD_WHITE, COLOR_YELLOW, COLOR_BOLD_YELLOW, COLOR_CYAN, COLOR_BOLD_CYAN, COLOR_MAGENTA,
COLOR_BOLD_MAGENTA, PRETTY_PRINT, VALGRIND, VERSION, UPGRADE,
BYTES_SENT_DISTRIBUTION, BYTES_RECEIVED_DISTRIBUTION, CONNECTION_TIME_DISTRIBUTION,
REQUEST_TIME_DISTRIBUTION, ADMIN_DIRECTORY, DEVELOPMENT_MODE, THREAD_NUMBER,
REQUEST_TIME_DISTRIBUTION, DEVELOPMENT_MODE, THREAD_NUMBER,
SYS_PLATFORM */
////////////////////////////////////////////////////////////////////////////////
@ -110,17 +110,6 @@
delete THREAD_NUMBER;
}
////////////////////////////////////////////////////////////////////////////////
/// @brief adminDirectory
////////////////////////////////////////////////////////////////////////////////
exports.adminDirectory = null;
if (typeof ADMIN_DIRECTORY !== "undefined") {
exports.adminDirectory = ADMIN_DIRECTORY;
delete ADMIN_DIRECTORY;
}
////////////////////////////////////////////////////////////////////////////////
/// @brief developmentMode
////////////////////////////////////////////////////////////////////////////////

View File

@ -305,14 +305,26 @@
});
// create the default route in the _routing collection
addTask("insertDefaultRoute", "insert default route for the admin interface", function () {
addTask("insertDefaultRouteJsApps", "insert default route for the admin interface", function () {
var routing = getCollection("_routing");
if (! routing) {
return false;
}
if (routing.count() === 0) {
var mustReplace = false;
// first, check for "old" redirects
routing.toArray().forEach(function (doc) {
// check for a specific redirect
if (doc.url === '/' && doc.action.options.destination === '/_admin/html/index.html') {
// remove old, non-working redirect
routing.remove(doc);
mustReplace = true;
}
});
if (mustReplace || routing.count() === 0) {
// only add route if no other route has been defined
routing.save({
url: "/",
@ -320,7 +332,7 @@
"do": "org/arangodb/actions/redirectRequest",
options: {
permanently: true,
destination: "/_admin/html/index.html"
destination: "/_admin/aardvark/index.html"
}
},
priority: -1000000

View File

@ -43,6 +43,28 @@ using namespace triagens::basics;
using namespace triagens::rest;
using namespace triagens::admin;
// -----------------------------------------------------------------------------
// --SECTION-- private variables
// -----------------------------------------------------------------------------
////////////////////////////////////////////////////////////////////////////////
/// @addtogroup RestServer
/// @{
////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////
/// @brief variables to hold legacy options (unused, but kept here so that
/// starting the server with deprecated options doesn't fail
////////////////////////////////////////////////////////////////////////////////
static string UnusedAdminDirectory;
static bool UnusedDisableAdminInterface;
////////////////////////////////////////////////////////////////////////////////
/// @}
////////////////////////////////////////////////////////////////////////////////
// -----------------------------------------------------------------------------
// --SECTION-- constructors and destructors
// -----------------------------------------------------------------------------
@ -59,9 +81,7 @@ using namespace triagens::admin;
ApplicationAdminServer::ApplicationAdminServer ()
: ApplicationFeature("admin"),
_allowLogViewer(false),
_allowAdminDirectory(false),
_allowVersion(false),
_adminDirectory(),
_pathOptions(0),
_name(),
_version(),
@ -111,31 +131,6 @@ void ApplicationAdminServer::allowLogViewer () {
_allowLogViewer = true;
}
////////////////////////////////////////////////////////////////////////////////
/// @brief allows for a webadmin directory
////////////////////////////////////////////////////////////////////////////////
void ApplicationAdminServer::allowAdminDirectory () {
_allowAdminDirectory = true;
}
////////////////////////////////////////////////////////////////////////////////
/// @brief allows or disallows webadmin directory
////////////////////////////////////////////////////////////////////////////////
void ApplicationAdminServer::allowAdminDirectory (bool value) {
_allowAdminDirectory = value;
}
////////////////////////////////////////////////////////////////////////////////
/// @brief allows for a webadmin directory
////////////////////////////////////////////////////////////////////////////////
void ApplicationAdminServer::allowAdminDirectory (string const& adminDirectory) {
_allowAdminDirectory = true;
_adminDirectory = adminDirectory;
}
////////////////////////////////////////////////////////////////////////////////
/// @brief allows for a version handler using the default version
////////////////////////////////////////////////////////////////////////////////
@ -207,22 +202,6 @@ void ApplicationAdminServer::addHandlers (HttpHandlerFactory* factory, string co
if (_allowLogViewer) {
factory->addHandler(prefix + "/log", RestHandlerCreator<RestAdminLogHandler>::createNoData, 0);
}
// .............................................................................
// add a web-admin directory
// .............................................................................
if (_allowAdminDirectory) {
LOGGER_DEBUG("using JavaScript front-end path '" << _adminDirectory << "'");
reinterpret_cast<PathHandler::Options*>(_pathOptions)->path = _adminDirectory;
reinterpret_cast<PathHandler::Options*>(_pathOptions)->contentType = "text/plain";
reinterpret_cast<PathHandler::Options*>(_pathOptions)->allowSymbolicLink = false;
reinterpret_cast<PathHandler::Options*>(_pathOptions)->defaultFile = "index.html";
reinterpret_cast<PathHandler::Options*>(_pathOptions)->cacheMaxAge = 86400;
factory->addPrefixHandler(prefix + "/html", RestHandlerCreator<PathHandler>::createData<PathHandler::Options*>, _pathOptions);
}
}
////////////////////////////////////////////////////////////////////////////////
@ -243,11 +222,11 @@ void ApplicationAdminServer::addHandlers (HttpHandlerFactory* factory, string co
////////////////////////////////////////////////////////////////////////////////
void ApplicationAdminServer::setupOptions (map<string, basics::ProgramOptionsDescription>& options) {
if (_allowAdminDirectory) {
options[ApplicationServer::OPTIONS_SERVER + ":help-admin"]
("server.admin-directory", &_adminDirectory, "directory containing the ADMIN front-end")
;
}
// deprecated
options[ApplicationServer::OPTIONS_HIDDEN]
("server.admin-directory", &UnusedAdminDirectory, "directory containing the ADMIN front-end (deprecated)")
("server.disable-admin-interface", &UnusedDisableAdminInterface, "turn off the HTML admin interface (deprecated)")
;
}
////////////////////////////////////////////////////////////////////////////////
@ -255,10 +234,6 @@ void ApplicationAdminServer::setupOptions (map<string, basics::ProgramOptionsDes
////////////////////////////////////////////////////////////////////////////////
bool ApplicationAdminServer::prepare () {
if (_allowAdminDirectory && _adminDirectory.empty()) {
LOGGER_FATAL_AND_EXIT("you must specify an admin directory, giving up!");
}
return true;
}

View File

@ -111,35 +111,6 @@ namespace triagens {
void allowLogViewer ();
////////////////////////////////////////////////////////////////////////////////
/// @brief allows for a webadmin directory
////////////////////////////////////////////////////////////////////////////////
void allowAdminDirectory ();
////////////////////////////////////////////////////////////////////////////////
/// @brief allows or disallows webadmin directory
////////////////////////////////////////////////////////////////////////////////
void allowAdminDirectory (bool);
////////////////////////////////////////////////////////////////////////////////
/// @brief allows for a webadmin directory
////////////////////////////////////////////////////////////////////////////////
void allowAdminDirectory (string const& adminDirectory);
////////////////////////////////////////////////////////////////////////////////
/// @brief get the configured admin directory
////////////////////////////////////////////////////////////////////////////////
string adminDirectory () const {
if (_allowAdminDirectory) {
return _adminDirectory;
}
return "";
}
////////////////////////////////////////////////////////////////////////////////
/// @brief allows for a version handler using the default version
////////////////////////////////////////////////////////////////////////////////
@ -216,24 +187,12 @@ namespace triagens {
bool _allowLogViewer;
////////////////////////////////////////////////////////////////////////////////
/// @brief allow log admin directory
////////////////////////////////////////////////////////////////////////////////
bool _allowAdminDirectory;
////////////////////////////////////////////////////////////////////////////////
/// @brief allow version request
////////////////////////////////////////////////////////////////////////////////
bool _allowVersion;
////////////////////////////////////////////////////////////////////////////////
/// @brief the directory containing the admin files
////////////////////////////////////////////////////////////////////////////////
string _adminDirectory;
////////////////////////////////////////////////////////////////////////////////
/// @brief path options for the admin directory
////////////////////////////////////////////////////////////////////////////////