Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feat/restructure api #6664

Open
wants to merge 4 commits into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion bin/make_docs.ts
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ createDirIfNotExists('../out/doc/api')



exec(`asciidoctor -D ../out/doc ../doc/index.adoc */**.adoc -a VERSION=${VERSION}`)
exec(`asciidoctor -D ../out/doc ../doc/index.adoc ../*/**.adoc -a VERSION=${VERSION}`)
exec(`asciidoctor -D ../out/doc/api ../doc/api/*.adoc -a VERSION=${VERSION}`)

copyFolderSync('../doc/public/', '../out/doc/')
30 changes: 30 additions & 0 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 6 additions & 0 deletions src/ep.json
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,12 @@
"expressCreateServer": "ep_etherpad-lite/node/hooks/express/errorhandling"
}
},
{
"name": "restApi",
"hooks": {
"expressCreateServer": "ep_etherpad-lite/node/handler/RestAPI"
}
},
{
"name": "socketio",
"hooks": {
Expand Down
12 changes: 3 additions & 9 deletions src/node/handler/APIHandler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,10 @@ import {MapArrayType} from "../types/MapType";
const api = require('../db/API');
const padManager = require('../db/PadManager');
import createHTTPError from 'http-errors';
import {Http2ServerRequest, Http2ServerResponse} from "node:http2";
import {Http2ServerRequest} from "node:http2";
import {publicKeyExported} from "../security/OAuth2Provider";
import {jwtVerify} from "jose";
import {apikey} from './APIKeyHandler'
import {APIFields, apikey} from './APIKeyHandler'
// a list of all functions
const version:MapArrayType<any> = {};

Expand Down Expand Up @@ -141,20 +141,14 @@ version['1.3.0'] = {
setText: ['padID', 'text', 'authorId'],
};


// set the latest available API version here
exports.latestApiVersion = '1.3.0';

// exports the versions so it can be used by the new Swagger endpoint
exports.version = version;


type APIFields = {
apikey: string;
api_key: string;
padID: string;
padName: string;
authorization: string;
}

/**
* Handles an HTTP API call
Expand Down
10 changes: 10 additions & 0 deletions src/node/handler/APIKeyHandler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,16 @@ const settings = require('../utils/Settings');

const apiHandlerLogger = log4js.getLogger('APIHandler');



export type APIFields = {
apikey: string;
api_key: string;
padID: string;
padName: string;
authorization: string;
}

// ensure we have an apikey
export let apikey:string|null = null;
const apikeyFilename = absolutePaths.makeAbsolute(argv.apikey || './APIKEY.txt');
Expand Down
Loading
Loading