-
Notifications
You must be signed in to change notification settings - Fork 189
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
Te server refactor 1 #1864
Open
tevko
wants to merge
12
commits into
edge
Choose a base branch
from
te-server-refactor-1
base: edge
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+1,386
−1,695
Open
Te server refactor 1 #1864
Changes from 8 commits
Commits
Show all changes
12 commits
Select commit
Hold shift + click to select a range
62cfc85
ignore jigsaw config
tevko 534dae2
begin route splitting
tevko d18b510
finish route migration
tevko 5dfed18
move launchPrep route
tevko acca6ce
math routes moved
tevko e5b089f
move ispam func to utils
tevko 00b3b7c
add dataexport and more math funcs moved
tevko 5338611
add votes and password routes
tevko 73d786c
remove test failing bugs
tevko a8917df
Merge branch 'edge' into te-server-refactor-1
tevko bd99f6e
resolve tests
tevko 5485e44
remove unreachable code
tevko File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -7,5 +7,6 @@ | |
build/ | ||
prod.env | ||
xids.csv | ||
preprod.env | ||
preprod.env | ||
.venv | ||
jigsaw-vertex-integration-92ef30330cf7.json | ||
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,3 +4,4 @@ dist | |
logs/ | ||
node_modules/ | ||
npm-debug.log* | ||
.venv/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
|
||
import User from "../user"; | ||
import { doAddDataExportTask } from "../utils/common"; | ||
import Config from "../config"; | ||
import fail from "../utils/fail"; | ||
import AWS from "aws-sdk"; | ||
|
||
AWS.config.update({ region: Config.awsRegion }); | ||
const s3Client = new AWS.S3({ apiVersion: "2006-03-01" }); | ||
|
||
function handle_GET_dataExport( | ||
req: { p: { uid?: any; zid: any; unixTimestamp: number; format: any } }, | ||
res: { json: (arg0: {}) => void } | ||
) { | ||
const getUserInfoForUid2 = User.getUserInfoForUid2; | ||
getUserInfoForUid2(req.p.uid) | ||
.then((user: { email: any }) => { | ||
return doAddDataExportTask( | ||
Config.mathEnv, | ||
user.email, | ||
req.p.zid, | ||
req.p.unixTimestamp * 1000, | ||
req.p.format, | ||
Math.abs((Math.random() * 999999999999) >> 0) | ||
) | ||
.then(() => { | ||
res.json({}); | ||
}) | ||
.catch((err: any) => { | ||
fail(res, 500, "polis_err_data_export123", err); | ||
}); | ||
}) | ||
.catch((err: any) => { | ||
fail(res, 500, "polis_err_data_export123b", err); | ||
}); | ||
} | ||
|
||
function handle_GET_dataExport_results( | ||
req: { p: { filename: string } }, | ||
res: { redirect: (arg0: any) => void } | ||
) { | ||
var url = s3Client.getSignedUrl("getObject", { | ||
Bucket: "polis-datadump", | ||
Key: Config.mathEnv + "/" + req.p.filename, | ||
Expires: 60 * 60 * 24 * 7, | ||
}); | ||
res.redirect(url); | ||
} | ||
|
||
export { handle_GET_dataExport, handle_GET_dataExport_results } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
import Utils from "../utils/common"; | ||
import cookies from "../utils/cookies"; | ||
import Session from "../session"; | ||
const COOKIES = cookies.COOKIES; | ||
|
||
const setPermanentCookie = cookies.setPermanentCookie; | ||
const setCookieTestCookie = cookies.setCookieTestCookie; | ||
const makeSessionToken = Session.makeSessionToken; | ||
|
||
function handle_GET_launchPrep( | ||
req: { | ||
headers?: { origin: string }; | ||
cookies: { [x: string]: any }; | ||
p: { dest: any }; | ||
}, | ||
res: { redirect: (arg0: any) => void } | ||
) { | ||
if (!req.cookies[COOKIES.PERMANENT_COOKIE]) { | ||
setPermanentCookie(req, res, makeSessionToken()); | ||
} | ||
setCookieTestCookie(req, res); | ||
|
||
// Argument of type '{ redirect: (arg0: any) => void; }' is not assignable to parameter of type '{ cookie: (arg0: any, arg1: any, arg2: any) => void; }'. | ||
// Property 'cookie' is missing in type '{ redirect: (arg0: any) => void; }' but required in type '{ cookie: (arg0: any, arg1: any, arg2: any) => void; }'.ts(2345) | ||
// @ts-ignore | ||
setCookie(req, res, "top", "ok", { | ||
httpOnly: false, // not httpOnly - needed by JS | ||
}); | ||
|
||
// using hex since it doesn't require escaping like base64. | ||
const dest = Utils.hexToStr(req.p.dest); | ||
const url = new URL(dest); | ||
res.redirect(url.pathname + url.search + url.hash); | ||
} | ||
|
||
export default handle_GET_launchPrep; |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
seems oddly specific, but ok.
alternatively try a wildcard like
jigsaw-vertex-integration*.json