Get API docs served by IDHANServer
This commit is contained in:
15
.github/workflows/docs.yml
vendored
15
.github/workflows/docs.yml
vendored
@@ -11,27 +11,14 @@ jobs:
|
||||
with:
|
||||
submodules: 'true'
|
||||
|
||||
- name: Print shit
|
||||
run: ls ${{ github.workspace }}
|
||||
|
||||
- name: (Doxygen) HTML
|
||||
uses: mattnotmitt/doxygen-action@v1.1.0
|
||||
with:
|
||||
doxyfile-path: "./Doxyfile"
|
||||
working-directory: '.'
|
||||
|
||||
- name: API Docs
|
||||
uses: Legion2/swagger-ui-action@v1.3.0
|
||||
with:
|
||||
output: '${{ github.workspace }}/docs/swagger-ui'
|
||||
spec-file: "${{ github.workspace }}/docs/api.yaml"
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
|
||||
- name: Merge docs
|
||||
run: cp -r ${{ github.workspace }}/docs/swagger-ui ${{ github.workspace }}/docs/html/swagger-ui
|
||||
|
||||
- name: (Doxygen) Deploy HTML on Github Pages
|
||||
uses: peaceiris/actions-gh-pages@v3
|
||||
with:
|
||||
github_token: ${{ secrets.GITHUB_TOKEN }}
|
||||
publish_dir: "${{ github.workspace }}/docs/html"
|
||||
publish_dir: "${{ github.workspace }}/docs/out/html"
|
||||
3
.gitignore
vendored
3
.gitignore
vendored
@@ -43,4 +43,5 @@ read.lock
|
||||
|
||||
out/
|
||||
|
||||
/IDHANServer/src/db/setup/migration/doMigration.cpp
|
||||
/IDHANServer/src/db/setup/migration/doMigration.cpp
|
||||
/docs/out
|
||||
@@ -18,6 +18,8 @@ PreSetup()
|
||||
option(BUILD_IDHAN_CLIENT "Builds the shared library for the IDHANClient" ON)
|
||||
option(BUILD_IDHAN_TESTS "Builds all tests relating to IDHAN" ON)
|
||||
option(BUILD_HYDRUS_IMPORTER "Builds the hydrus importer" ON)
|
||||
option(BUILD_IDHAN_DOCS "Builds the API and source docs" ON)
|
||||
|
||||
if (BUILD_HYDRUS_IMPORTER)
|
||||
set(BUILD_IDHAN_CLIENT ON)
|
||||
endif ()
|
||||
@@ -33,6 +35,8 @@ include(toml)
|
||||
add_subdirectory(IDHAN)
|
||||
add_subdirectory(IDHANServer)
|
||||
add_subdirectory(IDHANClient)
|
||||
add_subdirectory(docs)
|
||||
|
||||
|
||||
if (BUILD_IDHAN_TESTS)
|
||||
#IDHANTests
|
||||
|
||||
8
Doxyfile
8
Doxyfile
@@ -68,7 +68,7 @@ PROJECT_LOGO = ./docs/libfgl_custom/TitorV2.png
|
||||
# entered, it will be relative to the location where doxygen was started. If
|
||||
# left blank the current directory will be used.
|
||||
|
||||
OUTPUT_DIRECTORY = ./docs
|
||||
OUTPUT_DIRECTORY = ./docs/out
|
||||
|
||||
# If the CREATE_SUBDIRS tag is set to YES then doxygen will create up to 4096
|
||||
# sub-directories (in 2 levels) under the output directory of each output format
|
||||
@@ -1372,7 +1372,9 @@ HTML_EXTRA_STYLESHEET = ./docs/doxygen-awesome-css/doxygen-awesome.css \
|
||||
HTML_EXTRA_FILES = ./docs/doxygen-awesome-css/doxygen-awesome-fragment-copy-button.js \
|
||||
./docs/doxygen-awesome-css/doxygen-awesome-darkmode-toggle.js \
|
||||
./docs/doxygen-awesome-css/doxygen-awesome-paragraph-link.js \
|
||||
./docs/libfgl_custom/tempus.ico
|
||||
./docs/libfgl_custom/tempus.ico \
|
||||
./docs/api.yaml \
|
||||
./docs/apidocs.html
|
||||
|
||||
# The HTML_COLORSTYLE tag can be used to specify if the generated HTML output
|
||||
# should be rendered with a dark or light theme.
|
||||
@@ -1933,7 +1935,7 @@ EXTRA_SEARCH_MAPPINGS =
|
||||
# If the GENERATE_LATEX tag is set to YES, doxygen will generate LaTeX output.
|
||||
# The default value is: YES.
|
||||
|
||||
GENERATE_LATEX = YES
|
||||
GENERATE_LATEX = NO
|
||||
|
||||
# The LATEX_OUTPUT tag is used to specify where the LaTeX docs will be put. If a
|
||||
# relative path is entered the value of OUTPUT_DIRECTORY will be put in front of
|
||||
|
||||
@@ -28,6 +28,7 @@ endif ()
|
||||
# Copy page info to the output directory
|
||||
|
||||
file(GLOB_RECURSE PAGE_FILES "${CMAKE_CURRENT_SOURCE_DIR}/src/pages/*")
|
||||
set(PAGE_OUTPUTS "")
|
||||
|
||||
foreach (PAGE ${PAGE_FILES})
|
||||
|
||||
@@ -36,10 +37,15 @@ foreach (PAGE ${PAGE_FILES})
|
||||
set(OUT_PATH ${CMAKE_BINARY_DIR}/bin/${REL_PATH})
|
||||
|
||||
add_custom_command(
|
||||
TARGET IDHANServer POST_BUILD
|
||||
COMMAND ${CMAKE_COMMAND} -E copy ${PAGE} ${OUT_PATH}
|
||||
OUTPUT ${OUT_PATH}
|
||||
COMMAND ${CMAKE_COMMAND} -E copy_if_different ${PAGE} ${OUT_PATH}
|
||||
DEPENDS ${PAGE}
|
||||
COMMENT "Copying ${PAGE} to ${OUT_PATH}"
|
||||
)
|
||||
|
||||
list(APPEND PAGE_OUTPUTS ${OUT_PATH})
|
||||
|
||||
endforeach ()
|
||||
|
||||
add_custom_target(IDHANPages DEPENDS ${PAGE_OUTPUTS})
|
||||
add_dependencies(IDHANServer IDHANPages)
|
||||
@@ -30,6 +30,8 @@ namespace idhan::api
|
||||
*/
|
||||
class IDHANApi : public drogon::HttpController< IDHANApi >
|
||||
{
|
||||
void api( const drogon::HttpRequestPtr& request, ResponseFunction&& callback );
|
||||
|
||||
void version( const drogon::HttpRequestPtr& request, ResponseFunction&& callback );
|
||||
|
||||
void tagInfo( const drogon::HttpRequestPtr& request, ResponseFunction&& callback, TagID tag_id );
|
||||
@@ -47,6 +49,8 @@ class IDHANApi : public drogon::HttpController< IDHANApi >
|
||||
|
||||
METHOD_LIST_BEGIN
|
||||
|
||||
ADD_METHOD_VIA_REGEX( IDHANApi::api, "/api.yaml" );
|
||||
|
||||
ADD_METHOD_TO( IDHANApi::version, "/version" );
|
||||
|
||||
ADD_METHOD_TO( IDHANApi::tagInfo, "/tag/{tag_id}/info" );
|
||||
|
||||
19
IDHANServer/src/api/docs.cpp
Normal file
19
IDHANServer/src/api/docs.cpp
Normal file
@@ -0,0 +1,19 @@
|
||||
//
|
||||
// Created by kj16609 on 11/10/24.
|
||||
//
|
||||
|
||||
#include "IDHANApi.hpp"
|
||||
#include "logging/log.hpp"
|
||||
|
||||
namespace idhan::api
|
||||
{
|
||||
|
||||
void IDHANApi::api( const drogon::HttpRequestPtr& request, ResponseFunction&& callback )
|
||||
{
|
||||
std::string path { request->getPath() };
|
||||
log::info( path );
|
||||
|
||||
callback( drogon::HttpResponse::newFileResponse( "./pages/api.yaml" ) );
|
||||
}
|
||||
|
||||
} // namespace idhan::api
|
||||
24
IDHANServer/src/pages/apidocs.html
Normal file
24
IDHANServer/src/pages/apidocs.html
Normal file
@@ -0,0 +1,24 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="utf-8"/>
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1"/>
|
||||
<meta name="description" content="SwaggerUI"/>
|
||||
<title>SwaggerUI</title>
|
||||
<link rel="stylesheet" href="https://unpkg.com/swagger-ui-dist@5.11.0/swagger-ui.css"/>
|
||||
</head>
|
||||
<body>
|
||||
<div id="swagger-ui"></div>
|
||||
<script src="https://unpkg.com/swagger-ui-dist@5.11.0/swagger-ui-bundle.js" crossorigin></script>
|
||||
<script>
|
||||
url = `${window.location.protocol}//${window.location.hostname}` + (window.location.port ? `:${window.location.port}` : '') + '/api.yaml';
|
||||
|
||||
window.onload = () => {
|
||||
window.ui = SwaggerUIBundle({
|
||||
url: `${url}`,
|
||||
dom_id: '#swagger-ui',
|
||||
});
|
||||
};
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
@@ -26,7 +26,7 @@
|
||||
</div>
|
||||
</div>
|
||||
<script>
|
||||
const url = `${window.location.protocol}//${window.location.hostname}` + (window.location.port ? `:${window.location.port}` : '');
|
||||
let url = `${window.location.protocol}//${window.location.hostname}` + (window.location.port ? `:${window.location.port}` : '');
|
||||
|
||||
const idhan_version = 'idhan_version';
|
||||
const idhan_api_version = 'idhan_api_version';
|
||||
|
||||
14
README.md
Normal file
14
README.md
Normal file
@@ -0,0 +1,14 @@
|
||||
# Welcome to IDHAN's page
|
||||
|
||||
IDHAN is a media management and archival program written in C++ for people with large collections of media.
|
||||
It's designed in a way that is compatible with most booru models. Currently the server is only built for running on Linux, Windows releases will be coming eventually but aren't a priority.
|
||||
|
||||
# Getting started
|
||||
|
||||
# Clients
|
||||
|
||||
# Server docs
|
||||
|
||||
The API docs can be found (add link)[HERE]().
|
||||
|
||||
The Source docs can be found (add link)[HERE]().
|
||||
2
docs.sh
2
docs.sh
@@ -1,4 +1,4 @@
|
||||
#!/usr/bin/bash
|
||||
|
||||
doxygen
|
||||
xdg-open ./docs/html/index.html
|
||||
xdg-open ./docs/out/html/index.html
|
||||
25
docs/CMakeLists.txt
Normal file
25
docs/CMakeLists.txt
Normal file
@@ -0,0 +1,25 @@
|
||||
|
||||
|
||||
if (BUILD_IDHAN_DOCS)
|
||||
find_package(Doxygen)
|
||||
|
||||
set(API_YAML ${CMAKE_CURRENT_SOURCE_DIR}/api.yaml)
|
||||
set(API_YAML_OUT ${CMAKE_BINARY_DIR}/bin/pages/api.yaml)
|
||||
set(DOXYGEN_OUT ${CMAKE_CURRENT_SOURCE_DIR}/out)
|
||||
|
||||
add_custom_target(IDHANDocs DEPENDS ${API_YAML_OUT} ${DOXYGEN_OUT})
|
||||
|
||||
add_custom_command(
|
||||
OUTPUT ${DOXYGEN_OUT}
|
||||
COMMAND ${DOXYGEN_EXECUTABLE}
|
||||
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/..
|
||||
COMMENT "Building doxygen docs"
|
||||
)
|
||||
|
||||
add_custom_command(
|
||||
OUTPUT ${API_YAML_OUT}
|
||||
COMMAND ${CMAKE_COMMAND} -E copy_if_different ${API_YAML} ${API_YAML_OUT}
|
||||
)
|
||||
|
||||
add_dependencies(IDHANServer IDHANDocs)
|
||||
endif ()
|
||||
@@ -1,81 +0,0 @@
|
||||
%! Author = kj16609
|
||||
%! Date = 4/4/24
|
||||
|
||||
% Preamble
|
||||
\documentclass[11pt]{article}
|
||||
|
||||
% Packages
|
||||
\usepackage{amsmath}
|
||||
\usepackage{amssymb}
|
||||
|
||||
% Document
|
||||
\begin{document}
|
||||
|
||||
\section{IDHAN Basics}
|
||||
\subsection[whatisidhan]{What is IDHAN}
|
||||
IDHAN is a file management database designed for modularity and performance. It's design attempts to use system resources given by the user as effectively as possible
|
||||
|
||||
\subsection[terms]{Basic Terminology}
|
||||
\begin{description}
|
||||
\item[Server]: The primary IDHAN instance that handles API access and management of the database.
|
||||
\item[Client]: Any API accessor (Typically will have some sort of GUI interface).
|
||||
\item[API]: Both the RESTful and Socket based APIs.
|
||||
\item[Record]: A sha256 matching a set of data
|
||||
\item[File]: A single file/data and it's associated hash
|
||||
\item[Archive]: A file containing multiple other files
|
||||
\item[Tag]: A piece of information attached to a given Record.
|
||||
\end{description}
|
||||
|
||||
|
||||
|
||||
\section{Tagging}
|
||||
\subsection[tags-terms]{Tag terminology}
|
||||
\begin{description}
|
||||
\item[Tag]: (See Basic Terminology)
|
||||
\item[Alias]: A tag connection that turns A into B, Along with B inheriting all parents/children/siblings from A
|
||||
\item[Siblings]: A tag connection that acts as an XOR (Exclusive or). Tag A as a older sibling to tag B. If both are present the older sibling 'wins' and is presented while the younger sibling is hidden
|
||||
\item[Parents]: A tag connection that assuming A is a parent of B will cause A to be present whenever B is present. (A child can't be without it's parents)
|
||||
\end{description}
|
||||
|
||||
\subsection[tags-visual]{Tag visulizations}
|
||||
The following are various ways to write tag connections without explicitly refering to them as parents/siblings/children
|
||||
\begin{description}
|
||||
\item[Alias] A $\rightarrow$ B ( B is the idealized or prefered tag over A ) (Writen as $->$)
|
||||
\item[Parents] A $\Rightarrow$ B (B is the child of A) (Written as $=>$)
|
||||
\item[Siblings] A $\rightrightarrows$ B (B is the older sibling of A) (Written as $=>>$)
|
||||
\end{description}
|
||||
|
||||
|
||||
|
||||
\section{Core functionality}
|
||||
|
||||
|
||||
\subsection[client-connection]{Client Connections}
|
||||
\subsubsection[socket-connection]{Socket connections}
|
||||
The following only applies to clients that are using a messageing type API (Such as the socket API).\newline
|
||||
The client's challenge must be performed as follows:\newline
|
||||
The client will recieve information about the Server after inital connection and before authentication. This information consists of the version. This allows the client to check it's version and disconnect upon being unable to communicate with the server.\newline
|
||||
The client will then issue an authorization request. The client must provide the key it wishes to authenticate with in the request. \newline
|
||||
Upon the client being rejected the server will issue a rejection response and close the connection.\newline
|
||||
Upon the client being accepted the server with issue a acceptance response that contains any extra information about the server that can't be sent to unauthenticated clients
|
||||
|
||||
|
||||
\subsection[work-queue]{Work Queue}
|
||||
Each client connection will be given it's own work queue. The server can be configured to assign more or less threads to each queue as well as a priority.
|
||||
Each client's config will be of the following:
|
||||
\begin{description}
|
||||
\item[Priority] The priority of the queue. Higher work gets done first.
|
||||
\item[Reserved Threads] The number of dedicated threads for processing a given thread pool. Reserved threads will NOT steal work from another queue. Must be lower then max threads
|
||||
\item[Max threads] The max number of threads that will process on a given thread pool. This value is overriden by the minimum of either this value or the global thread max value. 0 means unlimited/global max
|
||||
\end{description}
|
||||
|
||||
|
||||
|
||||
|
||||
\subsection[file-importing]{File Importing}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
\end{document}
|
||||
Reference in New Issue
Block a user