archive.social/docs/server.md

4.3 KiB

server

thread-keeper

Author: The Harvard Library Innovation Lab
License: MIT

server.successLog : SuccessLog

Kind: static constant of server

server.options

Fastify-cli options

Kind: static constant of server

server.CAPTURES_WATCH : Object

Keeps track of how many capture processes are currently running. May be used to redirect users if over capacity.

[!] Only good for early prototyping.

Kind: static constant of server

server~nunjucksEnv : nunjucks.Environment

Kind: inner constant of server

server~ipBlockList : IPBlockList

Kind: inner constant of server

server~accessKeys : AccessKeys

Kind: inner constant of server

server~index(request, reply) ⇒ Promise.<fastify.FastifyReply>

[GET] / Shows the landing page and capture form. Assumes fastify is in scope.

Kind: inner method of server

Param Type
request fastify.FastifyRequest
reply fastify.FastifyReply

server~capture(request, reply) ⇒ Promise.<fastify.FastifyReply>

[POST] / Processes a request to capture a twitter.com url. Serves PDF bytes directly if operation is successful. Returns to form with specific error code, passed as errorReason, otherwise. Subject to captures rate limiting (see CAPTURES_WATCH).

Body is expected as application/x-www-form-urlencoded with the following fields:

  • url
  • why
  • access-key [If REQUIRE_ACCESS_KEY is enabled]
  • unfold-thread (optional)

Assumes fastify is in scope.

Kind: inner method of server

Param Type
request fastify.FastifyRequest
reply fastify.FastifyReply

server~check(request, reply) ⇒ Promise.<fastify.FastifyReply>

[GET] /check Shows the "check" page /check form. Loads certificates history files in the process. Assumes fastify is in scope.

Kind: inner method of server

Param Type
request fastify.FastifyRequest
reply fastify.FastifyReply

server~checkHash(request, reply) ⇒ Promise.<fastify.FastifyReply>

[GET] /api/v1/hashes/check/<sha512-hash>. Checks if a given SHA512 hash is in the "success" logs, meaning this app created it. Hash is passed as the last parameter, url encoded. Assumes fastify is in scope.

Returns HTTP 200 if found, HTTP 404 if not.

Kind: inner method of server

Param Type
request fastify.FastifyRequest
reply fastify.FastifyReply