-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathindex.html
More file actions
103 lines (96 loc) · 5.6 KB
/
Copy pathindex.html
File metadata and controls
103 lines (96 loc) · 5.6 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1"/>
<title>reactive fetch</title>
<script type="importmap">
{
"imports": {
"oauth4webapi": "https://cdn.jsdelivr.net/npm/oauth4webapi@3.8.6/+esm",
"dpop": "https://cdn.jsdelivr.net/npm/dpop@2.1.1/+esm",
"n3": "https://esm.sh/n3@2.0.3",
"@rdfjs/wrapper": "https://cdn.jsdelivr.net/npm/@rdfjs/wrapper@0.34.0/+esm"
}
}
</script>
<script type="module">
import { DPoPTokenProvider, ReactiveFetchManager } from "./dist/mod.js"
import "./dist/registerElements.js"
/* Reactive fetch infrastructure */
const ui = document.querySelector("authorization-code-flow")
const issuerUi = document.querySelector("idp-picker")
const callbackUri = new URL("/callback.html", location.href).toString()
const dPoPTokenProvider = new DPoPTokenProvider(callbackUri, ui.getCode.bind(ui), issuerUi.getIssuer.bind(issuerUi))
const fetch = new ReactiveFetchManager([dPoPTokenProvider]).fetch
/* Page functionality: Buttons */
document.addEventListener("DOMContentLoaded", () =>
document.querySelectorAll("button.fetch").forEach(button =>
button.addEventListener("click", async e =>
await f(e.target.value))))
/* Page functionality: Onload */
async function f(uri) {
console.log(`Start fetch to ${uri}`)
try {
// const response = await fetch(uri, {signal: AbortSignal.timeout(5000)})
const response = await fetch(uri)
console.log(`Fetch succeeded to ${uri}`, response)
} catch (e) {
console.error(`Fetch failed to ${uri}`, e)
}
}
document.addEventListener("DOMContentLoaded", async () => {
await Promise.all([
f("https://echo.free.beeceptor.com/"),
// f("https://langsamu.solidcommunity.net/settings/"),
f("https://storage.inrupt.com/d5e2efbd-1dd6-4c45-b6a3-e61a05bb9d49/"),
f("https://langsamu.datapod.igrant.io/settings/"),
f("https://langsamu.solidweb.app/settings/"),
f("https://teamid.live/langsamu/settings/"),
f("https://langsamu.solidweb.org/settings/"),
// f("http://localhost:3000/a/profile/"),
])
})
</script>
</head>
<body>
<button class="fetch" value="https://echo.free.beeceptor.com/">echo</button>
<button class="fetch" value="https://langsamu.solidcommunity.net/settings/">solidcommunity.net (CSS)</button>
<button class="fetch" value="https://storage.inrupt.com/d5e2efbd-1dd6-4c45-b6a3-e61a05bb9d49/">PodSpaces (ESS)</button>
<button class="fetch" value="https://langsamu.datapod.igrant.io/settings/">datapod.igrant.io (NSS 5.7.4)</button>
<button class="fetch" value="https://langsamu.solidweb.app/settings/">solidweb.app (JSS)</button>
<button class="fetch" value="https://teamid.live/langsamu/settings/">teamid.live (CSS)</button>
<button class="fetch" value="https://langsamu.solidweb.org/settings/">solidweb.org (NSS 6.0.0)</button>
<button class="fetch" value="https://langsamu.privatedatapod.com/settings/">privatedatapod (CSS)</button>
<button class="fetch" value="https://solidweb.me/langsamu/profile/">solidweb.me (CSS)</button>
<button class="fetch" value="http://localhost:3000/a/profile/">localhost (CSS)</button>
<authorization-code-flow>
<span slot="new-text">USER INTERACTION NEEDED TO LAUNCH AUTHORIZATION CODE FLOW IN NEW WINDOW.</span>
<span slot="new-open">OPEN</span>
<span slot="new-cancel">CANCEL OPEN</span>
<span slot="switch-text">THERE IS AN ONGOING AUTHORIZATION CODE FLOW IN ANOTHER WINDOW.</span>
<span slot="switch-open">SWITCH</span>
<span slot="switch-cancel">CANCEL SWITCH</span>
</authorization-code-flow>
<idp-picker>
<option value="https://solidcommunity.net"></option>
<option value="https://datapod.igrant.io"></option>
<option value="https://solidweb.app"></option>
<option value="https://login.inrupt.com"></option>
<option value="https://teamid.live"></option>
<option value="https://solidweb.org"></option>
<option value="https://privatedatapod.com"></option>
<option value="https://solidweb.me/"></option>
<option value="http://localhost:3000"></option>
<webid-picker slot="webid-picker">
<option value="https://YOUR_USERNAME.solidcommunity.net/profile/card#me"></option>
<option value="https://id.inrupt.com/YOUR_USERNAME"></option>
<option value="https://YOUR_USERNAME.datapod.igrant.io/profile/card#me"></option>
<option value="https://YOUR_USERNAME.solidweb.app/profile/card.jsonld#me"></option>
<option value="https://teamid.live/YOUR_USERNAME/profile/card#me"></option>
<option value="https://YOUR_USERNAME.solidweb.org/profile/card#me"></option>
<option value="https://solidweb.me/YOUR_USERNAME/profile/card#me"></option>
</webid-picker>
</idp-picker>
</body>
</html>