diff --git a/packages/backend-core/src/constants.js b/packages/backend-core/src/constants.js index 8e6b01608e..28b9ced49b 100644 --- a/packages/backend-core/src/constants.js +++ b/packages/backend-core/src/constants.js @@ -8,7 +8,6 @@ exports.Cookies = { Auth: "budibase:auth", Init: "budibase:init", OIDC_CONFIG: "budibase:oidc:config", - RETURN_URL: "budibase:returnurl", } exports.Headers = { diff --git a/packages/backend-core/src/utils.js b/packages/backend-core/src/utils.js index 85dd32946f..8c00f2a8b8 100644 --- a/packages/backend-core/src/utils.js +++ b/packages/backend-core/src/utils.js @@ -96,12 +96,7 @@ exports.getCookie = (ctx, name) => { * @param {string|object} value The value of cookie which will be set. * @param {object} opts options like whether to sign. */ -exports.setCookie = ( - ctx, - value, - name = "builder", - opts = { sign: true, requestDomain: false } -) => { +exports.setCookie = (ctx, value, name = "builder", opts = { sign: true }) => { if (value && opts && opts.sign) { value = jwt.sign(value, options.secretOrKey) } @@ -113,7 +108,7 @@ exports.setCookie = ( overwrite: true, } - if (environment.COOKIE_DOMAIN && !opts.requestDomain) { + if (environment.COOKIE_DOMAIN) { config.domain = environment.COOKIE_DOMAIN } diff --git a/packages/server/src/integrations/rest.ts b/packages/server/src/integrations/rest.ts index ea40dfb609..3199ce3bde 100644 --- a/packages/server/src/integrations/rest.ts +++ b/packages/server/src/integrations/rest.ts @@ -43,8 +43,8 @@ const coreFields = { enum: Object.values(BodyTypes), }, pagination: { - type: DatasourceFieldTypes.OBJECT, - }, + type: DatasourceFieldTypes.OBJECT + } } module RestModule { @@ -178,17 +178,12 @@ module RestModule { headers, }, pagination: { - cursor: nextCursor, - }, + cursor: nextCursor + } } } - getUrl( - path: string, - queryString: string, - pagination: PaginationConfig | null, - paginationValues: PaginationValues | null - ): string { + getUrl(path: string, queryString: string, pagination: PaginationConfig | null, paginationValues: PaginationValues | null): string { // Add pagination params to query string if required if (pagination?.location === "query" && paginationValues) { const { pageParam, sizeParam } = pagination @@ -222,22 +217,14 @@ module RestModule { return complete } - addBody( - bodyType: string, - body: string | any, - input: any, - pagination: PaginationConfig | null, - paginationValues: PaginationValues | null - ) { + addBody(bodyType: string, body: string | any, input: any, pagination: PaginationConfig | null, paginationValues: PaginationValues | null) { if (!input.headers) { input.headers = {} } if (bodyType === BodyTypes.NONE) { return input } - let error, - object: any = {}, - string = "" + let error, object: any = {}, string = "" try { if (body) { string = typeof body !== "string" ? JSON.stringify(body) : body @@ -346,7 +333,7 @@ module RestModule { requestBody, authConfigId, pagination, - paginationValues, + paginationValues } = query const authHeaders = this.getAuthHeaders(authConfigId) @@ -365,13 +352,7 @@ module RestModule { } let input: any = { method, headers: this.headers } - input = this.addBody( - bodyType, - requestBody, - input, - pagination, - paginationValues - ) + input = this.addBody(bodyType, requestBody, input, pagination, paginationValues) this.startTimeMs = performance.now() const url = this.getUrl(path, queryString, pagination, paginationValues) diff --git a/packages/server/src/integrations/s3.ts b/packages/server/src/integrations/s3.ts index 273f221575..25b439fd58 100644 --- a/packages/server/src/integrations/s3.ts +++ b/packages/server/src/integrations/s3.ts @@ -38,7 +38,7 @@ module S3Module { signatureVersion: { type: "string", required: false, - default: "v4", + default: "v4" }, }, query: { diff --git a/packages/server/src/middleware/currentapp.js b/packages/server/src/middleware/currentapp.js index e11aefdf1c..69f80c895b 100644 --- a/packages/server/src/middleware/currentapp.js +++ b/packages/server/src/middleware/currentapp.js @@ -47,15 +47,6 @@ module.exports = async (ctx, next) => { (!ctx.user || !ctx.user.builder || !ctx.user.builder.global) ) { clearCookie(ctx, Cookies.CurrentApp) - // have to set the return url on the server side as client side is not available - setCookie(ctx, ctx.url, Cookies.RETURN_URL, { - // don't sign so the browser can easily read - sign: false, - // use the request domain to match how ui handles the return url cookie. - // it's important we don't use the shared domain here as the builder - // can't delete from it without awareness of the domain. - requestDomain: true, - }) return ctx.redirect("/") }