diff options
author | Lionel Han <47760119+IGoByJoe@users.noreply.github.com> | 2020-08-08 21:32:51 -0700 |
---|---|---|
committer | Lionel Han <47760119+IGoByJoe@users.noreply.github.com> | 2020-08-08 21:32:51 -0700 |
commit | 98d753d5dd66a646f00bcdf15656f845cd27fb81 (patch) | |
tree | 402eda69cf59fb9a85814f02f57a1ff3862abbb8 /src/server | |
parent | 25fa93e7060c8f8561c294c7309c763e3b8f9313 (diff) | |
parent | 9f4a7ec5f79d9dec3a0ffb0b633197216cbefec8 (diff) |
Merge branch 'master' of https://github.com/browngraphicslab/Dash-Web into new_audio
Diffstat (limited to 'src/server')
-rw-r--r-- | src/server/ApiManagers/HypothesisManager.ts | 44 | ||||
-rw-r--r-- | src/server/ApiManagers/UploadManager.ts | 1 | ||||
-rw-r--r-- | src/server/apis/google/GoogleApiServerUtils.ts | 1 | ||||
-rw-r--r-- | src/server/database.ts | 2 | ||||
-rw-r--r-- | src/server/index.ts | 2 |
5 files changed, 1 insertions, 49 deletions
diff --git a/src/server/ApiManagers/HypothesisManager.ts b/src/server/ApiManagers/HypothesisManager.ts deleted file mode 100644 index 33badbc42..000000000 --- a/src/server/ApiManagers/HypothesisManager.ts +++ /dev/null @@ -1,44 +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 }) => { - if (existsSync(serverPathToFile(Directory.hypothesis, user.id))) { - const read = readFileSync(serverPathToFile(Directory.hypothesis, user.id), "base64") || ""; - console.log("READ = " + read); - res.send(read); - } else res.send(""); - } - }); - - register({ - method: Method.POST, - subscription: "/writeHypothesisAccessToken", - secureHandler: async ({ user, req, res }) => { - const write = req.body.authenticationCode; - console.log("WRITE = " + write); - res.send(await writeFile(serverPathToFile(Directory.hypothesis, user.id), write, "base64", () => { })); - } - }); - - register({ - method: Method.GET, - subscription: "/revokeHypothesisAccessToken", - secureHandler: async ({ user, res }) => { - await Database.Auxiliary.GoogleAccessToken.Revoke("dash-hyp-" + 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 515fbe4ff..bd8fe97eb 100644 --- a/src/server/ApiManagers/UploadManager.ts +++ b/src/server/ApiManagers/UploadManager.ts @@ -25,7 +25,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 b7aa77f5d..41bf8b3da 100644 --- a/src/server/database.ts +++ b/src/server/database.ts @@ -304,7 +304,7 @@ export namespace Database { */ export enum AuxiliaryCollections { GooglePhotosUploadHistory = "uploadedFromGooglePhotos", - GoogleAccess = "googleAuthentication" + GoogleAccess = "googleAuthentication", } /** diff --git a/src/server/index.ts b/src/server/index.ts index 4ac4de847..c4e6be8a2 100644 --- a/src/server/index.ts +++ b/src/server/index.ts @@ -8,7 +8,6 @@ import DeleteManager from "./ApiManagers/DeleteManager"; import DownloadManager from './ApiManagers/DownloadManager'; import GeneralGoogleManager from "./ApiManagers/GeneralGoogleManager"; import GooglePhotosManager from "./ApiManagers/GooglePhotosManager"; -import HypothesisManager from "./ApiManagers/HypothesisManager"; import PDFManager from "./ApiManagers/PDFManager"; import { SearchManager } from './ApiManagers/SearchManager'; import SessionManager from "./ApiManagers/SessionManager"; @@ -72,7 +71,6 @@ function routeSetter({ isRelease, addSupervisedRoute, logRegistrationOutcome }: new DeleteManager(), new UtilManager(), new GeneralGoogleManager(), - new HypothesisManager(), new GooglePhotosManager(), ]; |