goosebit 0.1.0__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (48) hide show
  1. goosebit/__init__.py +62 -0
  2. goosebit/api/__init__.py +1 -0
  3. goosebit/api/devices.py +112 -0
  4. goosebit/api/download.py +20 -0
  5. goosebit/api/firmware.py +64 -0
  6. goosebit/api/routes.py +11 -0
  7. goosebit/auth/__init__.py +123 -0
  8. goosebit/db.py +32 -0
  9. goosebit/models.py +21 -0
  10. goosebit/permissions.py +55 -0
  11. goosebit/realtime/__init__.py +1 -0
  12. goosebit/realtime/logs.py +43 -0
  13. goosebit/realtime/routes.py +13 -0
  14. goosebit/settings.py +55 -0
  15. goosebit/ui/__init__.py +1 -0
  16. goosebit/ui/routes.py +104 -0
  17. goosebit/ui/static/__init__.py +5 -0
  18. goosebit/ui/static/favicon.ico +0 -0
  19. goosebit/ui/static/favicon.svg +1 -0
  20. goosebit/ui/static/js/devices.js +370 -0
  21. goosebit/ui/static/js/firmware.js +131 -0
  22. goosebit/ui/static/js/index.js +161 -0
  23. goosebit/ui/static/js/logs.js +18 -0
  24. goosebit/ui/static/svg/goosebit-logo.svg +1 -0
  25. goosebit/ui/templates/__init__.py +5 -0
  26. goosebit/ui/templates/devices.html +82 -0
  27. goosebit/ui/templates/firmware.html +47 -0
  28. goosebit/ui/templates/index.html +37 -0
  29. goosebit/ui/templates/login.html +34 -0
  30. goosebit/ui/templates/logs.html +21 -0
  31. goosebit/ui/templates/nav.html +64 -0
  32. goosebit/updater/__init__.py +1 -0
  33. goosebit/updater/controller/__init__.py +1 -0
  34. goosebit/updater/controller/routes.py +6 -0
  35. goosebit/updater/controller/v1/__init__.py +1 -0
  36. goosebit/updater/controller/v1/routes.py +92 -0
  37. goosebit/updater/download/__init__.py +1 -0
  38. goosebit/updater/download/routes.py +6 -0
  39. goosebit/updater/download/v1/__init__.py +1 -0
  40. goosebit/updater/download/v1/routes.py +26 -0
  41. goosebit/updater/manager.py +206 -0
  42. goosebit/updater/misc.py +69 -0
  43. goosebit/updater/routes.py +30 -0
  44. goosebit/updater/updates.py +93 -0
  45. goosebit-0.1.0.dist-info/LICENSE +201 -0
  46. goosebit-0.1.0.dist-info/METADATA +37 -0
  47. goosebit-0.1.0.dist-info/RECORD +48 -0
  48. goosebit-0.1.0.dist-info/WHEEL +4 -0
@@ -0,0 +1,206 @@
1
+ from __future__ import annotations
2
+
3
+ import asyncio
4
+ from abc import ABC, abstractmethod
5
+ from contextlib import asynccontextmanager
6
+ from typing import Callable
7
+
8
+ import aiofiles
9
+
10
+ from goosebit.models import Device
11
+ from goosebit.settings import POLL_TIME, SWUPDATE_FILES_DIR, TOKEN_SWU_DIR
12
+ from goosebit.updater.misc import get_newest_fw
13
+ from goosebit.updater.updates import FirmwareArtifact
14
+
15
+
16
+ class UpdateManager(ABC):
17
+ def __init__(self, dev_id: str):
18
+ self.dev_id = dev_id
19
+ self.device = None
20
+ self.force_update = False
21
+ self.update_complete = False
22
+ self.poll_time = POLL_TIME
23
+ self.log_subscribers: list[Callable] = []
24
+
25
+ async def get_device(self) -> Device | None:
26
+ return
27
+
28
+ async def save(self) -> None:
29
+ return
30
+
31
+ async def update_fw_version(self, version: str) -> None:
32
+ return
33
+
34
+ async def update_device_state(self, state: str) -> None:
35
+ return
36
+
37
+ async def update_last_seen(self, last_seen: int) -> None:
38
+ return
39
+
40
+ async def update_web_pwd(self, web_pwd: str) -> None:
41
+ return
42
+
43
+ async def update_last_ip(self, last_ip: str) -> None:
44
+ return
45
+
46
+ async def update_cfd_status(self, status: bool) -> None:
47
+ return
48
+
49
+ async def create_cfd_token(self) -> str:
50
+ return ""
51
+
52
+ async def delete_cfd_token(self):
53
+ return
54
+
55
+ @asynccontextmanager
56
+ async def subscribe_log(self, callback: Callable):
57
+ device = await self.get_device()
58
+ self.log_subscribers.append(callback)
59
+ await callback(device.last_log)
60
+ try:
61
+ yield
62
+ except asyncio.CancelledError:
63
+ pass
64
+ finally:
65
+ self.log_subscribers.remove(callback)
66
+
67
+ async def publish_log(self, log_data: str | None):
68
+ for cb in self.log_subscribers:
69
+ await cb(log_data)
70
+
71
+ @property
72
+ def cfd_provisioned(self) -> bool:
73
+ return False
74
+
75
+ @abstractmethod
76
+ async def get_update_file(self) -> FirmwareArtifact: ...
77
+
78
+ @abstractmethod
79
+ async def get_update_mode(self) -> str: ...
80
+
81
+ @abstractmethod
82
+ async def update_log(self, log_data: str) -> None: ...
83
+
84
+
85
+ class UnknownUpdateManager(UpdateManager):
86
+ def __init__(self, dev_id: str):
87
+ super().__init__(dev_id)
88
+ self.poll_time = "00:00:05"
89
+
90
+ async def get_update_file(self) -> FirmwareArtifact:
91
+ return FirmwareArtifact(get_newest_fw())
92
+
93
+ async def get_update_mode(self) -> str:
94
+ return "forced"
95
+
96
+ async def update_log(self, log_data: str) -> None:
97
+ return
98
+
99
+
100
+ class DeviceUpdateManager(UpdateManager):
101
+ async def get_device(self) -> Device:
102
+ if self.device:
103
+ return self.device
104
+ self.device = (await Device.get_or_create(uuid=self.dev_id))[0]
105
+ return self.device
106
+
107
+ async def save(self) -> None:
108
+ await self.device.save()
109
+
110
+ async def update_fw_version(self, version: str) -> None:
111
+ device = await self.get_device()
112
+ device.fw_version = version
113
+
114
+ async def update_device_state(self, state: str) -> None:
115
+ device = await self.get_device()
116
+ device.last_state = state
117
+
118
+ async def update_last_seen(self, last_seen: int) -> None:
119
+ device = await self.get_device()
120
+ device.last_seen = last_seen
121
+
122
+ async def update_last_ip(self, last_ip: str) -> None:
123
+ device = await self.get_device()
124
+ if ":" in last_ip:
125
+ device.last_ipv6 = last_ip
126
+ else:
127
+ device.last_ip = last_ip
128
+
129
+ async def get_update_file(self) -> FirmwareArtifact:
130
+ device = await self.get_device()
131
+ file = FirmwareArtifact(device.fw_file)
132
+
133
+ if self.force_update:
134
+ return file
135
+ return file
136
+
137
+ async def get_update_mode(self) -> str:
138
+ device = await self.get_device()
139
+
140
+ file = await self.get_update_file()
141
+ if file.is_empty():
142
+ mode = "skip"
143
+ self.poll_time = POLL_TIME
144
+ elif file.name == device.fw_version:
145
+ mode = "skip"
146
+ self.poll_time = POLL_TIME
147
+ else:
148
+ mode = "forced"
149
+ self.poll_time = "00:00:05"
150
+
151
+ if self.force_update:
152
+ mode = "forced"
153
+ self.poll_time = "00:00:05"
154
+
155
+ if mode == "forced" and self.update_complete:
156
+ self.update_complete = False
157
+ await self.clear_log()
158
+
159
+ return mode
160
+
161
+ async def update_log(self, log_data: str) -> None:
162
+ if log_data is None:
163
+ return
164
+ device = await self.get_device()
165
+ if device.last_log is None:
166
+ device.last_log = ""
167
+ if log_data.startswith("Installing Update Chunk Artifacts."):
168
+ await self.clear_log()
169
+ if log_data == "All Chunks Installed.":
170
+ self.force_update = False
171
+ self.update_complete = True
172
+ if not log_data == "Skipped Update.":
173
+ device.last_log += f"{log_data}\n"
174
+ await self.publish_log(f"{log_data}\n")
175
+
176
+ async def clear_log(self) -> None:
177
+ device = await self.get_device()
178
+ device.last_log = ""
179
+ await self.publish_log(None)
180
+
181
+
182
+ device_managers = {"unknown": UnknownUpdateManager("unknown")}
183
+
184
+
185
+ async def get_update_manager(dev_id: str) -> UpdateManager:
186
+ global device_managers
187
+ if device_managers.get(dev_id) is None:
188
+ device_managers[dev_id] = DeviceUpdateManager(dev_id)
189
+ return device_managers[dev_id]
190
+
191
+
192
+ def get_update_manager_sync(dev_id: str) -> UpdateManager:
193
+ global device_managers
194
+ if device_managers.get(dev_id) is None:
195
+ device_managers[dev_id] = DeviceUpdateManager(dev_id)
196
+ return device_managers[dev_id]
197
+
198
+
199
+ async def delete_device(dev_id: str) -> None:
200
+ global device_managers
201
+ try:
202
+ updater = get_update_manager_sync(dev_id)
203
+ await (await updater.get_device()).delete()
204
+ del device_managers[dev_id]
205
+ except KeyError:
206
+ pass
@@ -0,0 +1,69 @@
1
+ from __future__ import annotations
2
+
3
+ import datetime
4
+ import hashlib
5
+ from pathlib import Path
6
+
7
+ from goosebit.models import Device
8
+ from goosebit.settings import UPDATES_DIR
9
+
10
+
11
+ def sha1_hash_file(file_path: Path):
12
+ with file_path.open("rb") as f:
13
+ sha1_hash = hashlib.file_digest(f, "sha1")
14
+ return sha1_hash.hexdigest()
15
+
16
+
17
+ def get_newest_fw() -> str:
18
+ fw_files = [f for f in UPDATES_DIR.iterdir() if f.suffix == ".swu"]
19
+ if len(fw_files) == 0:
20
+ return ""
21
+
22
+ return str(sorted(fw_files, key=lambda x: fw_sort_key(x), reverse=True)[0].name)
23
+
24
+
25
+ def fw_sort_key(filename: Path) -> datetime.datetime:
26
+ image_data = filename.stem.split("_")
27
+ if len(image_data) == 3:
28
+ tenant, date, time = image_data
29
+ elif len(image_data) == 4:
30
+ tenant, hw_version, date, time = image_data
31
+ else:
32
+ return datetime.datetime.now()
33
+
34
+ return datetime.datetime.strptime(f"{date}_{time}", "%Y%m%d_%H%M%S")
35
+
36
+
37
+ def get_fw_components(filename: Path) -> dict:
38
+ image_data = filename.stem.split("_")
39
+ if len(image_data) == 3:
40
+ tenant, date, time = image_data
41
+ return {
42
+ "date": datetime.datetime.strptime(f"{date}_{time}", "%Y%m%d_%H%M%S"),
43
+ "day": date,
44
+ "time": time,
45
+ "tenant": tenant,
46
+ "hw_version": 0,
47
+ }
48
+ elif len(image_data) == 4:
49
+ tenant, hw_version, date, time = image_data
50
+ return {
51
+ "date": datetime.datetime.strptime(f"{date}_{time}", "%Y%m%d_%H%M%S"),
52
+ "day": date,
53
+ "time": time,
54
+ "tenant": tenant,
55
+ "hw_version": int(hw_version.upper().replace("V", "")),
56
+ }
57
+
58
+
59
+ async def get_device_by_uuid(dev_id: str) -> Device:
60
+ if dev_id == "unknown":
61
+ return Device(
62
+ uuid="unknown",
63
+ name="Unknown",
64
+ fw_file="latest",
65
+ fw_version=None,
66
+ last_state=None,
67
+ last_log=None,
68
+ )
69
+ return (await Device.get_or_create(uuid=dev_id))[0]
@@ -0,0 +1,30 @@
1
+ import time
2
+
3
+ from fastapi import APIRouter, Depends, HTTPException
4
+ from fastapi.requests import Request
5
+
6
+ from . import controller, download
7
+ from .manager import get_update_manager_sync
8
+
9
+
10
+ async def verify_tenant(tenant: str):
11
+ if not tenant == "loadsync":
12
+ raise HTTPException(404)
13
+ return tenant
14
+
15
+
16
+ async def log_last_connection(request: Request, dev_id: str):
17
+ host = request.client.host
18
+ updater = get_update_manager_sync(dev_id)
19
+ await updater.update_last_ip(host)
20
+ await updater.update_last_seen(round(time.time()))
21
+ await updater.save()
22
+
23
+
24
+ router = APIRouter(
25
+ prefix="/{tenant}",
26
+ dependencies=[Depends(verify_tenant), Depends(log_last_connection)],
27
+ tags=["ddi"],
28
+ )
29
+ router.include_router(controller.router)
30
+ router.include_router(download.router)
@@ -0,0 +1,93 @@
1
+ import datetime
2
+ from pathlib import Path
3
+ from typing import Optional
4
+
5
+ from fastapi.requests import Request
6
+
7
+ from goosebit.settings import TOKEN_SWU_DIR, UPDATES_DIR
8
+ from goosebit.updater.misc import get_newest_fw, sha1_hash_file
9
+
10
+
11
+ class FirmwareArtifact:
12
+ def __init__(self, file: str = None, dev_id: str = None):
13
+ if file == "latest":
14
+ self.file = get_newest_fw()
15
+ elif file == "pinned":
16
+ self.file = None
17
+ else:
18
+ self.file = file
19
+ self.dev_id = dev_id
20
+
21
+ def __eq__(self, other):
22
+ if isinstance(other, str):
23
+ return self.name == other
24
+ elif isinstance(other, FirmwareArtifact):
25
+ return self.file == other.file
26
+ return False
27
+
28
+ def is_empty(self) -> bool:
29
+ return self.file is None
30
+
31
+ def file_exists(self) -> bool:
32
+ if self.is_empty():
33
+ return False
34
+ if self.file == "cloudflared.swu":
35
+ return True
36
+ return self.path.exists()
37
+
38
+ @property
39
+ def name(self):
40
+ if not self.is_empty():
41
+ return self.file.split(".")[0]
42
+
43
+ @property
44
+ def version(self):
45
+ if not self.is_empty():
46
+ return "_".join(self.name.split("_")[2:])
47
+
48
+ @property
49
+ def timestamp(self):
50
+ return datetime.datetime.strptime(self.version, "%Y%m%d_%H%M%S")
51
+
52
+ @property
53
+ def path(self) -> Optional[Path]:
54
+ if not self.is_empty():
55
+ if self.file == "cloudflared.swu":
56
+ return TOKEN_SWU_DIR.joinpath(self.dev_id, self.file)
57
+ return UPDATES_DIR.joinpath(self.file)
58
+
59
+ @property
60
+ def dl_endpoint(self):
61
+ if self.file == "cloudflared.swu":
62
+ return "download_cfd_conf"
63
+ return "download_file"
64
+
65
+ def generate_chunk(self, request: Request, tenant: str, dev_id: str) -> list:
66
+ if not self.file_exists():
67
+ return []
68
+ return [
69
+ {
70
+ "part": "os",
71
+ "version": "1",
72
+ "name": self.file,
73
+ "artifacts": [
74
+ {
75
+ "filename": self.file,
76
+ "hashes": {"sha1": sha1_hash_file(self.path)},
77
+ "size": self.path.stat().st_size,
78
+ "_links": {
79
+ "download": {
80
+ "href": str(
81
+ request.url_for(
82
+ self.dl_endpoint,
83
+ tenant=tenant,
84
+ dev_id=dev_id,
85
+ file=self.file,
86
+ )
87
+ )
88
+ }
89
+ },
90
+ }
91
+ ],
92
+ }
93
+ ]
@@ -0,0 +1,201 @@
1
+ Apache License
2
+ Version 2.0, January 2004
3
+ http://www.apache.org/licenses/
4
+
5
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
6
+
7
+ 1. Definitions.
8
+
9
+ "License" shall mean the terms and conditions for use, reproduction,
10
+ and distribution as defined by Sections 1 through 9 of this document.
11
+
12
+ "Licensor" shall mean the copyright owner or entity authorized by
13
+ the copyright owner that is granting the License.
14
+
15
+ "Legal Entity" shall mean the union of the acting entity and all
16
+ other entities that control, are controlled by, or are under common
17
+ control with that entity. For the purposes of this definition,
18
+ "control" means (i) the power, direct or indirect, to cause the
19
+ direction or management of such entity, whether by contract or
20
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
21
+ outstanding shares, or (iii) beneficial ownership of such entity.
22
+
23
+ "You" (or "Your") shall mean an individual or Legal Entity
24
+ exercising permissions granted by this License.
25
+
26
+ "Source" form shall mean the preferred form for making modifications,
27
+ including but not limited to software source code, documentation
28
+ source, and configuration files.
29
+
30
+ "Object" form shall mean any form resulting from mechanical
31
+ transformation or translation of a Source form, including but
32
+ not limited to compiled object code, generated documentation,
33
+ and conversions to other media types.
34
+
35
+ "Work" shall mean the work of authorship, whether in Source or
36
+ Object form, made available under the License, as indicated by a
37
+ copyright notice that is included in or attached to the work
38
+ (an example is provided in the Appendix below).
39
+
40
+ "Derivative Works" shall mean any work, whether in Source or Object
41
+ form, that is based on (or derived from) the Work and for which the
42
+ editorial revisions, annotations, elaborations, or other modifications
43
+ represent, as a whole, an original work of authorship. For the purposes
44
+ of this License, Derivative Works shall not include works that remain
45
+ separable from, or merely link (or bind by name) to the interfaces of,
46
+ the Work and Derivative Works thereof.
47
+
48
+ "Contribution" shall mean any work of authorship, including
49
+ the original version of the Work and any modifications or additions
50
+ to that Work or Derivative Works thereof, that is intentionally
51
+ submitted to Licensor for inclusion in the Work by the copyright owner
52
+ or by an individual or Legal Entity authorized to submit on behalf of
53
+ the copyright owner. For the purposes of this definition, "submitted"
54
+ means any form of electronic, verbal, or written communication sent
55
+ to the Licensor or its representatives, including but not limited to
56
+ communication on electronic mailing lists, source code control systems,
57
+ and issue tracking systems that are managed by, or on behalf of, the
58
+ Licensor for the purpose of discussing and improving the Work, but
59
+ excluding communication that is conspicuously marked or otherwise
60
+ designated in writing by the copyright owner as "Not a Contribution."
61
+
62
+ "Contributor" shall mean Licensor and any individual or Legal Entity
63
+ on behalf of whom a Contribution has been received by Licensor and
64
+ subsequently incorporated within the Work.
65
+
66
+ 2. Grant of Copyright License. Subject to the terms and conditions of
67
+ this License, each Contributor hereby grants to You a perpetual,
68
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
69
+ copyright license to reproduce, prepare Derivative Works of,
70
+ publicly display, publicly perform, sublicense, and distribute the
71
+ Work and such Derivative Works in Source or Object form.
72
+
73
+ 3. Grant of Patent License. Subject to the terms and conditions of
74
+ this License, each Contributor hereby grants to You a perpetual,
75
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
76
+ (except as stated in this section) patent license to make, have made,
77
+ use, offer to sell, sell, import, and otherwise transfer the Work,
78
+ where such license applies only to those patent claims licensable
79
+ by such Contributor that are necessarily infringed by their
80
+ Contribution(s) alone or by combination of their Contribution(s)
81
+ with the Work to which such Contribution(s) was submitted. If You
82
+ institute patent litigation against any entity (including a
83
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
84
+ or a Contribution incorporated within the Work constitutes direct
85
+ or contributory patent infringement, then any patent licenses
86
+ granted to You under this License for that Work shall terminate
87
+ as of the date such litigation is filed.
88
+
89
+ 4. Redistribution. You may reproduce and distribute copies of the
90
+ Work or Derivative Works thereof in any medium, with or without
91
+ modifications, and in Source or Object form, provided that You
92
+ meet the following conditions:
93
+
94
+ (a) You must give any other recipients of the Work or
95
+ Derivative Works a copy of this License; and
96
+
97
+ (b) You must cause any modified files to carry prominent notices
98
+ stating that You changed the files; and
99
+
100
+ (c) You must retain, in the Source form of any Derivative Works
101
+ that You distribute, all copyright, patent, trademark, and
102
+ attribution notices from the Source form of the Work,
103
+ excluding those notices that do not pertain to any part of
104
+ the Derivative Works; and
105
+
106
+ (d) If the Work includes a "NOTICE" text file as part of its
107
+ distribution, then any Derivative Works that You distribute must
108
+ include a readable copy of the attribution notices contained
109
+ within such NOTICE file, excluding those notices that do not
110
+ pertain to any part of the Derivative Works, in at least one
111
+ of the following places: within a NOTICE text file distributed
112
+ as part of the Derivative Works; within the Source form or
113
+ documentation, if provided along with the Derivative Works; or,
114
+ within a display generated by the Derivative Works, if and
115
+ wherever such third-party notices normally appear. The contents
116
+ of the NOTICE file are for informational purposes only and
117
+ do not modify the License. You may add Your own attribution
118
+ notices within Derivative Works that You distribute, alongside
119
+ or as an addendum to the NOTICE text from the Work, provided
120
+ that such additional attribution notices cannot be construed
121
+ as modifying the License.
122
+
123
+ You may add Your own copyright statement to Your modifications and
124
+ may provide additional or different license terms and conditions
125
+ for use, reproduction, or distribution of Your modifications, or
126
+ for any such Derivative Works as a whole, provided Your use,
127
+ reproduction, and distribution of the Work otherwise complies with
128
+ the conditions stated in this License.
129
+
130
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
131
+ any Contribution intentionally submitted for inclusion in the Work
132
+ by You to the Licensor shall be under the terms and conditions of
133
+ this License, without any additional terms or conditions.
134
+ Notwithstanding the above, nothing herein shall supersede or modify
135
+ the terms of any separate license agreement you may have executed
136
+ with Licensor regarding such Contributions.
137
+
138
+ 6. Trademarks. This License does not grant permission to use the trade
139
+ names, trademarks, service marks, or product names of the Licensor,
140
+ except as required for reasonable and customary use in describing the
141
+ origin of the Work and reproducing the content of the NOTICE file.
142
+
143
+ 7. Disclaimer of Warranty. Unless required by applicable law or
144
+ agreed to in writing, Licensor provides the Work (and each
145
+ Contributor provides its Contributions) on an "AS IS" BASIS,
146
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
147
+ implied, including, without limitation, any warranties or conditions
148
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
149
+ PARTICULAR PURPOSE. You are solely responsible for determining the
150
+ appropriateness of using or redistributing the Work and assume any
151
+ risks associated with Your exercise of permissions under this License.
152
+
153
+ 8. Limitation of Liability. In no event and under no legal theory,
154
+ whether in tort (including negligence), contract, or otherwise,
155
+ unless required by applicable law (such as deliberate and grossly
156
+ negligent acts) or agreed to in writing, shall any Contributor be
157
+ liable to You for damages, including any direct, indirect, special,
158
+ incidental, or consequential damages of any character arising as a
159
+ result of this License or out of the use or inability to use the
160
+ Work (including but not limited to damages for loss of goodwill,
161
+ work stoppage, computer failure or malfunction, or any and all
162
+ other commercial damages or losses), even if such Contributor
163
+ has been advised of the possibility of such damages.
164
+
165
+ 9. Accepting Warranty or Additional Liability. While redistributing
166
+ the Work or Derivative Works thereof, You may choose to offer,
167
+ and charge a fee for, acceptance of support, warranty, indemnity,
168
+ or other liability obligations and/or rights consistent with this
169
+ License. However, in accepting such obligations, You may act only
170
+ on Your own behalf and on Your sole responsibility, not on behalf
171
+ of any other Contributor, and only if You agree to indemnify,
172
+ defend, and hold each Contributor harmless for any liability
173
+ incurred by, or claims asserted against, such Contributor by reason
174
+ of your accepting any such warranty or additional liability.
175
+
176
+ END OF TERMS AND CONDITIONS
177
+
178
+ APPENDIX: How to apply the Apache License to your work.
179
+
180
+ To apply the Apache License to your work, attach the following
181
+ boilerplate notice, with the fields enclosed by brackets "[]"
182
+ replaced with your own identifying information. (Don't include
183
+ the brackets!) The text should be enclosed in the appropriate
184
+ comment syntax for the file format. We also recommend that a
185
+ file or class name and description of purpose be included on the
186
+ same "printed page" as the copyright notice for easier
187
+ identification within third-party archives.
188
+
189
+ Copyright [yyyy] [name of copyright owner]
190
+
191
+ Licensed under the Apache License, Version 2.0 (the "License");
192
+ you may not use this file except in compliance with the License.
193
+ You may obtain a copy of the License at
194
+
195
+ http://www.apache.org/licenses/LICENSE-2.0
196
+
197
+ Unless required by applicable law or agreed to in writing, software
198
+ distributed under the License is distributed on an "AS IS" BASIS,
199
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
200
+ See the License for the specific language governing permissions and
201
+ limitations under the License.
@@ -0,0 +1,37 @@
1
+ Metadata-Version: 2.1
2
+ Name: goosebit
3
+ Version: 0.1.0
4
+ Summary:
5
+ Author: Upstream Data
6
+ Author-email: brett@upstreamdata.ca
7
+ Requires-Python: >=3.12,<4.0
8
+ Classifier: Programming Language :: Python :: 3
9
+ Classifier: Programming Language :: Python :: 3.12
10
+ Requires-Dist: aerich (>=0.7.2,<0.8.0)
11
+ Requires-Dist: aiofiles (>=24.1.0,<25.0.0)
12
+ Requires-Dist: fastapi[uvicorn] (>=0.111.0,<0.112.0)
13
+ Requires-Dist: itsdangerous (>=2.2.0,<3.0.0)
14
+ Requires-Dist: jinja2 (>=3.1.4,<4.0.0)
15
+ Requires-Dist: passlib[bcrypt] (>=1.7.4,<2.0.0)
16
+ Requires-Dist: python-jose (>=3.3.0,<4.0.0)
17
+ Requires-Dist: python-multipart (>=0.0.9,<0.0.10)
18
+ Requires-Dist: tortoise-orm (>=0.21.4,<0.22.0)
19
+ Requires-Dist: websockets (>=12.0,<13.0)
20
+ Description-Content-Type: text/markdown
21
+
22
+ # goosebit
23
+ <img src="docs/img/goosebit-logo.png?raw=true" style="width: 100px; height: 100px; display: block;">
24
+
25
+ ---
26
+
27
+ A simplistic remote update server.
28
+
29
+
30
+ ## Setup
31
+
32
+ To set up, install the dependencies in `pyproject.toml` with `poetry install`. Then you can run GooseBit by running `main.py`.
33
+
34
+ ## Initial Startup
35
+
36
+ The first time you start GooseBit, you should change the default username and password inside `goosebit/settings.py`, as well as generate a new secret key.
37
+ The default login credentials for testing are `admin@goosebit.local`, `admin`.
@@ -0,0 +1,48 @@
1
+ goosebit/__init__.py,sha256=hfY3hKnwkJewwVT_DDFm_FjsvSUMsVDsBECL2g1gMOQ,1837
2
+ goosebit/api/__init__.py,sha256=Pn8KJu4sVaJKSSley4e1K5D_I3PrDd8ZLpWXchouH_o,27
3
+ goosebit/api/devices.py,sha256=PwjYuG3omM59EDQNGwyPik4wuZ_NOwfRoLBSFHoTMBM,3219
4
+ goosebit/api/download.py,sha256=I9aL3ZkT2T5hfyTsuwwR5vFF5XjqnjHV0WjK0p-oToQ,607
5
+ goosebit/api/firmware.py,sha256=0bvQuDX4ReiT6Xp4OA6pYQQ7u62DkOFoAnK7soZY2OQ,1778
6
+ goosebit/api/routes.py,sha256=JLXWOwvOyLGcHX2nDl9ZVJSan5wdfDueYn0XGLPQ0NA,365
7
+ goosebit/auth/__init__.py,sha256=47vSo8srLG_8P1gdb0mmnrxfqsvohIwdzrQbcliEo5g,3638
8
+ goosebit/db.py,sha256=lIQR3s290qZX54NL1J-85Ge6l98xbV9_oRaCO48vdTY,787
9
+ goosebit/models.py,sha256=7DMMZ29XnNnMjkfOiZ_lgLNf_3j_az4PlrfxfB2PTlw,765
10
+ goosebit/permissions.py,sha256=Yg90HiQLfInSiP-_tUeirXrTc4CpuNSrIsBp3QYCTYI,1166
11
+ goosebit/realtime/__init__.py,sha256=Pn8KJu4sVaJKSSley4e1K5D_I3PrDd8ZLpWXchouH_o,27
12
+ goosebit/realtime/logs.py,sha256=hopd4zpEmTU4_De_tJwItoyyNjk1JiN5onyM8_q07S0,1207
13
+ goosebit/realtime/routes.py,sha256=DzL1xBsdSc4SF2FiOAeuVKmcAq3m4DYo6KqD_pCNMww,269
14
+ goosebit/settings.py,sha256=4bryUrICSDB_GDb0mNv7ix5vGH8qmZCo5KDYHqgqZuA,1163
15
+ goosebit/ui/__init__.py,sha256=Pn8KJu4sVaJKSSley4e1K5D_I3PrDd8ZLpWXchouH_o,27
16
+ goosebit/ui/routes.py,sha256=Iy7B1v5_Ao_KKEe_hI10C7hiQOOIiJJxAgcnW3_CW9U,2791
17
+ goosebit/ui/static/__init__.py,sha256=AsZiM3h9chQ_YaBbAD6TVFf0244Q9DetkDMl70q8swQ,135
18
+ goosebit/ui/static/favicon.ico,sha256=FLzKyAkMvQcMg58nzCJxQOfPFxT4yYbP7S82pdY6zng,4286
19
+ goosebit/ui/static/favicon.svg,sha256=2iEZocLSave4QTjaR3GxGVT1zaDNl6T_GtN61YHsvJU,6595
20
+ goosebit/ui/static/js/devices.js,sha256=IpDhT_9nm9lELVkBriKsIpEReajGfZ7bhsHfpvRaZtE,12550
21
+ goosebit/ui/static/js/firmware.js,sha256=S-a8dG6JB_Qvxw0mhG0ksYuPPzk4gLs6AIR_a7suVqk,3919
22
+ goosebit/ui/static/js/index.js,sha256=9Mlf679A_P2FcGx7cYfLPi3FVWJ6Yl2_vUPUpP4bEGg,5744
23
+ goosebit/ui/static/js/logs.js,sha256=ajaOBtW__CToZLOo17bxNIaY6WkPyy_TDQD0Emwh0DI,611
24
+ goosebit/ui/static/svg/goosebit-logo.svg,sha256=2iEZocLSave4QTjaR3GxGVT1zaDNl6T_GtN61YHsvJU,6595
25
+ goosebit/ui/templates/__init__.py,sha256=M-F9UIAOVyRdsVIjU-19cCiXh48-LZBAKvl8R4CLlkM,140
26
+ goosebit/ui/templates/devices.html,sha256=RQGeBnYZxTI382DuEbUyIRDyd3ZCkxo0vie4hOM905k,3025
27
+ goosebit/ui/templates/firmware.html,sha256=JW6h0LxLHcvq4KIgEMXk7qyxWE0bTTbbbpjlOK_vQgE,2059
28
+ goosebit/ui/templates/index.html,sha256=hzqo3o1rAqIXw-mTDxc4ah2M35oY3BJibnYNzlSEhiw,1096
29
+ goosebit/ui/templates/login.html,sha256=Ip_-p3DbRyCkIjAfEBO2MyzEynQk1m9eKVGpuPLEF3c,1862
30
+ goosebit/ui/templates/logs.html,sha256=ysdE8luiO8NNpeqtW2XCZKU7_4Muo13OGh9AzlmJtDg,633
31
+ goosebit/ui/templates/nav.html,sha256=0ZWCkg4hJNFM64h_khcg-xs-8VixnYo35LbNi1aiF-I,3529
32
+ goosebit/updater/__init__.py,sha256=Pn8KJu4sVaJKSSley4e1K5D_I3PrDd8ZLpWXchouH_o,27
33
+ goosebit/updater/controller/__init__.py,sha256=Pn8KJu4sVaJKSSley4e1K5D_I3PrDd8ZLpWXchouH_o,27
34
+ goosebit/updater/controller/routes.py,sha256=8CnLb-kDuO-yFeWdu4apIyctCf9OzvJ011Az3QDGemU,123
35
+ goosebit/updater/controller/v1/__init__.py,sha256=Pn8KJu4sVaJKSSley4e1K5D_I3PrDd8ZLpWXchouH_o,27
36
+ goosebit/updater/controller/v1/routes.py,sha256=-5sjiIRz5_rGppV9tL13ftGKDPYqNhXhzuiY7htXiLo,2290
37
+ goosebit/updater/download/__init__.py,sha256=Pn8KJu4sVaJKSSley4e1K5D_I3PrDd8ZLpWXchouH_o,27
38
+ goosebit/updater/download/routes.py,sha256=HNvpdlZvEeVfpY-JLhvUKHDd9eGKCAOFjh1EN98J9T0,121
39
+ goosebit/updater/download/v1/__init__.py,sha256=Pn8KJu4sVaJKSSley4e1K5D_I3PrDd8ZLpWXchouH_o,27
40
+ goosebit/updater/download/v1/routes.py,sha256=cwzdseHhOzfuze6r8_YuOC-YuPyu9QDvhSs1UZE5dho,840
41
+ goosebit/updater/manager.py,sha256=179DJtW0hy5ztv-uM8jhTuavgVTm4JwgMjucSHTpfUU,5896
42
+ goosebit/updater/misc.py,sha256=NIYdquYoH6ibGDxnIFVLzTKbb7wwc3eOIxhHXwLR4Ew,2000
43
+ goosebit/updater/routes.py,sha256=pziZ15nTUV6zCkvlrdi7r5Az9U2INq3C6X_cj0yYHDw,788
44
+ goosebit/updater/updates.py,sha256=OhSeRsXQgzUPffR_SJ_UGepOqScVZREoxNWx6PrxhbA,2837
45
+ goosebit-0.1.0.dist-info/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
46
+ goosebit-0.1.0.dist-info/METADATA,sha256=zta3l3gBIW3roHD4lS-ow0ypntg_lz31u9AVSVbUrEs,1287
47
+ goosebit-0.1.0.dist-info/WHEEL,sha256=sP946D7jFCHeNz5Iq4fL4Lu-PrWrFsgfLXbbkciIZwg,88
48
+ goosebit-0.1.0.dist-info/RECORD,,