aboutsummaryrefslogtreecommitdiff
path: root/src/server
diff options
context:
space:
mode:
Diffstat (limited to 'src/server')
-rw-r--r--src/server/ApiManagers/HypothesisManager.ts40
-rw-r--r--src/server/ApiManagers/UploadManager.ts1
-rw-r--r--src/server/apis/google/GoogleApiServerUtils.ts1
-rw-r--r--src/server/database.ts38
-rw-r--r--src/server/index.ts2
5 files changed, 0 insertions, 82 deletions
diff --git a/src/server/ApiManagers/HypothesisManager.ts b/src/server/ApiManagers/HypothesisManager.ts
deleted file mode 100644
index 370d02a49..000000000
--- a/src/server/ApiManagers/HypothesisManager.ts
+++ /dev/null
@@ -1,40 +0,0 @@
-import ApiManager, { Registration } from "./ApiManager";
-import { Method, _permission_denied } from "../RouteManager";
-import { GoogleApiServerUtils } from "../apis/google/GoogleApiServerUtils";
-import { Database } from "../database";
-import { writeFile, readFile, readFileSync, existsSync } from "fs";
-import { serverPathToFile, Directory } from "./UploadManager";
-
-export default class HypothesisManager extends ApiManager {
-
- protected initialize(register: Registration): void {
-
- register({
- method: Method.GET,
- subscription: "/readHypothesisAccessToken",
- secureHandler: async ({ user, res }) => {
- const credentials = await Database.Auxiliary.HypothesisAccessToken.Fetch(user.id);
- res.send(credentials ? { username: credentials.hypothesisUsername, apiKey: credentials.hypothesisApiKey } : "");
- }
- });
-
- register({
- method: Method.POST,
- subscription: "/writeHypothesisAccessToken",
- secureHandler: async ({ user, req, res }) => {
- await Database.Auxiliary.HypothesisAccessToken.Write(user.id, req.body.authenticationCode, req.body.hypothesisUsername);
- res.send();
- }
- });
-
- register({
- method: Method.GET,
- subscription: "/revokeHypothesisAccessToken",
- secureHandler: async ({ user, res }) => {
- await Database.Auxiliary.HypothesisAccessToken.Revoke(user.id);
- res.send();
- }
- });
-
- }
-} \ No newline at end of file
diff --git a/src/server/ApiManagers/UploadManager.ts b/src/server/ApiManagers/UploadManager.ts
index 4455d11eb..bd242db5e 100644
--- a/src/server/ApiManagers/UploadManager.ts
+++ b/src/server/ApiManagers/UploadManager.ts
@@ -26,7 +26,6 @@ export enum Directory {
text = "text",
pdf_thumbnails = "pdf_thumbnails",
audio = "audio",
- hypothesis = "hypothesis"
}
export function serverPathToFile(directory: Directory, filename: string) {
diff --git a/src/server/apis/google/GoogleApiServerUtils.ts b/src/server/apis/google/GoogleApiServerUtils.ts
index b0157a85f..64bafe7fb 100644
--- a/src/server/apis/google/GoogleApiServerUtils.ts
+++ b/src/server/apis/google/GoogleApiServerUtils.ts
@@ -40,7 +40,6 @@ export namespace GoogleApiServerUtils {
export enum Service {
Documents = "Documents",
Slides = "Slides",
- Hypothesis = "Hypothesis"
}
/**
diff --git a/src/server/database.ts b/src/server/database.ts
index 456c1c254..64c5b7e4b 100644
--- a/src/server/database.ts
+++ b/src/server/database.ts
@@ -305,7 +305,6 @@ export namespace Database {
export enum AuxiliaryCollections {
GooglePhotosUploadHistory = "uploadedFromGooglePhotos",
GoogleAccess = "googleAuthentication",
- HypothesisAccess = "hypothesisAuthentication"
}
/**
@@ -406,43 +405,6 @@ export namespace Database {
}
- export namespace HypothesisAccessToken {
- /**
- * Format stored in database.
- */
- interface StoredCredentials {
- userId: string;
- hypothesisApiKey: string;
- hypothesisUsername: string;
- _id?: string;
- }
-
- /**
- * Writes the @param hypothesisApiKey to the database, associated
- * with @param userId for later retrieval and updating.
- */
- export const Write = async (userId: string, hypothesisApiKey: string, hypothesisUsername: string) => {
- return Instance.insert({ userId, hypothesisApiKey, hypothesisUsername }, AuxiliaryCollections.HypothesisAccess);
- };
-
- /**
- * Retrieves the credentials associaed with @param userId
- * and optionally removes their database id according to @param removeId.
- */
- export const Fetch = async (userId: string, removeId = true): Promise<Opt<StoredCredentials>> => {
- return SanitizedSingletonQuery<StoredCredentials>({ userId }, AuxiliaryCollections.HypothesisAccess, removeId);
- };
-
- /**
- * Revokes the credentials associated with @param userId.
- */
- export const Revoke = async (userId: string) => {
- const entry = await Fetch(userId, false);
- if (entry) {
- Instance.delete({ _id: entry._id }, AuxiliaryCollections.HypothesisAccess);
- }
- };
- }
}
}
diff --git a/src/server/index.ts b/src/server/index.ts
index 9af4b00bc..5c313654c 100644
--- a/src/server/index.ts
+++ b/src/server/index.ts
@@ -18,7 +18,6 @@ import PDFManager from "./ApiManagers/PDFManager";
import UploadManager from "./ApiManagers/UploadManager";
import { log_execution } from "./ActionUtilities";
import GeneralGoogleManager from "./ApiManagers/GeneralGoogleManager";
-import HypothesisManager from "./ApiManagers/HypothesisManager";
import GooglePhotosManager from "./ApiManagers/GooglePhotosManager";
import { Logger } from "./ProcessFactory";
import { yellow } from "colors";
@@ -72,7 +71,6 @@ function routeSetter({ isRelease, addSupervisedRoute, logRegistrationOutcome }:
new DeleteManager(),
new UtilManager(),
new GeneralGoogleManager(),
- new HypothesisManager(),
new GooglePhotosManager(),
];