mirror of
https://github.com/zkldi/Tachi.git
synced 2026-10-04 12:58:11 +03:00
rename internal-api to api, that's us!
This commit is contained in:
@@ -26,7 +26,7 @@ const SHOULD_COOKIES_SECURE = process.env.NODE_ENV === "production";
|
||||
|
||||
/**
|
||||
* Logs in a user.
|
||||
* @name /internal-api/auth/login
|
||||
* @name /api/auth/login
|
||||
*/
|
||||
router.post(
|
||||
"/login",
|
||||
@@ -145,7 +145,7 @@ router.post(
|
||||
|
||||
/**
|
||||
* Registers a new user.
|
||||
* @name /internal-api/auth/register
|
||||
* @name /api/auth/register
|
||||
*/
|
||||
router.post(
|
||||
"/register",
|
||||
@@ -258,7 +258,7 @@ router.post(
|
||||
|
||||
/**
|
||||
* Logs out the requesting user.
|
||||
* @name /internal-api/auth/logout
|
||||
* @name /api/auth/logout
|
||||
*/
|
||||
router.post("/logout", RequireLoggedIn, (req, res) => {
|
||||
req.session.destroy(() => 0);
|
||||
+7
-7
@@ -24,19 +24,19 @@ async function LoadKTBlackIIDXData() {
|
||||
|
||||
// reset DB handles the post-stuff
|
||||
|
||||
t.test("POST /internal-api/import/file", async (t) => {
|
||||
t.test("POST /api/import/file", async (t) => {
|
||||
const cookie = await CreateFakeAuthCookie(mockApi);
|
||||
|
||||
t.beforeEach(ResetDBState);
|
||||
|
||||
RequireNeutralAuthentication("/internal-api/import/file", "POST");
|
||||
RequireNeutralAuthentication("/api/import/file", "POST");
|
||||
|
||||
t.test("file/csv:eamusement-iidx", (t) => {
|
||||
t.beforeEach(LoadKTBlackIIDXData);
|
||||
|
||||
t.test("Mini HV import", async (t) => {
|
||||
let res = await mockApi
|
||||
.post("/internal-api/import/file")
|
||||
.post("/api/import/file")
|
||||
.set("Cookie", cookie)
|
||||
.attach(
|
||||
"scoreData",
|
||||
@@ -67,7 +67,7 @@ t.test("POST /internal-api/import/file", async (t) => {
|
||||
|
||||
t.test("Valid Rootage CSV import", async (t) => {
|
||||
let res = await mockApi
|
||||
.post("/internal-api/import/file")
|
||||
.post("/api/import/file")
|
||||
.set("Cookie", cookie)
|
||||
.attach("scoreData", TestingIIDXEamusementCSV26, "my_csv.csv")
|
||||
.field("importType", "file/csv:eamusement-iidx")
|
||||
@@ -92,7 +92,7 @@ t.test("POST /internal-api/import/file", async (t) => {
|
||||
|
||||
t.test("Valid Heroic Verse CSV import", async (t) => {
|
||||
let res = await mockApi
|
||||
.post("/internal-api/import/file")
|
||||
.post("/api/import/file")
|
||||
.set("Cookie", cookie)
|
||||
.attach("scoreData", TestingIIDXEamusementCSV27, "my_csv.csv")
|
||||
.field("importType", "file/csv:eamusement-iidx")
|
||||
@@ -121,7 +121,7 @@ t.test("POST /internal-api/import/file", async (t) => {
|
||||
t.test("file/json:batch-manual", (t) => {
|
||||
t.test("Empty import", async (t) => {
|
||||
let res = await mockApi
|
||||
.post("/internal-api/import/file")
|
||||
.post("/api/import/file")
|
||||
.set("Cookie", cookie)
|
||||
.attach(
|
||||
"scoreData",
|
||||
@@ -151,7 +151,7 @@ t.test("POST /internal-api/import/file", async (t) => {
|
||||
|
||||
t.test("Single import", async (t) => {
|
||||
let res = await mockApi
|
||||
.post("/internal-api/import/file")
|
||||
.post("/api/import/file")
|
||||
.set("Cookie", cookie)
|
||||
.attach(
|
||||
"scoreData",
|
||||
@@ -42,7 +42,7 @@ const parseMultipartScoredata = (req: Request, res: Response, next: NextFunction
|
||||
|
||||
/**
|
||||
* Import scores from a file. Expects the post request to be multipart, and to provide a scoreData file.
|
||||
* @name /internal-api/import/file
|
||||
* @name /api/import/file
|
||||
*/
|
||||
router.post(
|
||||
"/file",
|
||||
@@ -50,9 +50,9 @@ process.on("unhandledRejection", (reason, promise) => {
|
||||
// limit them so as not to choke the api
|
||||
app.use(express.json({ limit: "1mb" }));
|
||||
|
||||
import internalApiRouter from "./internal-api/internal-api";
|
||||
import internalApiRouter from "./api/api";
|
||||
|
||||
app.use("/internal-api", internalApiRouter);
|
||||
app.use("/api", internalApiRouter);
|
||||
|
||||
/**
|
||||
* If any user gets to this point, we send them index.html and let react router do the routing (and 404ing)
|
||||
|
||||
@@ -8,7 +8,7 @@ export async function CreateFakeAuthCookie(mockApi: supertest.SuperTest<supertes
|
||||
await ResetDBState();
|
||||
|
||||
// possible security issue, ask hazel
|
||||
let res = await mockApi.post("/internal-api/auth/login").send({
|
||||
let res = await mockApi.post("/api/auth/login").send({
|
||||
username: "test_zkldi",
|
||||
password: "password",
|
||||
captcha: "asdf",
|
||||
|
||||
Reference in New Issue
Block a user