-
Notifications
You must be signed in to change notification settings - Fork 11
Expand file tree
/
Copy pathindex.html
More file actions
74 lines (66 loc) · 1.99 KB
/
index.html
File metadata and controls
74 lines (66 loc) · 1.99 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
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
<meta
name="viewport"
content="width=device-width, initial-scale=1.0, viewport-fit=cover"
/>
<base href="/" />
<title>sl-web-tools firmware flasher</title>
<style>
html,
body {
margin: 0;
padding: 0;
font-family: sans-serif;
background-color: #ededed;
font-family: 'Segoe UI', Roboto, sans-serif;
--mdc-theme-primary: #03a9f4;
}
main {
display: flex;
flex-direction: column;
align-items: center;
justify-content: flex-start;
font-size: 1em;
padding: 5em;
max-width: 600px;
margin-left: auto;
margin-right: auto;
}
</style>
</head>
<body>
<main>
<nabucasa-zigbee-flasher
id="flasher"
manifest="./assets/manifests/zbt2.json"
github-releases-api="https://api.github.com/repos/NabuCasa/silabs-firmware-builder/releases"
firmware-regex="^zbt2_"
>
<span slot="button">Connect</span>
</nabucasa-zigbee-flasher>
</main>
<script module>
import(
// In development we import locally.
window.location.hostname === 'localhost'
? '/dist/web/nabucasa-zigbee-flasher.js'
: 'https://unpkg.com/@nabucasa/sl-web-tools@0.11.0/dist/web/nabucasa-zigbee-flasher.js?module'
).then(() => {
// Transform GitHub release download URLs to raw.githubusercontent.com URLs to bypass CORS
document.querySelector('#flasher').assetUrlTransformer = (url) => {
const match = url.match(
/github\.com\/([^/]+)\/([^/]+)\/releases\/download\/([^/]+)\/(.+)/,
);
if (match) {
const [, owner, repo, tag, filename] = match;
return `https://raw.githubusercontent.com/${owner}/${repo}/refs/heads/releases/${tag}/${filename}`;
}
return url;
};
});
</script>
</body>
</html>