Fix mixed content warning when connecting to local node

Signed-off-by: Rūdolfs Ošiņš <rudolfs@osins.org>
This commit is contained in:
Rūdolfs Ošiņš
2023-04-05 13:49:52 +02:00
parent 016b5e9d0a
commit 9e1fc49ae7
8 changed files with 20 additions and 18 deletions
+1 -1
View File
@@ -278,7 +278,7 @@ export function extractHost(origin: string): Host {
origin === "127.0.0.1" ||
origin === "127.0.0.1:8080"
) {
return { host: "0.0.0.0", port: 8080, scheme: "http" };
return { host: "127.0.0.1", port: 8080, scheme: "http" };
} else if (origin.includes(":")) {
return {
host: origin.split(":")[0],
+6 -4
View File
@@ -1,17 +1,19 @@
<script lang="ts">
import type { Host } from "@app/lib/api";
import Clipboard from "@app/components/Clipboard.svelte";
import Floating from "@app/components/Floating.svelte";
import { closeFocused } from "@app/components/Floating.svelte";
import { parseRepositoryId } from "@app/lib/utils";
export let seedHost: string;
export let seedHost: Host;
export let id: string;
export let name: string;
$: radCloneUrl = `rad clone ${id}`;
$: gitCloneUrl = `git clone https://${seedHost}/${
parseRepositoryId(id)?.pubkey ?? id
}.git ${name}`;
$: gitCloneUrl = `git clone ${seedHost.scheme}://${seedHost.host}:${
seedHost.port
}/${parseRepositoryId(id)?.pubkey ?? id}.git ${name}`;
</script>
<style>
+1 -1
View File
@@ -101,7 +101,7 @@
on:branchChanged={event => updateRevision(event.detail)} />
{#if seed.addr.host}
<CloneButton seedHost={seed.addr.host} {id} name={project.name} />
<CloneButton seedHost={seed.addr} {id} name={project.name} />
{/if}
<span>
+3 -3
View File
@@ -55,7 +55,7 @@ test("copy to clipboard", async ({ page, browserName, context }) => {
await page.getByText("Clone").click();
await page
.locator(
`text=git clone https://0.0.0.0/${rid
`text=git clone http://127.0.0.1:8080/${rid
.replace("rad:", "")
.substring(0, 10)}`,
)
@@ -66,7 +66,7 @@ test("copy to clipboard", async ({ page, browserName, context }) => {
.locator(".clipboard")
.click();
await expectClipboard(
`git clone https://0.0.0.0/${rid.replace(
`git clone http://127.0.0.1:8080/${rid.replace(
"rad:",
"",
)}.git source-browsing`,
@@ -79,7 +79,7 @@ test("copy to clipboard", async ({ page, browserName, context }) => {
{
await page.locator(".clipboard").first().click();
await expectClipboard(
"z6Mkk7oqY4pPxhMmGEotDYsFo97vhCj85BLY1H256HrJmjN8@0.0.0.0:8776",
"z6Mkk7oqY4pPxhMmGEotDYsFo97vhCj85BLY1H256HrJmjN8@127.0.0.1:8776",
page,
);
}
+1 -1
View File
@@ -35,7 +35,7 @@ test("navigation between seed and project pages", async ({ page }) => {
await expectUrlPersistsReload(page);
await page.locator('role=button[name="Seed"]').click();
await expect(page).toHaveURL("/#/seeds/0.0.0.0");
await expect(page).toHaveURL("/#/seeds/127.0.0.1");
});
test.describe("project page navigation", () => {
+1 -1
View File
@@ -35,7 +35,7 @@ test("navigation between seed and project pages", async ({ page }) => {
await expectUrlPersistsReload(page);
await page.locator('role=button[name="Seed"]').click();
await expect(page).toHaveURL("/seeds/0.0.0.0");
await expect(page).toHaveURL("/seeds/127.0.0.1");
});
test.describe("project page navigation", () => {
+1 -1
View File
@@ -250,7 +250,7 @@ test("clone modal", async ({ page }) => {
await page.getByText("Clone").click();
await expect(page.locator(`text=rad clone ${rid}`)).toBeVisible();
await expect(
page.locator(`text=https://0.0.0.0/${rid.replace("rad:", "")}.git`),
page.locator(`text=http://127.0.0.1:8080/${rid.replace("rad:", "")}.git`),
).toBeVisible();
});
+6 -6
View File
@@ -52,7 +52,7 @@ export const test = base.extend<{
defaultHttpdPort: 8080,
defaultHttpdScheme: "http",
defaultNodePort: 8776,
pinned: [{ host: "0.0.0.0" }],
pinned: [{ host: "127.0.0.1" }],
},
projects: { pinned: [] },
};
@@ -134,14 +134,14 @@ export function configFixture() {
defaultHttpdPort: 8080,
defaultHttpdScheme: "http",
defaultNodePort: 8776,
pinned: [{ host: "0.0.0.0" }],
pinned: [{ host: "127.0.0.1" }],
},
projects: {
pinned: [
{
name: "source-browsing",
id: "rad:git:hnrkdi8be7n4hhqoz9rpzrgd68u9dr3zsxgmy",
seed: "0.0.0.0",
seed: "127.0.0.1",
},
],
},
@@ -155,14 +155,14 @@ export function appConfigWithFixture() {
defaultHttpdPort: 8080,
defaultHttpdScheme: "http",
defaultNodePort: 8776,
pinned: [{ host: "0.0.0.0" }],
pinned: [{ host: "127.0.0.1" }],
},
projects: {
pinned: [
{
name: "source-browsing",
id: "rad:zKtT7DmF9H34KkvcKj9PHW19WzjT",
seed: "0.0.0.0",
seed: "127.0.0.1",
},
],
},
@@ -175,7 +175,7 @@ export const aliceRemote =
export const bobRemote =
"did:key:z6MksMTThc1aDU2Ztc43jJUivuyBLNWiLsDf4X65rABe7HbA";
export const rid = "rad:zKtT7DmF9H34KkvcKj9PHW19WzjT";
export const projectFixtureUrl = `/seeds/0.0.0.0/${rid}`;
export const projectFixtureUrl = `/seeds/127.0.0.1/${rid}`;
export const seedPort = 8080;
export const seedVersion = "0.1.0-6463768";
export const seedRemote = "z6Mkk7oqY4pPxhMmGEotDYsFo97vhCj85BLY1H256HrJmjN8";