From 1a38165274af436f9f7e40adeab43f7b51dd5101 Mon Sep 17 00:00:00 2001 From: "Jorge Caballero (DataDrivenMD)" <116459476+DataDrivenMD@users.noreply.github.com> Date: Thu, 2 Mar 2023 14:29:18 -0800 Subject: [PATCH] Revert "Merge branch 'main' into api/v1/instance" This reverts commit 077611411a23942a0082f68b17c3e471c4612a4c, reversing changes made to 4ef9d98e12e9c3f84296a0c7ea911aba5a7471c0. --- .github/workflows/deploy.yml | 1 - backend/src/types/instance.ts | 2 +- backend/src/utils/parse.ts | 20 +++++++------------- config/accounts.ts | 2 +- functions/api/v1/instance.ts | 2 +- tf/main.tf | 15 +++++++-------- 6 files changed, 17 insertions(+), 25 deletions(-) diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml index c81e43f..e3c45ed 100644 --- a/.github/workflows/deploy.yml +++ b/.github/workflows/deploy.yml @@ -4,7 +4,6 @@ on: branches: - main repository_dispatch: - workflow_dispatch: jobs: deploy: runs-on: ubuntu-latest diff --git a/backend/src/types/instance.ts b/backend/src/types/instance.ts index e326516..d2bac34 100644 --- a/backend/src/types/instance.ts +++ b/backend/src/types/instance.ts @@ -64,4 +64,4 @@ export type PollsConfiguration = { max_characters_per_option: number min_expiration: number max_expiration: number -} \ No newline at end of file +} diff --git a/backend/src/utils/parse.ts b/backend/src/utils/parse.ts index fa75a02..34dfcd7 100644 --- a/backend/src/utils/parse.ts +++ b/backend/src/utils/parse.ts @@ -14,21 +14,15 @@ export function parseHandle(query: string): Handle { query = decodeURIComponent(query) const parts = query.split('@') - if (parts.length > 0) { - const localPart = parts[0] + const localPart = parts[0] - if (!/^[\w-.]+$/.test(localPart)) { - throw new Error('invalid handle: localPart: ' + localPart) - } + if (!/^[\w-.]+$/.test(localPart)) { + throw new Error('invalid handle: localPart: ' + localPart) + } - if (parts.length > 1) { - return { localPart, domain: parts[1] } - } else { - return { localPart, domain: null } - } + if (parts.length > 1) { + return { localPart, domain: parts[1] } } else { - // it's a URI handle? - const urlParts = query.replace(/^https?:\/\//, '').split('/') - return { domain: urlParts[0], localPart: urlParts[urlParts.length - 1] } + return { localPart, domain: null } } } diff --git a/config/accounts.ts b/config/accounts.ts index efa214c..6788303 100644 --- a/config/accounts.ts +++ b/config/accounts.ts @@ -2,4 +2,4 @@ import type { DefaultImages } from '../backend/src/types/configs' export const defaultImages: DefaultImages = { avatar: 'https://raw.githubusercontent.com/mastodon/mastodon/main/public/avatars/original/missing.png', header: 'https://imagedelivery.net/NkfPDviynOyTAOI79ar_GQ/b24caf12-5230-48c4-0bf7-2f40063bd400/header', -} \ No newline at end of file +} diff --git a/functions/api/v1/instance.ts b/functions/api/v1/instance.ts index fd71189..1f460af 100644 --- a/functions/api/v1/instance.ts +++ b/functions/api/v1/instance.ts @@ -81,4 +81,4 @@ export async function handleRequest(domain: string, db: Database, env: Env) { rules: [], } return new Response(JSON.stringify(res), { headers }) -} \ No newline at end of file +} diff --git a/tf/main.tf b/tf/main.tf index b6457f3..f5384da 100644 --- a/tf/main.tf +++ b/tf/main.tf @@ -143,13 +143,12 @@ resource "cloudflare_pages_project" "wildebeest_pages_project" { } resource "cloudflare_record" "record" { - allow_overwrite = true - zone_id = trimspace(var.cloudflare_zone_id) - name = trimspace(var.cloudflare_deploy_domain) - value = cloudflare_pages_project.wildebeest_pages_project.subdomain - type = "CNAME" - ttl = 1 - proxied = true + zone_id = trimspace(var.cloudflare_zone_id) + name = trimspace(var.cloudflare_deploy_domain) + value = cloudflare_pages_project.wildebeest_pages_project.subdomain + type = "CNAME" + ttl = 1 + proxied = true } resource "cloudflare_pages_domain" "domain" { @@ -168,6 +167,6 @@ resource "cloudflare_access_application" "wildebeest_access" { name = "wildebeest-${lower(var.name_suffix)}" domain = "${trimspace(var.cloudflare_deploy_domain)}/oauth/authorize" type = "self_hosted" - session_duration = "24h" + session_duration = "730h" auto_redirect_to_identity = false }