From 8029f56d1c19d2906ed7b867721586db7c53c2b5 Mon Sep 17 00:00:00 2001 From: zotlabs Date: Fri, 9 Dec 2016 12:38:53 -0800 Subject: router error reporting --- Zotlabs/Web/Router.php | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/Zotlabs/Web/Router.php b/Zotlabs/Web/Router.php index a3bad29ae..271836ba9 100644 --- a/Zotlabs/Web/Router.php +++ b/Zotlabs/Web/Router.php @@ -137,15 +137,21 @@ class Router { killme(); } - logger("Module {$module} not found.", LOGGER_DEBUG, LOG_WARNING); - - if((x($_SERVER, 'QUERY_STRING')) && ($_SERVER['QUERY_STRING'] === 'q=internal_error.html') && \App::$config['system']['dreamhost_error_hack']) { - logger('index.php: dreamhost_error_hack invoked. Original URI =' . $_SERVER['REQUEST_URI']); + if((x($_SERVER, 'QUERY_STRING')) + && ($_SERVER['QUERY_STRING'] === 'q=internal_error.html') + && \App::$config['system']['dreamhost_error_hack']) { + logger('index.php: dreamhost_error_hack invoked. Original URI =' . $_SERVER['REQUEST_URI'],LOGGER_DEBUG); goaway(z_root() . $_SERVER['REQUEST_URI']); } - logger('index.php: page not found: ' . $_SERVER['REQUEST_URI'] . ' ADDRESS: ' . $_SERVER['REMOTE_ADDR'] . ' QUERY: ' . $_SERVER['QUERY_STRING'], LOGGER_DEBUG); - header($_SERVER['SERVER_PROTOCOL'] . ' 404 ' . t('Not Found')); + if(get_config('system','log_404',true)) { + logger("Module {$module} not found.", LOGGER_DEBUG, LOG_WARNING); + logger('index.php: page not found: ' . $_SERVER['REQUEST_URI'] + . ' ADDRESS: ' . $_SERVER['REMOTE_ADDR'] . ' QUERY: ' + . $_SERVER['QUERY_STRING'], LOGGER_DEBUG); + } + + header($_SERVER['SERVER_PROTOCOL'] . ' 404 Not Found'); $tpl = get_markup_template('404.tpl'); \App::$page['content'] = replace_macros($tpl, array( '$message' => t('Page not found.') -- cgit v1.2.3 From 82d09c288d3bdf88facd6a4c82d2a309efd7d3a1 Mon Sep 17 00:00:00 2001 From: zotlabs Date: Fri, 9 Dec 2016 13:29:41 -0800 Subject: bring back a few of the doc edits from overlapping checkins --- doc/about/about_hubzilla.bb | 6 +- doc/developer/api_zot.md | 241 +++++++++++++++++++++++++++++++++++++++++++- 2 files changed, 240 insertions(+), 7 deletions(-) diff --git a/doc/about/about_hubzilla.bb b/doc/about/about_hubzilla.bb index bbe7e1604..a4873f5fb 100644 --- a/doc/about/about_hubzilla.bb +++ b/doc/about/about_hubzilla.bb @@ -1,11 +1,11 @@ -[h1]Hubzilla Project[/h1] +[h1]Project Overview[/h1] -$Projectname is a decentralized communication network, which aims to provide communication that is censorship-resistant, privacy-respecting, and thus free from the oppressive claws of contemporary corporate communication giants. These giants function primarily as spy networks for paying clients of all sorts and types, in addition to monopolizing and centralizing the Internet; a feature that was not part of the original and revolutionary goals that produced the World Wide Web. +$Projectname is a decentralized community server providing communications, identity, and access control services which work together seamlessly across domains and connected websites. It allows anybody to publicly or [b]privately[/b] publish a range of web/media/personal content. The cross-domain privacy implementation is unique and somewhat revolutionary, as identity and access rights are negotiated by servers invisibly in the background. $Projectname is free and open source. It is designed to scale from a $35 Raspberry Pi, to top of the line AMD and Intel Xeon-powered multi-core enterprise servers. It can be used to support communication between a few individuals, or scale to many thousands and more. -$Projectname aims to be skill and resource agnostic. It is easy to use by everyday computer users, as well as by systems administrators and developers. +$Projectname aims to be skill and resource agnostic. It is easy to use by everyday people, as well as by systems administrators and developers. How you use it depends on how you want to use it. diff --git a/doc/developer/api_zot.md b/doc/developer/api_zot.md index 26af72298..2458da8b2 100644 --- a/doc/developer/api_zot.md +++ b/doc/developer/api_zot.md @@ -14,13 +14,121 @@ Export channel data channel/stream ================================================================================ -Fetch conversation items +Fetch channel conversation items + +network/stream +================================================================================ + +Fetch network conversation items + files ================================================================================ -List file storage +List file storage (attach DB) + +GET /api/z/1.0/files + + +Options: + + - hash + return only entries matching hash (exactly) + + - filename + return only entries matching filename (substring) + + - filetype + return only entries matching filetype/mimetype (substring) + + - start + start at record (default 0) + + - records + number of records to return or 0 for unlimited + + + +Example: + +curl -u mychannel:mypassword https://xyz.macgirvin.com/api/z/1.0/files -d filetype=multipart/mixed + + +Returns: + + { + + "success": true, + "results": [ + { + "id": "1", + "aid": "1", + "uid": "2", + "hash": "44ee8b2a1a7f36dea07b93b7747a2383a1bc0fdd08339e8928bfcbe45f65d939", + "filename": "Profile Photos", + "filetype": "multipart/mixed", + "filesize": "0", + "revision": "0", + "folder": "", + "os_storage": "1", + "is_dir": "1", + "is_photo": "0", + "flags": "0", + "created": "2016-01-02 21:51:17", + "edited": "2016-01-02 21:51:17", + "allow_cid": "", + "allow_gid": "", + "deny_cid": "", + "deny_gid": "" + }, + { + "id": "12", + "aid": "1", + "uid": "2", + "hash": "71883f1fc64af33889229cbc79c5a056deeec5fc277d765f182f19073e1b2998", + "filename": "Cover Photos", + "filetype": "multipart/mixed", + "filesize": "0", + "revision": "0", + "folder": "", + "os_storage": "1", + "is_dir": "1", + "is_photo": "0", + "flags": "0", + "created": "2016-01-15 00:24:33", + "edited": "2016-01-15 00:24:33", + "allow_cid": "", + "allow_gid": "", + "deny_cid": "", + "deny_gid": "" + }, + { + "id": "16", + "aid": "1", + "uid": "2", + "hash": "f48f7ec3278499d1dd86b72c3207beaaf4717b07df5cc9b373f14d7aad2e1bcd", + "filename": "2016-01", + "filetype": "multipart/mixed", + "filesize": "0", + "revision": "0", + "folder": "", + "os_storage": "1", + "is_dir": "1", + "is_photo": "0", + "flags": "0", + "created": "2016-01-22 03:24:55", + "edited": "2016-01-22 03:26:57", + "allow_cid": "", + "allow_gid": "", + "deny_cid": "", + "deny_gid": "" + } + ] + } + + + filemeta ================================================================================ @@ -30,7 +138,69 @@ Export file metadata for any uploaded file filedata ================================================================================ -Export file contents for any uploaded file +Provides the ability to download a file from cloud storage in chunks + +GET /api/z/1.0/filedata + + +Required: + + - file_id + attach.hash of desired file ('begins with' match) + + +Optional: + + - start + starting byte of returned data in file (counting from 0) + + - length + length (prior to base64 encoding) of chunk to download + + +Returns: + + attach (DB) structure with base64 encoded 'content' comprised of the desired chunk + + + +Example: + + https://xyz.macgirvin.com/api/z/1.0/filedata?f=&file_id=9f5217770fd&start=0&length=48 + +Returns: + + { + + "attach": { + "id": "107", + "aid": "1", + "uid": "2", + "hash": "9f5217770fd55d563bd77f84d534d8e119a187514bbd391714626cd9c0e60207", + "creator": "pgcJx1IQjuPkx8aI9qheJlBMZzJz-oTPjHy3h5pWlOVOriBO_cSiUhhqwhuZ74TYJ8_ECO3pPiRMWC0q8YPCQg", + "filename": "pcxtopbm.c", + "filetype": "application/octet-stream", + "filesize": "3934", + "revision": "0", + "folder": "", + "flags": "0", + "is_dir": "0", + "is_photo": "0", + "os_storage": "1", + "os_path": "", + "display_path": "", + "content": "LyogcGN4dG9wYm0uYyAtIGNvbnZlcnQgUEMgcGFpbnRicnVzaCAoLnBjeCkgZmls", + "created": "2016-07-24 23:13:01", + "edited": "2016-07-24 23:13:01", + "allow_cid": "", + "allow_gid": "", + "deny_cid": "", + "deny_gid": "", + "start": 0, + "length": 48 + } + + } file/export @@ -42,7 +212,70 @@ file albums ================================================================================ -List photo albums +Description: list photo albums + +GET /api/z/1.0/albums + + +Output: + + text - textual name + + total - number of photos in this album + + url - web URL + + urlencode - textual name, urlencoded + + bin2hex - textual name using bin2hex (which is used in the web URL link) + + +Example: + + + { + + "success": true, + "albums": [ + { + "text": "/", + "total": "2", + "url": "https://xyz.macgirvin.com/photos/hubzilla/album/", + "urlencode": "", + "bin2hex": "" + }, + { + "text": "2016-01", + "total": "6", + "url": "https://xyz.macgirvin.com/photos/hubzilla/album/323031362d3031", + "urlencode": "2016-01", + "bin2hex": "323031362d3031" + }, + { + "text": "2016-02", + "total": "7", + "url": "https://xyz.macgirvin.com/photos/hubzilla/album/323031362d3032", + "urlencode": "2016-02", + "bin2hex": "323031362d3032" + }, + { + "text": "Cover Photos", + "total": "5", + "url": "https://xyz.macgirvin.com/photos/hubzilla/album/436f7665722050686f746f73", + "urlencode": "Cover+Photos", + "bin2hex": "436f7665722050686f746f73" + }, + { + "text": "Profile Photos", + "total": "26", + "url": "https://xyz.macgirvin.com/photos/hubzilla/album/50726f66696c652050686f746f73", + "urlencode": "Profile+Photos", + "bin2hex": "50726f66696c652050686f746f73" + } + ] + + } + photos -- cgit v1.2.3 From 6668fe02aaa00e7b89af6d22bc9ae2781c756f39 Mon Sep 17 00:00:00 2001 From: Andrew Manning Date: Fri, 9 Dec 2016 22:18:23 -0500 Subject: Only display h1 headings in sticky side nav. Toggle display of detailed TOC at top of page. Introduce return to top button for small screens. --- Zotlabs/Module/Help.php | 1 + doc/toc.html | 6 +++--- view/theme/redbasic/css/style.css | 1 + view/tpl/help.tpl | 30 +++++++++++++++++++++++++----- 4 files changed, 30 insertions(+), 8 deletions(-) diff --git a/Zotlabs/Module/Help.php b/Zotlabs/Module/Help.php index 27d94e405..9d6e421e5 100644 --- a/Zotlabs/Module/Help.php +++ b/Zotlabs/Module/Help.php @@ -80,6 +80,7 @@ class Help extends \Zotlabs\Web\Controller { return replace_macros(get_markup_template('help.tpl'), array( '$title' => t('$Projectname Documentation'), + '$tocHeading' => t('Contents'), '$content' => $content )); } diff --git a/doc/toc.html b/doc/toc.html index a2ebea318..4ef79bd10 100644 --- a/doc/toc.html +++ b/doc/toc.html @@ -420,11 +420,11 @@ tocUl.toc({content: "#doco-content", headings: "h1"}); tocUl.addClass('toc-content'); if( $(window).height() > 499) { - tocUl.sticky({topSpacing:$('nav').outerHeight(true), zIndex: 1000}); - } + tocUl.sticky({topSpacing:$('nav').outerHeight(true), zIndex: 1000}); + } } }); - + }); diff --git a/view/theme/redbasic/css/style.css b/view/theme/redbasic/css/style.css index ae4853ec6..af6b85323 100644 --- a/view/theme/redbasic/css/style.css +++ b/view/theme/redbasic/css/style.css @@ -1788,6 +1788,7 @@ nav .badge.mail-update:hover { #expand-aside, #expand-tabs, +#doco-return-to-top-btn, #context-help-btn { color: $nav_active_icon_colour; padding: 7px 10px; diff --git a/view/tpl/help.tpl b/view/tpl/help.tpl index 2faaa3853..3ec1c9d8c 100644 --- a/view/tpl/help.tpl +++ b/view/tpl/help.tpl @@ -3,9 +3,11 @@

{{$title}}

-

Contents

-
    -
    +

    + + {{$tocHeading}} +

    + {{$content}}
    @@ -16,7 +18,25 @@ $(document).ready(function () { $('#doco-top-toc').toc({content: "#doco-content", headings: "h1,h2,h3,h4"}); - + $('.navbar-header').append('