diff options
author | bobzel <zzzman@gmail.com> | 2020-08-08 20:56:30 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-08-08 20:56:30 -0400 |
commit | 9f4a7ec5f79d9dec3a0ffb0b633197216cbefec8 (patch) | |
tree | 4b30cf8edfee0b2f315353329fde65b0b4585ae0 /src/server/ApiManagers/HypothesisManager.ts | |
parent | 47e3170534393ab9e4140c18b32110f83753d817 (diff) | |
parent | 1733759b776f0596c3a8561d2c735a4b7c7d54d3 (diff) |
Merge pull request #517 from browngraphicslab/hypothesis_annotation
Hypothesis annotation
Diffstat (limited to 'src/server/ApiManagers/HypothesisManager.ts')
-rw-r--r-- | src/server/ApiManagers/HypothesisManager.ts | 44 |
1 files changed, 0 insertions, 44 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 |