From 219a56d6cd8ef88ed806d8d248f057a8ec005103 Mon Sep 17 00:00:00 2001 From: ghost Date: Wed, 3 May 2023 05:47:02 +0300 Subject: [PATCH] update manifest API --- config/app.php.txt | 21 --------------------- public/api.php | 40 ++++++++++++++++++---------------------- 2 files changed, 18 insertions(+), 43 deletions(-) diff --git a/config/app.php.txt b/config/app.php.txt index 490f00f..ab224c6 100644 --- a/config/app.php.txt +++ b/config/app.php.txt @@ -41,27 +41,6 @@ ini_set('display_errors', '1'); ini_set('display_startup_errors', '1'); error_reporting(E_ALL); -// Application - -/* - * Unique project name - * - * using to ident the app in the YGGo ecosystem - * - */ -define('APPLICATION_NAME', 'My YGGo host'); - -/* - * Application mode - * - * FEDERATIVE - crawl and share distributed index from other YGGo nodes running on same API version - * LOCAL - encapsulated web search portal - * - * see also: API_ENABLED, API_MANIFEST_ENABLED settings - * - */ -define('APPLICATION_MODE', 'FEDERATIVE'); - // Website /* diff --git a/public/api.php b/public/api.php index 6f0ef74..cd28e33 100644 --- a/public/api.php +++ b/public/api.php @@ -1,7 +1,7 @@ true, 'result' => [ - 'applicationName' => APPLICATION_NAME, - 'applicationMode' => APPLICATION_MODE, - 'applicationUrl' => WEBSITE_DOMAIN, - - 'crawlUrlRegexp' => CRAWL_URL_REGEXP, - - 'crawlHostDefaultPagesLimit' => CRAWL_HOST_DEFAULT_PAGES_LIMIT, - 'crawlHostDefaultStatus' => CRAWL_HOST_DEFAULT_STATUS, - 'crawlHostDefaultMetaOnly' => CRAWL_HOST_DEFAULT_META_ONLY, - - 'crawlHostPageSecondsOffset' => CRAWL_PAGE_SECONDS_OFFSET, - 'cleanHostSecondsOffset' => CLEAN_HOST_SECONDS_OFFSET, - - 'crawlRobotsDefaultRules' => CRAWL_ROBOTS_DEFAULT_RULES, - 'crawlRobotsPostfixRules' => CRAWL_ROBOTS_POSTFIX_RULES, - - 'apiVersion' => API_VERSION, - - 'apiEnabled' => API_ENABLED, - 'apiSearchEnabled' => API_SEARCH_ENABLED, - 'apiHostsEnabled' => API_HOSTS_ENABLED, + 'config' => [ + 'websiteDomain' => WEBSITE_DOMAIN, + 'crawlUrlRegexp' => CRAWL_URL_REGEXP, + 'crawlHostDefaultPagesLimit' => CRAWL_HOST_DEFAULT_PAGES_LIMIT, + 'crawlHostDefaultStatus' => CRAWL_HOST_DEFAULT_STATUS, + 'crawlHostDefaultMetaOnly' => CRAWL_HOST_DEFAULT_META_ONLY, + 'crawlHostPageSecondsOffset' => CRAWL_PAGE_SECONDS_OFFSET, + 'cleanHostSecondsOffset' => CLEAN_HOST_SECONDS_OFFSET, + 'crawlRobotsDefaultRules' => CRAWL_ROBOTS_DEFAULT_RULES, + 'crawlRobotsPostfixRules' => CRAWL_ROBOTS_POSTFIX_RULES, + ], + 'api' => [ + 'version' => API_VERSION, + 'manifest' => API_ENABLED && API_MANIFEST_ENABLED ? WEBSITE_DOMAIN . '/api.php?action=manifest' : false, + 'search' => API_ENABLED && API_SEARCH_ENABLED ? WEBSITE_DOMAIN . '/api.php?action=search' : false, + 'hosts' => API_ENABLED && API_HOSTS_ENABLED ? WEBSITE_DOMAIN . '/api.php?action=hosts' : false, + ] ], ];