Instance config
FossilOrigin-Name: 5cfa8bd7c9566eab1e200c7ca5d7dac07ede875216aa5fbc4ecbcbfcf8333edf
This commit is contained in:
parent
e4dd6d61a9
commit
6f7b2f06d6
4 changed files with 71 additions and 16 deletions
|
@ -325,16 +325,16 @@ User SQLite::get_user(const decltype(User::acct)& acct)
|
|||
// It's still recommended to use them for clarity
|
||||
bool SQLite::try_migration()
|
||||
{
|
||||
const char* create_tables[] = {
|
||||
R"sql(
|
||||
const char *create_tables[] = {
|
||||
R"sql(
|
||||
CREATE TABLE IF NOT EXISTS instances (
|
||||
id INTEGER PRIMARY KEY ASC,
|
||||
host TEXT,
|
||||
users_count INTEGER
|
||||
)
|
||||
)sql",
|
||||
|
||||
R"sql(
|
||||
|
||||
R"sql(
|
||||
CREATE TABLE IF NOT EXISTS users (
|
||||
id INTEGER PRIMARY KEY ASC,
|
||||
email TEXT,
|
||||
|
@ -390,6 +390,37 @@ CREATE TABLE IF NOT EXISTS applications (
|
|||
created_at DATETIME,
|
||||
updated_at DATETIME
|
||||
)
|
||||
)sql",
|
||||
|
||||
R"sql(
|
||||
CREATE TABLE IF NOT EXISTS statuses (
|
||||
id INTEGER PRIMARY KEY ASC,
|
||||
application TEXT,
|
||||
content TEXT,
|
||||
language TEXT,
|
||||
mentions TEXT, /* comma separated array */
|
||||
|
||||
)
|
||||
)sql",
|
||||
|
||||
/* I was on the fence for if it's better to store databases in something
|
||||
* more editor friendly, such as XML, but I figured most users would be
|
||||
* happy just dragging their database file around.
|
||||
*
|
||||
* On the `config' schema key: Consider modules. Someone adds a payment
|
||||
* system for each post... and they want an easy way to configure it, and
|
||||
* they want to _not_ touch Wormhole's source code and give it to other
|
||||
* people... strange example indeed, but that's what that's for.
|
||||
*/
|
||||
R"sql(
|
||||
CREATE TABLE IF NOT EXISTS config (
|
||||
id INTEGER PRIMARY KEY CHECK (id = 0),
|
||||
instance_name TEXT NOT NULL,
|
||||
instance_domain TEXT NOT NULL, /* Full URL */
|
||||
instance_description TEXT, /* Full URL */
|
||||
instance_logo INTEGER, /* media */
|
||||
config BLOB,
|
||||
)
|
||||
)sql",
|
||||
|
||||
// R"sql(
|
||||
|
|
|
@ -21,7 +21,10 @@
|
|||
|
||||
using namespace Protocol;
|
||||
|
||||
HTTP::Response Route::ActivityPub::user_inbox(std::any& args, const HTTP::Request& req, const HTTP::RequestArgs_t& arg)
|
||||
HTTP::Response
|
||||
Route::ActivityPub::user_inbox(std::any& args,
|
||||
const HTTP::Request& req,
|
||||
const HTTP::RequestArgs_t& arg)
|
||||
{
|
||||
using namespace std::string_literals;
|
||||
|
||||
|
@ -55,7 +58,10 @@ HTTP::Response Route::ActivityPub::user_inbox(std::any& args, const HTTP::Reques
|
|||
return HTTP::Response( rjson::to_string(root), HTTP::MIME::ACTIVITY_JSON );
|
||||
}
|
||||
|
||||
HTTP::Response Route::ActivityPub::user_outbox(std::any& args, const HTTP::Request& req, const HTTP::RequestArgs_t& arg)
|
||||
HTTP::Response
|
||||
Route::ActivityPub::user_outbox(std::any& args,
|
||||
const HTTP::Request& req,
|
||||
const HTTP::RequestArgs_t& arg)
|
||||
{
|
||||
using namespace std::string_literals;
|
||||
|
||||
|
@ -88,7 +94,10 @@ HTTP::Response Route::ActivityPub::user_outbox(std::any& args, const HTTP::Reque
|
|||
return HTTP::Response( rjson::to_string(root), HTTP::MIME::ACTIVITY_JSON );
|
||||
}
|
||||
|
||||
HTTP::Response Route::ActivityPub::user_followers(std::any& args, const HTTP::Request& req, const HTTP::RequestArgs_t& arg)
|
||||
HTTP::Response
|
||||
Route::ActivityPub::user_followers(std::any& args,
|
||||
const HTTP::Request& req,
|
||||
const HTTP::RequestArgs_t& arg)
|
||||
{
|
||||
using namespace std::string_literals;
|
||||
|
||||
|
@ -121,7 +130,10 @@ HTTP::Response Route::ActivityPub::user_followers(std::any& args, const HTTP::Re
|
|||
return HTTP::Response( rjson::to_string(root), HTTP::MIME::ACTIVITY_JSON );
|
||||
}
|
||||
|
||||
HTTP::Response Route::ActivityPub::user_following(std::any& args, const HTTP::Request& req, const HTTP::RequestArgs_t& arg)
|
||||
HTTP::Response
|
||||
Route::ActivityPub::user_following(std::any& args,
|
||||
const HTTP::Request& req,
|
||||
const HTTP::RequestArgs_t& arg)
|
||||
{
|
||||
DESTRUCT_WORMHOLE_ARGS(args);
|
||||
using namespace std::string_literals;
|
||||
|
|
|
@ -6,7 +6,10 @@
|
|||
#pragma once
|
||||
|
||||
#ifndef MODULE_WEBFINGER
|
||||
#warning "You SHOULD (think: MUST) build Webfinger support if you want to build ActivityPub support. If you don't, then there wont be a way for most servers to discover users on your server. If you are simply testing ActivityPub routes, then you can ignore this message."
|
||||
#warning "You SHOULD (think: MUST) build Webfinger support if you want to" \
|
||||
" build ActivityPub support. If you don't, then there wont be a way for" \
|
||||
" most servers to discover users on your server. If you are simply testing" \
|
||||
" ActivityPub routes, then you can safely ignore this message."
|
||||
#endif
|
||||
|
||||
#include "http/httpserver.h"
|
||||
|
@ -16,11 +19,21 @@ namespace Route
|
|||
{
|
||||
namespace ActivityPub
|
||||
{
|
||||
HTTP::Response user_inbox(std::any& args, const HTTP::Request& req, const HTTP::RequestArgs_t& arg);
|
||||
HTTP::Response user_outbox(std::any& args, const HTTP::Request& req, const HTTP::RequestArgs_t& arg);
|
||||
HTTP::Response user_following(std::any& args, const HTTP::Request& req, const HTTP::RequestArgs_t& arg);
|
||||
HTTP::Response user_followers(std::any& args, const HTTP::Request& req, const HTTP::RequestArgs_t& arg);
|
||||
HTTP::Response user(std::any& args, const HTTP::Request& req, const HTTP::RequestArgs_t& arg);
|
||||
HTTP::Response user_inbox(std::any& args,
|
||||
const HTTP::Request& req,
|
||||
const HTTP::RequestArgs_t& arg);
|
||||
HTTP::Response user_outbox(std::any& args,
|
||||
const HTTP::Request& req,
|
||||
const HTTP::RequestArgs_t& arg);
|
||||
HTTP::Response user_following(std::any& args,
|
||||
const HTTP::Request& req,
|
||||
const HTTP::RequestArgs_t& arg);
|
||||
HTTP::Response user_followers(std::any& args,
|
||||
const HTTP::Request& req,
|
||||
const HTTP::RequestArgs_t& arg);
|
||||
HTTP::Response user(std::any& args,
|
||||
const HTTP::Request& req,
|
||||
const HTTP::RequestArgs_t& arg);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -55,8 +55,7 @@ HTTP::Response Route::MastoAPI::create_app(std::any& args,
|
|||
const std::string& website = req.param.at("website").string();
|
||||
root.AddMember("website", website, a);
|
||||
}
|
||||
catch(...)
|
||||
{
|
||||
catch(...) {
|
||||
root.AddMember("website", rjson::Value(), a);
|
||||
}
|
||||
// Tokens
|
||||
|
|
Loading…
Reference in a new issue