mirror of
https://github.com/appwrite/console.git
synced 2026-06-06 19:27:48 +00:00
Fix missing rules (redirect); remove double protocol; improve placeholders for dns records; fix www subdomain rules
This commit is contained in:
@@ -15,7 +15,6 @@ export function isASubdomain(domain: string | null): boolean {
|
||||
|
||||
const { domain: apex, subdomain } = parse(domain);
|
||||
if (!apex) return false;
|
||||
if (subdomain === 'www') return false;
|
||||
|
||||
return !!subdomain;
|
||||
}
|
||||
|
||||
+15
-1
@@ -30,6 +30,20 @@
|
||||
let weight: number;
|
||||
let port: number;
|
||||
|
||||
const placeholders: Record<RecordType, string> = {
|
||||
'A': '76.75.21.21',
|
||||
'AAAA': '2001:0db8:85a3:0000:0000:8a2e:0370:7334',
|
||||
'CNAME': 'stage.example.com',
|
||||
'MX': 'mail.example.com',
|
||||
'TXT': 'v=spf1 include:_spf.example.com ~all',
|
||||
'NS': 'ns1.example.com',
|
||||
'SRV': '10 5 8080 example.com',
|
||||
'CAA': '0 issue "letsencrypt.org"',
|
||||
'HTTPS': 'https://example.com',
|
||||
'ALIAS': 'www.example.com'
|
||||
};
|
||||
$: placeholder = placeholders[type] ?? 'Enter value';
|
||||
|
||||
async function handleSubmit() {
|
||||
const record = {
|
||||
name,
|
||||
@@ -77,7 +91,7 @@
|
||||
</Input.Helper>
|
||||
</Layout.Stack>
|
||||
|
||||
<InputText id="value" label="Value" placeholder="76.75.21.21" bind:value>
|
||||
<InputText id="value" label="Value" placeholder={placeholder} bind:value>
|
||||
<Tooltip slot="info">
|
||||
<Icon icon={IconInfo} size="s" />
|
||||
<span slot="tooltip">
|
||||
|
||||
+16
-1
@@ -19,12 +19,27 @@
|
||||
import { invalidate } from '$app/navigation';
|
||||
import { Dependencies } from '$lib/constants';
|
||||
import type { Models } from '@appwrite.io/console';
|
||||
import type { RecordType } from '$lib/stores/domains';
|
||||
|
||||
export let show = false;
|
||||
export let selectedRecord: Models.DnsRecord;
|
||||
|
||||
let record = deepClone(selectedRecord);
|
||||
let error = '';
|
||||
|
||||
const placeholders: Record<RecordType, string> = {
|
||||
'A': '76.75.21.21',
|
||||
'AAAA': '2001:0db8:85a3:0000:0000:8a2e:0370:7334',
|
||||
'CNAME': 'stage.example.com',
|
||||
'MX': 'mail.example.com',
|
||||
'TXT': 'v=spf1 include:_spf.example.com ~all',
|
||||
'NS': 'ns1.example.com',
|
||||
'SRV': '10 5 8080 example.com',
|
||||
'CAA': '0 issue "letsencrypt.org"',
|
||||
'HTTPS': 'https://example.com',
|
||||
'ALIAS': 'www.example.com'
|
||||
};
|
||||
$: placeholder = placeholders[record.type] ?? 'Enter value';
|
||||
|
||||
async function handleSubmit() {
|
||||
try {
|
||||
@@ -173,7 +188,7 @@
|
||||
</Input.Helper>
|
||||
</Layout.Stack>
|
||||
|
||||
<InputText id="value" label="Value" placeholder="76.75.21.21" bind:value={record.value}>
|
||||
<InputText id="value" label="Value" placeholder={placeholder} bind:value={record.value}>
|
||||
<Tooltip slot="info">
|
||||
<Icon icon={IconInfo} size="s" />
|
||||
<span slot="tooltip">
|
||||
|
||||
+1
-1
@@ -72,7 +72,7 @@
|
||||
} else if (behaviour === 'REDIRECT') {
|
||||
rule = await sdk
|
||||
.forProject(page.params.region, page.params.project)
|
||||
.proxy.createRedirectRule(domainName, $regionalProtocol + redirect, statusCode);
|
||||
.proxy.createRedirectRule(domainName, redirect, statusCode);
|
||||
} else if (behaviour === 'ACTIVE') {
|
||||
rule = await sdk
|
||||
.forProject(page.params.region, page.params.project)
|
||||
|
||||
@@ -27,12 +27,17 @@ export const load = async ({ params, depends, url, route }) => {
|
||||
.proxy.listRules(
|
||||
[
|
||||
Query.or([
|
||||
Query.equal('type', RuleType.DEPLOYMENT),
|
||||
Query.equal('type', RuleType.REDIRECT)
|
||||
Query.and([
|
||||
Query.equal('type', RuleType.REDIRECT),
|
||||
Query.equal('trigger', RuleTrigger.MANUAL),
|
||||
]),
|
||||
Query.and([
|
||||
Query.equal('type', RuleType.DEPLOYMENT),
|
||||
Query.equal('trigger', RuleTrigger.MANUAL),
|
||||
Query.equal('deploymentResourceType', DeploymentResourceType.SITE),
|
||||
Query.equal('deploymentResourceId', params.site),
|
||||
]),
|
||||
]),
|
||||
Query.equal('deploymentResourceType', DeploymentResourceType.SITE),
|
||||
Query.equal('deploymentResourceId', params.site),
|
||||
Query.equal('trigger', RuleTrigger.MANUAL),
|
||||
Query.limit(limit),
|
||||
Query.offset(offset),
|
||||
Query.orderDesc(''),
|
||||
|
||||
+1
-1
@@ -76,7 +76,7 @@
|
||||
} else if (behaviour === 'REDIRECT') {
|
||||
rule = await sdk
|
||||
.forProject(page.params.region, page.params.project)
|
||||
.proxy.createRedirectRule(domainName, $regionalProtocol + redirect, statusCode);
|
||||
.proxy.createRedirectRule(domainName, redirect, statusCode);
|
||||
} else if (behaviour === 'ACTIVE') {
|
||||
rule = await sdk
|
||||
.forProject(page.params.region, page.params.project)
|
||||
|
||||
Reference in New Issue
Block a user