add apache htaccess

This commit is contained in:
Ludvík Prokopec 2022-12-23 13:21:31 +01:00
parent f0ca5baf15
commit 0ed79810da
4 changed files with 34 additions and 42 deletions

8
public/.htaccess Normal file
View File

@ -0,0 +1,8 @@
RewriteEngine On
RewriteCond %{HTTPS} off
RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI} [R=301,L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . index.html [L]

View File

@ -3,13 +3,12 @@ import Input from './Common/Input.svelte';
import InputWrappper from './Common/InputWrappper.svelte';
import Loading from './Common/Loading.svelte';
import SOffline from './Common/SOffline.svelte';
import Link from './Common/Link.svelte';
import Sortable from './Common/Sortable.svelte';
import Radio from './Common/Radio.svelte';
import Checkbox from './Common/Checkbox.svelte';
import Switch from './Common/Switch.svelte';
import Select from './Common/Select.svelte';
import { Body, Html, PwaInstaller } from './Common/Meta';
export { Body, Html, PwaInstaller } from './Common/Meta';
export { Button, Input, InputWrappper, Loading, SOffline, Body, Html, PwaInstaller, Link, Sortable, Switch, Radio, Checkbox, Select };
export { Button, Input, InputWrappper, Loading, SOffline, Sortable, Switch, Radio, Checkbox, Select };

View File

@ -1,13 +1,32 @@
<script lang="ts">
export let href: string = null
import { link } from '$lib/router'
export let href: string | null = null
let className = ''
export { className as class }
const isValidHttpUrl = (string) => {
let url: URL
try {
url = new URL(string)
} catch (_) {
return false
}
return url.protocol === 'http:' || url.protocol === 'https:'
}
</script>
{#if href !== null}
<a {href} class={className}>
<slot />
</a>
{#if href}
{#if isValidHttpUrl(href)}
<a {href} class={className}>
<slot />
</a>
{:else}
<a {href} class={className} use:link>
<slot />
</a>
{/if}
{:else}
<button class={className} on:click>
<slot />

View File

@ -1,34 +0,0 @@
<script lang="ts">
import { link } from '$lib/router'
export let href: string | null = null
let className = ''
export { className as class }
const isValidHttpUrl = (string) => {
let url: URL
try {
url = new URL(string)
} catch (_) {
return false
}
return url.protocol === 'http:' || url.protocol === 'https:'
}
</script>
{#if href}
{#if isValidHttpUrl(href)}
<a {href} class={className}>
<slot />
</a>
{:else}
<a {href} class={className} use:link>
<slot />
</a>
{/if}
{:else}
<button class={className} on:click>
<slot />
</button>
{/if}