Compare commits

..

18 Commits

Author SHA1 Message Date
Thomas Rupprecht 2575d48e9e 0.9.2 2023-05-24 22:05:39 +02:00
Thomas Rupprecht 2e79e02805 fix(git-cliff): fix markdown escaping in changelog 2023-05-24 21:45:33 +02:00
Thomas Rupprecht df67e402a7 doc(changelog): update changelog with new version 2023-05-24 21:43:27 +02:00
Thomas Rupprecht d2d9aa70ca refactor(popup): remove "browser_style" setting and include cleaned up extension.css 2023-05-24 20:10:35 +02:00
Thomas Rupprecht 7a707c9fb0 refactor(background): remove background.html and import directly as ES module 2023-05-24 19:42:58 +02:00
Thomas Rupprecht 0d88ee76e2 TODO: improve git-cliff config 2023-05-24 19:21:49 +02:00
Thomas Rupprecht 4bb9a19f7a chore(package): update git-cliff 2023-05-15 20:59:20 +02:00
Thomas Rupprecht 8f2f8051a5 chore(package): update web-ext 2023-04-26 00:14:38 +02:00
Thomas Rupprecht 21ef55bb0e chore(package): update @types/firefox-webext-browser and web-ext 2023-04-12 20:43:08 +02:00
Thomas Rupprecht c396c74d4a chore(package): update @types/firefox-webext-browser and add web-ext to devDependencies 2023-03-20 17:00:46 +01:00
Thomas Rupprecht ca37e153e1 chore(js): add .ts files editorconfig and fix styling 2023-02-04 18:20:45 +01:00
Thomas Rupprecht a193a6923c fix(js): replace deprecated substr() with substring() and add checks for promise results 2023-02-04 18:07:52 +01:00
Thomas Rupprecht 848e1abee4 docs(js): add type definitions for Calendar and SpaceApi 2023-02-04 18:03:49 +01:00
Thomas Rupprecht 701ec4b226 chore: unify and improve codestyle 2023-02-04 17:21:18 +01:00
Thomas Rupprecht 25708ea410 chore(ci): improve CHANGELOG config 2023-02-04 03:57:09 +01:00
Thomas Rupprecht 9541d3ee4b chore(package): update husky 2023-02-04 03:29:47 +01:00
Thomas Rupprecht 4e17127714 feat(ci): add git-cliff to update the CHANGELOG.md 2023-02-04 02:50:44 +01:00
Thomas Rupprecht bae19bff3c add pre-commit hook with husky 2023-02-03 22:51:21 +01:00
17 changed files with 7097 additions and 144 deletions

View File

@ -3,7 +3,7 @@
# top-most EditorConfig file
root = true
[*.{html,css,js,json,svg}]
[*.{html,css,js,json,svg,ts,toml}]
indent_style = tab
indent_size = 2
end_of_line = lf

5
.husky/pre-commit Executable file
View File

@ -0,0 +1,5 @@
#!/usr/bin/env sh
. "$(dirname -- "$0")/_/husky.sh"
npm run lint
npm test

215
CHANGELOG.md Normal file
View File

@ -0,0 +1,215 @@
# Changelog
All notable changes to this project will be documented in this file.
## \[unreleased]
### ⛰️ Features
- Add git-cliff to update the CHANGELOG.md
### 🐛 Bug Fixes
- Replace deprecated substr() with substring() and add checks for promise results
- Fix markdown escaping in changelog
### 🚜 Refactor
- Remove background.html and import directly as ES module
- Remove "browser_style" setting and include cleaned up extension.css
### 📚 Documentation
- Add type definitions for Calendar and SpaceApi
- Update changelog with new version
### ⚙️ Miscellaneous Tasks
- Update husky
- Improve CHANGELOG config
- Unify and improve codestyle
- Add .ts files editorconfig and fix styling
- Update @types/firefox-webext-browser and add web-ext to devDependencies
- Update @types/firefox-webext-browser and web-ext
- Update web-ext
- Update git-cliff
### ✳️ Other
- Add pre-commit hook with husky
- Improve git-cliff config
## \[[0.9.1](https://gitea.usrspace.at/XimeX/usrspace-browser-addon/releases/tag/v0.9.1)] - 2023-01-22
### ✳️ Other
- Extract code into setBadgeStatus and createStatusChangedNotification function
- Don't fetch data if offline
- Replace web-ext types package
- Await init
- Add link to Pad
## \[[0.9.0](https://gitea.usrspace.at/XimeX/usrspace-browser-addon/releases/tag/v0.9.0)] - 2023-01-20
### ✳️ Other
- Manifest_v3
- Update to manifest_version v3
- Make code compatible with manifest_version v3
## \[[0.8.7](https://gitea.usrspace.at/XimeX/usrspace-browser-addon/releases/tag/v0.8.7)] - 2023-01-20
### ✳️ Other
- Add badges to README
- Improve README
- Improve badges
- Improve config
- Use globalThis instead of window to also work in service worker
- Remove unnecessary permissions
- Remove persistent flag in manifest config
- Open usrspace.at homepage on install
## \[[0.8.6](https://gitea.usrspace.at/XimeX/usrspace-browser-addon/releases/tag/v0.8.6)] - 2023-01-05
### ✳️ Other
- Change addon id to currently used one
## \[[0.8.5](https://gitea.usrspace.at/XimeX/usrspace-browser-addon/releases/tag/v0.8.5)] - 2023-01-05
### ✳️ Other
- Add web-ext-config.js and add watch scripts
- Improve README
- Add development docs
- Inject browser-polyfill only in chromium builds
- Add addon id
## \[[0.8.4](https://gitea.usrspace.at/XimeX/usrspace-browser-addon/releases/tag/v0.8.4)] - 2023-01-05
### ✳️ Other
- Use html template tag
- Change strict_min_version to v79
- Simplify updateSpaceApiJson
- Add lint script
## \[[0.8.3](https://gitea.usrspace.at/XimeX/usrspace-browser-addon/releases/tag/v0.8.3)] - 2023-01-04
### ✳️ Other
- Update strict_min_version to 57.0
## \[[0.8.2](https://gitea.usrspace.at/XimeX/usrspace-browser-addon/releases/tag/v0.8.2)] - 2023-01-04
### ✳️ Other
- Explicit set persistent=true and add browser_specific_settings in manifest.json
- Set html lang by browser language
- Improve popup styling
## \[[0.8.1](https://gitea.usrspace.at/XimeX/usrspace-browser-addon/releases/tag/v0.8.1)] - 2022-12-25
### 🐛 Bug Fixes
- Fix copy-version script
### ✳️ Other
- Manifest l10n
- Faster data fetching, badge improvements
- Cursor pointer on clickable elements
- Move manifest and _locales into src
- Update package-lock
- Store data in localStorage
- Use storage api
- Use browser.alarms api
- Unfiy codestyle
- Cleanup data on startup
## \[[0.8.0](https://gitea.usrspace.at/XimeX/usrspace-browser-addon/releases/tag/v0.8.0)] - 2022-12-24
### ✳️ Other
- Improve code, doc, tooling
- Npm version scripts
- Copy browser-polyfill
- Import config as module
- Move code into src dir
- Add JsDoc and small code improvements
- Add build script
- Improve code
- Remove old icons
- Add l10n
- Cleanup manifest.json
- Increase svg size
- Set build filename
## \[[0.7](https://gitea.usrspace.at/XimeX/usrspace-browser-addon/releases/tag/v0.7)] - 2021-11-06
### 🐛 Bug Fixes
- Fix new urls
- Fix dates if no date is found
- Fix data, remove logging, improve code
### ✳️ Other
- Change spaceApiUrl and nextcloud label
- Add release info
- Add editorconfig
- Reformat code
- Add package.json for typescript type definitions
- Use template strings
- Format datetime
- Change to normal function and use async/await
- Use css variables and prepare for dark mode support
- Add Nunito font
- Change icons, enable darkmode, improve styling
- Update license
- Change icon
- Remove old html code and load right svg
## \[[0.4](https://gitea.usrspace.at/XimeX/usrspace-browser-addon/releases/tag/v0.4)] - 2019-10-04
### 🐛 Bug Fixes
- Fix wrong icon
## \[[0.3](https://gitea.usrspace.at/XimeX/usrspace-browser-addon/releases/tag/v0.3)] - 2019-10-04
### ✳️ Other
- Improve popup content
## \[[0.2](https://gitea.usrspace.at/XimeX/usrspace-browser-addon/releases/tag/v0.2)] - 2019-08-28
### 🐛 Bug Fixes
- Fix icon style
- Fix compatibility with chromium based browsers
- Fix typo
### ✳️ Other
- Init
- Add first readme
- Add LICENSE and improve README
- Add icons and improve styling
- Improve styling
- Use config
- Offen/Geschlossen-Info schön im Pop-Up
- Add space status change notification
- Small fix
- Make text over icon more readable
- Switch from GitLab to Gitea
- Missing change from Gitlab to Gitea
- Update browser-polyfill
- Add sections
- Add time element for event date
- Improve badge color
- Combine updateBadge promises
- Check for online/offline events if fetching should be enabled
<!-- generated by git-cliff -->

View File

@ -6,6 +6,7 @@
[![Mozilla Add-on](https://img.shields.io/amo/stars/usr-space?style=for-the-badge)](https://addons.mozilla.org/de/firefox/addon/usr-space/)
## Features
- Show if someone is in the Space
- Looks for connected dynamic IPs (DHCP) (provided by backend)
- Refreshes every 5min
@ -13,13 +14,16 @@
- Quick-Links (Homepage, Wiki, Gitea, Nextcloud)
## Install
```ssh
$ git clone https://gitea.usrspace.at/XimeX/usrspace-browser-addon.git
# optional
$ npm i -g web-ext
$ npm i
```
## Run / Develop / Debug
```ssh
$ npm run watch:{firefox|firefox-android|chromium}
```
@ -27,6 +31,7 @@ $ npm run watch:{firefox|firefox-android|chromium}
If more options are needed add them after a `--`.
Some useful options:
- `--devtools`
- `--firefox-apk=...`
- `--android-device=...`
@ -34,6 +39,7 @@ Some useful options:
Example: `npm run watch:firefox-android -- --firefox-apk=org.mozilla.fenix --firefox-device=XXXXXXXX`
## Build
```ssh
// For Firefox
$ npm run build:firefox
@ -42,18 +48,22 @@ $ npm run build:chromium
```
## Release
```ssh
$ npm version {major|minor|patch|...}
```
## Developent Docs
- [Getting started](https://extensionworkshop.com/documentation/develop/getting-started-with-web-ext/)
- [web-ext command reference](https://extensionworkshop.com/documentation/develop/web-ext-command-reference/)
- [WebExtensions MDN Docu](https://developer.mozilla.org/en-US/docs/Mozilla/Add-ons/WebExtensions)
## Credits
Used icons from Bootstrap
https://github.com/twbs/icons/blob/main/LICENSE.md
## License
MIT

77
cliff.toml Normal file
View File

@ -0,0 +1,77 @@
# git-cliff ~ configuration file
# https://git-cliff.org/docs/configuration
#
# Lines starting with "#" are comments.
# Configuration options are organized into tables and keys.
# See documentation for more information on available options.
[changelog]
# changelog header
header = """
# Changelog\n
All notable changes to this project will be documented in this file.\n
"""
# template for the changelog body
# https://tera.netlify.app/docs/
body = """
{% if version %}\
## \\[[{{ version | trim_start_matches(pat="v") }}](https://gitea.usrspace.at/XimeX/usrspace-browser-addon/releases/tag/{{ version }})] - {{ timestamp | date(format="%Y-%m-%d") }}
{% else %}\
## \\[unreleased]
{% endif %}\
{% for group, commits in commits | group_by(attribute="group") %}
### {{ group | striptags | trim | upper_first }}\n
{% for commit in commits %}\
- {% if commit.breaking %}[**breaking**] {% endif %}{{ commit.message | upper_first | trim_end }}
{% endfor %}\
{% endfor %}\n
"""
# remove the leading and trailing whitespace from the template
trim = true
# changelog footer
footer = """
<!-- generated by git-cliff -->
"""
[git]
# parse the commits based on https://www.conventionalcommits.org
conventional_commits = true
# filter out the commits that are not conventional
filter_unconventional = false
# process each line of a commit as an individual commit
split_commits = false
# regex for preprocessing the commit messages
commit_preprocessors = [
# { pattern = '\((\w+\s)?#([0-9]+)\)', replace = "([#${2}](https://gitea.usrspace.at/XimeX/usrspace-browser-addon/issues/${2}))" },
]
# regex for parsing and grouping commits
commit_parsers = [
{ message = "^feat", group = "<!-- 0 -->⛰️ Features" },
{ message = "^fix", group = "<!-- 1 -->🐛 Bug Fixes" },
{ message = "^doc", group = "<!-- 3 -->📚 Documentation" },
{ message = "^perf", group = "<!-- 4 -->⚡ Performance" },
{ message = "^refactor", group = "<!-- 2 -->🚜 Refactor" },
{ message = "^style", group = "<!-- 5 -->🎨 Styling" },
{ message = "^test", group = "<!-- 6 -->🧪 Testing" },
{ message = "^chore\\(release\\): prepare for", skip = true },
{ message = "^chore", group = "<!-- 7 -->⚙️ Miscellaneous Tasks" },
{ body = ".*security", group = "<!-- 8 -->🛡️ Security" },
{ message = "^[0-9]+.[0-9]+.[0-9]+", skip = true },
{ message = "^release v0.[0-9]", skip = true },
{ message = "^Merge branch ", skip = true },
{ message = ".*", group = "<!-- 9 -->✳️ Other", default_scope = "uncategorized" },
]
# protect breaking changes from being skipped due to matching a skipping commit_parser
protect_breaking_commits = false
# filter out the commits that are not matched by commit parsers
filter_commits = false
# glob pattern for matching git tags
tag_pattern = "v[0-9]*"
# regex for skipping tags
skip_tags = ""
# regex for ignoring tags
ignore_tags = ""
# sort the tags topologically
topo_order = false
# sort the commits inside sections by oldest/newest order
sort_commits = "oldest"

5652
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@ -1,18 +1,22 @@
{
"name": "usrspace-browser-addon",
"description": "WebExtension for the Hacker-/Maker-Space /usr/space",
"version": "0.9.1",
"version": "0.9.2",
"dependencies": {
"webextension-polyfill": "^0.10.0"
},
"devDependencies": {
"@types/firefox-webext-browser": "^109.0.0"
"@types/firefox-webext-browser": "^111.0.1",
"git-cliff": "^1.2.0",
"husky": "^8.0.3",
"web-ext": "^7.6.2"
},
"scripts": {
"copy-browser-polyfill": "cp node_modules/webextension-polyfill/dist/browser-polyfill.js src/browser-polyfill.js",
"inject-browser-polyfill": "sed -i -r 's/(<!-- \\[INJECT-BROWSER-POLYFILL] -->).*/\\1<script type=\"module\" src=\"browser-polyfill.js\"><\\/script>/' src/*.html",
"uninject-browser-polyfill": "sed -i -r 's/(<!-- \\[INJECT-BROWSER-POLYFILL] -->).+/\\1/' src/*.html",
"copy-version": "sed -i 's/^\t\"version\": \".*\",$/\t\"version\": \"'$(rg '^\t\"version\": \"(.+)\",$' -r '$1' < package.json)'\",/' src/manifest.json",
"update-changelog": "npm exec git-cliff > CHANGELOG.md",
"lint": "web-ext lint -w",
"test": "echo \"Error: no test specified\" && exit 0",
"watch:firefox": "web-ext run -t firefox-desktop",
@ -27,9 +31,10 @@
"postbuild:firefox": "npm run postbuild",
"postbuild:chromium": "npm run postbuild && npm run uninject-browser-polyfill",
"postinstall": "npm run copy-browser-polyfill",
"preversion": "npm run lint && npm test",
"version": "npm run copy-version && git add -u",
"postversion": "npm run build:firefox"
"preversion": "npm run lint && npm test && npm run update-changelog",
"version": "npm run copy-version && npm run update-changelog && git add -u",
"postversion": "npm run build:firefox",
"prepare": "husky install"
},
"repository": {
"type": "git",

View File

@ -41,8 +41,8 @@
"stateNotificationMessage": {
"message": "Space ist jetzt $STATE$.",
"placeholders": {
"STATE" : {
"content" : "$1"
"STATE": {
"content": "$1"
}
}
},

View File

@ -41,8 +41,8 @@
"stateNotificationMessage": {
"message": "Space is now $STATE$.",
"placeholders": {
"STATE" : {
"content" : "$1"
"STATE": {
"content": "$1"
}
}
},

View File

@ -1,10 +0,0 @@
<!DOCTYPE html>
<html lang="de">
<head>
<meta charset="utf-8" />
<title>/usr/space</title>
<!-- [INJECT-BROWSER-POLYFILL] -->
<script type="module" src="background.js"></script>
</head>
</html>

View File

@ -1,6 +1,5 @@
import { REFRESH_TIMEOUT, API_URLS, BADGE_COLORS } from './config.js';
document.querySelector('html').setAttribute('lang', browser.i18n.getUILanguage());
// [INJECT-BROWSER-POLYFILL]
browser.runtime.onInstalled.addListener(async (details) => {
if (details.reason === 'install') {
@ -31,7 +30,7 @@ async function fetchJson(url) {
/**
* @param {number} days
* @returns {Promise<Array<object>>}
* @returns {Promise<import("../types").Calendar>}
*/
function fetchCalendar(days = 28) {
let url = `${API_URLS.calender}?o=json`;
@ -42,7 +41,7 @@ function fetchCalendar(days = 28) {
}
/**
* @returns {Promise<object>}
* @returns {Promise<import("../types").SpaceApi>}
*/
function fetchSpaceApi() {
return fetchJson(API_URLS.spaceApi);
@ -53,9 +52,10 @@ async function fetchNewData() {
return;
}
try {
const result = await Promise.allSettled([fetchCalendar(), fetchSpaceApi()]);
const calendarJson = result[0].value;
const spaceApiJson = result[1].value;
const [resultCalendar, resultSpaceApi] = await Promise.allSettled([fetchCalendar(), fetchSpaceApi()]);
const calendarJson = (resultCalendar.status === 'fulfilled') ? resultCalendar.value : undefined;
const spaceApiJson = (resultSpaceApi.status === 'fulfilled') ? resultSpaceApi.value : undefined;
if (spaceApiJson) {
const now = new Date();
@ -65,7 +65,10 @@ async function fetchNewData() {
await setBadgeStatus(spaceApiJson.state.open, eventActive);
const {spaceApi} = await browser.storage.local.get('spaceApi');
/**
* @type {import("../types").Storage}
*/
const { spaceApi } = await browser.storage.local.get('spaceApi');
if (spaceApi && spaceApi.state.open !== spaceApiJson.state.open) {
await createStatusChangedNotification(spaceApiJson.state.open);
}
@ -87,8 +90,8 @@ async function fetchNewData() {
async function setBadgeStatus(open, eventActive) {
const badgeText = browser.i18n.getMessage(open ? 'badgeOpen' : eventActive ? 'badgeEvent' : 'badgeClosed');
const badgeBgColor = open ? BADGE_COLORS.open : eventActive ? BADGE_COLORS.event : BADGE_COLORS.closed;
await browser.action.setBadgeText({text: badgeText});
await browser.action.setBadgeBackgroundColor({color: badgeBgColor});
await browser.action.setBadgeText({ text: badgeText });
await browser.action.setBadgeBackgroundColor({ color: badgeBgColor });
}
/**

63
src/extension.css Normal file
View File

@ -0,0 +1,63 @@
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
/* Global */
html,
body {
background: transparent;
box-sizing: border-box;
color: #222426;
cursor: default;
display: flex;
flex-direction: column;
font: caption;
margin: 0;
padding: 0;
user-select: none;
}
body * {
box-sizing: border-box;
text-align: start;
}
/* Panel Section - List */
.panel-section-list {
display: flex;
flex-direction: column;
padding: 4px 0;
}
.panel-list-item {
align-items: center;
display: flex;
flex-direction: row;
height: 24px;
padding: 0 16px;
}
.panel-list-item:hover {
background-color: rgba(0, 0, 0, 0.06);
border-block: 1px solid rgba(0, 0, 0, 0.1);
}
.panel-list-item:hover:active {
background-color: rgba(0, 0, 0, 0.1);
}
.panel-list-item > .icon {
flex-grow: 0;
flex-shrink: 0;
}
.panel-list-item > .text {
flex-grow: 10;
}
.panel-list-item > .text-shortcut {
color: #808080;
font-family: "Lucida Grande", caption;
font-size: .847em;
justify-content: flex-end;
}

View File

@ -2,16 +2,16 @@
"manifest_version": 3,
"name": "__MSG_extensionName__",
"description": "__MSG_extensionDescription__",
"version": "0.9.1",
"version": "0.9.2",
"icons": {
"48": "icons/favicon.svg",
"96": "icons/favicon.svg"
},
"background": {
"page": "background.html"
"type": "module",
"scripts": ["background.js"]
},
"action": {
"browser_style": true,
"default_title": "__MSG_buttonTitle__",
"default_icon": "icons/favicon.svg",
"default_area": "navbar",
@ -32,7 +32,7 @@
"browser_specific_settings": {
"gecko": {
"id": "{c9a907ad-a047-4cf6-8b5d-95097d31aa5b}",
"strict_min_version": "109.0"
"strict_min_version": "112.0"
}
}
}

View File

@ -18,13 +18,13 @@
}
:root {
--light-blue: #2AA1BF;
--dark-blue: #095C81;
--light-color: #0C0C0C;
--dark-color: #FFFFFF;
--light-background: #F9F9F9;
--dark-background: #4A4A4A;
--light-code-background: #EBEBEB;
--light-blue: #2aa1bf;
--dark-blue: #095c81;
--light-color: #0c0c0c;
--dark-color: #ffffff;
--light-background: #f9f9f9;
--dark-background: #4a4a4a;
--light-code-background: #ebebeb;
--dark-code-background: #383838;
}
@ -75,7 +75,9 @@ svg {
cursor: pointer;
}
#state > svg, #calendar > .calendar-entry > svg, #calendar > .calendar-entry strong {
#state > svg,
#calendar > .calendar-entry > svg,
#calendar > .calendar-entry strong {
margin-right: 8px;
}
#calendar > .calendar-entry {

View File

@ -1,99 +1,100 @@
<!DOCTYPE html>
<html lang="de">
<head>
<meta charset="utf-8" />
<title>/usr/space</title>
<link rel="stylesheet" href="popup.css" />
<head>
<meta charset="utf-8" />
<title>/usr/space</title>
<link rel="stylesheet" href="extension.css" />
<link rel="stylesheet" href="popup.css" />
<template id="template-icon-closed">
<svg xmlns="http://www.w3.org/2000/svg" width="19" height="19" fill="currentColor" viewBox="0 0 16 16" role="img" aria-label="">
<path d="M3 2a1 1 0 0 1 1-1h8a1 1 0 0 1 1 1v13h1.5a.5.5 0 0 1 0 1h-13a.5.5 0 0 1 0-1H3V2zm1 13h8V2H4v13z"/>
<path d="M9 9a1 1 0 1 0 2 0 1 1 0 0 0-2 0z"/>
</svg>
</template>
<template id="template-icon-open">
<svg xmlns="http://www.w3.org/2000/svg" width="19" height="19" fill="currentColor" viewBox="0 0 16 16" role="img" aria-label="">
<path d="M8.5 10c-.276 0-.5-.448-.5-1s.224-1 .5-1 .5.448.5 1-.224 1-.5 1z"/>
<path d="M10.828.122A.5.5 0 0 1 11 .5V1h.5A1.5 1.5 0 0 1 13 2.5V15h1.5a.5.5 0 0 1 0 1h-13a.5.5 0 0 1 0-1H3V1.5a.5.5 0 0 1 .43-.495l7-1a.5.5 0 0 1 .398.117zM11.5 2H11v13h1V2.5a.5.5 0 0 0-.5-.5zM4 1.934V15h6V1.077l-6 .857z"/>
</svg>
</template>
<template id="template-state">
<svg></svg>
<span></span>
<time datetime=""></time>
</template>
<template id="template-icon-homepage">
<svg xmlns="http://www.w3.org/2000/svg" width="19" height="19" fill="currentColor" viewBox="0 0 16 16" role="img" aria-label="">
<path fill-rule="evenodd" d="m8 3.293 6 6V13.5a1.5 1.5 0 0 1-1.5 1.5h-9A1.5 1.5 0 0 1 2 13.5V9.293l6-6zm5-.793V6l-2-2V2.5a.5.5 0 0 1 .5-.5h1a.5.5 0 0 1 .5.5z"/>
<path fill-rule="evenodd" d="M7.293 1.5a1 1 0 0 1 1.414 0l6.647 6.646a.5.5 0 0 1-.708.708L8 2.207 1.354 8.854a.5.5 0 1 1-.708-.708L7.293 1.5z"/>
</svg>
</template>
<template id="template-icon-wiki">
<svg xmlns="http://www.w3.org/2000/svg" width="19" height="19" viewBox="0 0 640 512" fill="currentColor" role="img" aria-level="">
<path d="M640 51.2l-.3 12.2c-28.1.8-45 15.8-55.8 40.3-25 57.8-103.3 240-155.3 358.6H415l-81.9-193.1c-32.5 63.6-68.3 130-99.2 193.1-.3.3-15 0-15-.3C172 352.3 122.8 243.4 75.8 133.4 64.4 106.7 26.4 63.4.2 63.7c0-3.1-.3-10-.3-14.2h161.9v13.9c-19.2 1.1-52.8 13.3-43.3 34.2 21.9 49.7 103.6 240.3 125.6 288.6 15-29.7 57.8-109.2 75.3-142.8-13.9-28.3-58.6-133.9-72.8-160-9.7-17.8-36.1-19.4-55.8-19.7V49.8l142.5.3v13.1c-19.4.6-38.1 7.8-29.4 26.1 18.9 40 30.6 68.1 48.1 104.7 5.6-10.8 34.7-69.4 48.1-100.8 8.9-20.6-3.9-28.6-38.6-29.4.3-3.6 0-10.3.3-13.6 44.4-.3 111.1-.3 123.1-.6v13.6c-22.5.8-45.8 12.8-58.1 31.7l-59.2 122.8c6.4 16.1 63.3 142.8 69.2 156.7L559.2 91.8c-8.6-23.1-36.4-28.1-47.2-28.3V49.6l127.8 1.1.2.5z"/>
</svg>
</template>
<template id="template-icon-git">
<svg xmlns="http://www.w3.org/2000/svg" width="19" height="19" fill="currentColor" viewBox="0 0 16 16" role="img" aria-label="">
<path d="M15.698 7.287 8.712.302a1.03 1.03 0 0 0-1.457 0l-1.45 1.45 1.84 1.84a1.223 1.223 0 0 1 1.55 1.56l1.773 1.774a1.224 1.224 0 0 1 1.267 2.025 1.226 1.226 0 0 1-2.002-1.334L8.58 5.963v4.353a1.226 1.226 0 1 1-1.008-.036V5.887a1.226 1.226 0 0 1-.666-1.608L5.093 2.465l-4.79 4.79a1.03 1.03 0 0 0 0 1.457l6.986 6.986a1.03 1.03 0 0 0 1.457 0l6.953-6.953a1.031 1.031 0 0 0 0-1.457"/>
</svg>
</template>
<template id="template-icon-cloud">
<svg xmlns="http://www.w3.org/2000/svg" width="19" height="19" fill="currentColor" viewBox="0 0 16 16" role="img" aria-label="">
<path d="M4.406 3.342A5.53 5.53 0 0 1 8 2c2.69 0 4.923 2 5.166 4.579C14.758 6.804 16 8.137 16 9.773 16 11.569 14.502 13 12.687 13H3.781C1.708 13 0 11.366 0 9.318c0-1.763 1.266-3.223 2.942-3.593.143-.863.698-1.723 1.464-2.383z"/>
</svg>
</template>
<template id="template-icon-pad">
<svg xmlns="http://www.w3.org/2000/svg" width="19" height="19" fill="currentColor" viewBox="0 0 16 16" role="img" aria-label="">
<path fill-rule="evenodd" d="M8 0c-.69 0-1.843.265-2.928.56-1.11.3-2.229.655-2.887.87a1.54 1.54 0 0 0-1.044 1.262c-.596 4.477.787 7.795 2.465 9.99a11.777 11.777 0 0 0 2.517 2.453c.386.273.744.482 1.048.625.28.132.581.24.829.24s.548-.108.829-.24a7.159 7.159 0 0 0 1.048-.625 11.775 11.775 0 0 0 2.517-2.453c1.678-2.195 3.061-5.513 2.465-9.99a1.541 1.541 0 0 0-1.044-1.263 62.467 62.467 0 0 0-2.887-.87C9.843.266 8.69 0 8 0zm0 5a1.5 1.5 0 0 1 .5 2.915l.385 1.99a.5.5 0 0 1-.491.595h-.788a.5.5 0 0 1-.49-.595l.384-1.99A1.5 1.5 0 0 1 8 5z"/>
</svg>
</template>
<template id="template-link-item">
<li class="panel-list-item link" data-url="">
<div class="icon"></div>
<div class="text"></div>
<div class="text-shortcut"></div>
</li>
</template>
<template id="template-calendar-entry">
<div class="calendar-entry">
<template id="template-icon-closed">
<svg xmlns="http://www.w3.org/2000/svg" width="19" height="19" fill="currentColor" viewBox="0 0 16 16" role="img" aria-label="">
<path d="M11 6.5a.5.5 0 0 1 .5-.5h1a.5.5 0 0 1 .5.5v1a.5.5 0 0 1-.5.5h-1a.5.5 0 0 1-.5-.5v-1z"/>
<path d="M3.5 0a.5.5 0 0 1 .5.5V1h8V.5a.5.5 0 0 1 1 0V1h1a2 2 0 0 1 2 2v11a2 2 0 0 1-2 2H2a2 2 0 0 1-2-2V3a2 2 0 0 1 2-2h1V.5a.5.5 0 0 1 .5-.5zM1 4v10a1 1 0 0 0 1 1h12a1 1 0 0 0 1-1V4H1z"/>
<path d="M3 2a1 1 0 0 1 1-1h8a1 1 0 0 1 1 1v13h1.5a.5.5 0 0 1 0 1h-13a.5.5 0 0 1 0-1H3V2zm1 13h8V2H4v13z" />
<path d="M9 9a1 1 0 1 0 2 0 1 1 0 0 0-2 0z" />
</svg>
<div>
</template>
<template id="template-icon-open">
<svg xmlns="http://www.w3.org/2000/svg" width="19" height="19" fill="currentColor" viewBox="0 0 16 16" role="img" aria-label="">
<path d="M8.5 10c-.276 0-.5-.448-.5-1s.224-1 .5-1 .5.448.5 1-.224 1-.5 1z" />
<path d="M10.828.122A.5.5 0 0 1 11 .5V1h.5A1.5 1.5 0 0 1 13 2.5V15h1.5a.5.5 0 0 1 0 1h-13a.5.5 0 0 1 0-1H3V1.5a.5.5 0 0 1 .43-.495l7-1a.5.5 0 0 1 .398.117zM11.5 2H11v13h1V2.5a.5.5 0 0 0-.5-.5zM4 1.934V15h6V1.077l-6 .857z" />
</svg>
</template>
<template id="template-state">
<svg></svg>
<span></span>
<time datetime=""></time>
</template>
<template id="template-icon-homepage">
<svg xmlns="http://www.w3.org/2000/svg" width="19" height="19" fill="currentColor" viewBox="0 0 16 16" role="img" aria-label="">
<path fill-rule="evenodd" d="m8 3.293 6 6V13.5a1.5 1.5 0 0 1-1.5 1.5h-9A1.5 1.5 0 0 1 2 13.5V9.293l6-6zm5-.793V6l-2-2V2.5a.5.5 0 0 1 .5-.5h1a.5.5 0 0 1 .5.5z" />
<path fill-rule="evenodd" d="M7.293 1.5a1 1 0 0 1 1.414 0l6.647 6.646a.5.5 0 0 1-.708.708L8 2.207 1.354 8.854a.5.5 0 1 1-.708-.708L7.293 1.5z" />
</svg>
</template>
<template id="template-icon-wiki">
<svg xmlns="http://www.w3.org/2000/svg" width="19" height="19" viewBox="0 0 640 512" fill="currentColor" role="img" aria-level="">
<path d="M640 51.2l-.3 12.2c-28.1.8-45 15.8-55.8 40.3-25 57.8-103.3 240-155.3 358.6H415l-81.9-193.1c-32.5 63.6-68.3 130-99.2 193.1-.3.3-15 0-15-.3C172 352.3 122.8 243.4 75.8 133.4 64.4 106.7 26.4 63.4.2 63.7c0-3.1-.3-10-.3-14.2h161.9v13.9c-19.2 1.1-52.8 13.3-43.3 34.2 21.9 49.7 103.6 240.3 125.6 288.6 15-29.7 57.8-109.2 75.3-142.8-13.9-28.3-58.6-133.9-72.8-160-9.7-17.8-36.1-19.4-55.8-19.7V49.8l142.5.3v13.1c-19.4.6-38.1 7.8-29.4 26.1 18.9 40 30.6 68.1 48.1 104.7 5.6-10.8 34.7-69.4 48.1-100.8 8.9-20.6-3.9-28.6-38.6-29.4.3-3.6 0-10.3.3-13.6 44.4-.3 111.1-.3 123.1-.6v13.6c-22.5.8-45.8 12.8-58.1 31.7l-59.2 122.8c6.4 16.1 63.3 142.8 69.2 156.7L559.2 91.8c-8.6-23.1-36.4-28.1-47.2-28.3V49.6l127.8 1.1.2.5z" />
</svg>
</template>
<template id="template-icon-git">
<svg xmlns="http://www.w3.org/2000/svg" width="19" height="19" fill="currentColor" viewBox="0 0 16 16" role="img" aria-label="">
<path d="M15.698 7.287 8.712.302a1.03 1.03 0 0 0-1.457 0l-1.45 1.45 1.84 1.84a1.223 1.223 0 0 1 1.55 1.56l1.773 1.774a1.224 1.224 0 0 1 1.267 2.025 1.226 1.226 0 0 1-2.002-1.334L8.58 5.963v4.353a1.226 1.226 0 1 1-1.008-.036V5.887a1.226 1.226 0 0 1-.666-1.608L5.093 2.465l-4.79 4.79a1.03 1.03 0 0 0 0 1.457l6.986 6.986a1.03 1.03 0 0 0 1.457 0l6.953-6.953a1.031 1.031 0 0 0 0-1.457" />
</svg>
</template>
<template id="template-icon-cloud">
<svg xmlns="http://www.w3.org/2000/svg" width="19" height="19" fill="currentColor" viewBox="0 0 16 16" role="img" aria-label="">
<path d="M4.406 3.342A5.53 5.53 0 0 1 8 2c2.69 0 4.923 2 5.166 4.579C14.758 6.804 16 8.137 16 9.773 16 11.569 14.502 13 12.687 13H3.781C1.708 13 0 11.366 0 9.318c0-1.763 1.266-3.223 2.942-3.593.143-.863.698-1.723 1.464-2.383z" />
</svg>
</template>
<template id="template-icon-pad">
<svg xmlns="http://www.w3.org/2000/svg" width="19" height="19" fill="currentColor" viewBox="0 0 16 16" role="img" aria-label="">
<path fill-rule="evenodd" d="M8 0c-.69 0-1.843.265-2.928.56-1.11.3-2.229.655-2.887.87a1.54 1.54 0 0 0-1.044 1.262c-.596 4.477.787 7.795 2.465 9.99a11.777 11.777 0 0 0 2.517 2.453c.386.273.744.482 1.048.625.28.132.581.24.829.24s.548-.108.829-.24a7.159 7.159 0 0 0 1.048-.625 11.775 11.775 0 0 0 2.517-2.453c1.678-2.195 3.061-5.513 2.465-9.99a1.541 1.541 0 0 0-1.044-1.263 62.467 62.467 0 0 0-2.887-.87C9.843.266 8.69 0 8 0zm0 5a1.5 1.5 0 0 1 .5 2.915l.385 1.99a.5.5 0 0 1-.491.595h-.788a.5.5 0 0 1-.49-.595l.384-1.99A1.5 1.5 0 0 1 8 5z" />
</svg>
</template>
<template id="template-link-item">
<li class="panel-list-item link" data-url="">
<div class="icon"></div>
<div class="text"></div>
<div class="text-shortcut"></div>
</li>
</template>
<template id="template-calendar-entry">
<div class="calendar-entry">
<svg xmlns="http://www.w3.org/2000/svg" width="19" height="19" fill="currentColor" viewBox="0 0 16 16" role="img" aria-label="">
<path d="M11 6.5a.5.5 0 0 1 .5-.5h1a.5.5 0 0 1 .5.5v1a.5.5 0 0 1-.5.5h-1a.5.5 0 0 1-.5-.5v-1z" />
<path d="M3.5 0a.5.5 0 0 1 .5.5V1h8V.5a.5.5 0 0 1 1 0V1h1a2 2 0 0 1 2 2v11a2 2 0 0 1-2 2H2a2 2 0 0 1-2-2V3a2 2 0 0 1 2-2h1V.5a.5.5 0 0 1 .5-.5zM1 4v10a1 1 0 0 0 1 1h12a1 1 0 0 0 1-1V4H1z" />
</svg>
<div>
<strong></strong>
<time datetime=""></time>
<div>
<strong></strong>
<time datetime=""></time>
</div>
</div>
</div>
</div>
</template>
<template id="template-calendar-entry-location">
<div>(<address></address>)</div>
</template>
</head>
<body>
<section>
<h2 id="currentState"></h2>
<div id="state"></div>
</section>
<section>
<h2 id="links"></h2>
<ul id="link-list" class="panel-section panel-section-list"></ul>
</section>
<section>
<h2 id="nextEvent"></h2>
<div id="calendar"></div>
</section>
<section class="no-padding">
<details>
<summary><h2 id="spaceApiJson"></h2></summary>
<pre id="space-api"><code></code></pre>
</details>
</section>
</template>
<template id="template-calendar-entry-location">
<div>(<address></address>)</div>
</template>
</head>
<body>
<section>
<h2 id="currentState"></h2>
<div id="state"></div>
</section>
<section>
<h2 id="links"></h2>
<ul id="link-list" class="panel-section-list"></ul>
</section>
<section>
<h2 id="nextEvent"></h2>
<div id="calendar"></div>
</section>
<section class="no-padding">
<details>
<summary><h2 id="spaceApiJson"></h2></summary>
<pre id="space-api"><code></code></pre>
</details>
</section>
<!-- [INJECT-BROWSER-POLYFILL] -->
<script type="module" src="popup.js"></script>
</body>
<!-- [INJECT-BROWSER-POLYFILL] -->
<script type="module" src="popup.js"></script>
</body>
</html>

View File

@ -1,6 +1,6 @@
import { QUICK_LINKS } from './config.js';
const dateTimeFormat = Intl.DateTimeFormat([], {dateStyle: 'medium', timeStyle: 'short'});
const dateTimeFormat = Intl.DateTimeFormat([], { dateStyle: 'medium', timeStyle: 'short' });
function setL10n() {
document.querySelector('html').setAttribute('lang', browser.i18n.getUILanguage());
@ -38,7 +38,7 @@ function setLinks() {
*/
async function linkElementClickListener(event) {
try {
await browser.tabs.create({url: event.currentTarget.dataset.url});
await browser.tabs.create({ url: event.currentTarget.dataset.url });
} catch (error) {
console.error(error);
}
@ -53,7 +53,10 @@ async function init() {
linkElement.addEventListener('click', linkElementClickListener);
});
const {calendar, spaceApi} = await browser.storage.local.get(['calendar', 'spaceApi']);
/**
* @type {import("../types").Storage}
*/
const { calendar, spaceApi } = await browser.storage.local.get(['calendar', 'spaceApi']);
if (calendar) {
updateNextEvent(calendar);
@ -66,7 +69,7 @@ async function init() {
await init();
/**
* @param {Array<object>} nextEvents
* @param {import("../types").Calendar} nextEvents
*/
function updateNextEvent(nextEvents) {
const calendarElement = document.getElementById('calendar');
@ -77,7 +80,7 @@ function updateNextEvent(nextEvents) {
strongElement.textContent = browser.i18n.getMessage('noEventsInNext4Weeks');
calendarElement.append(strongElement);
} else {
const nextEventDate = nextEvents[0].begin.substr(0, 10);
const nextEventDate = nextEvents[0].begin.substring(0, 10);
const nextEventDateEvents = nextEvents.filter((nextEvent) => (nextEvent.begin.startsWith(nextEventDate)));
nextEventDateEvents.forEach((nextEventDateEvent) => {
@ -106,7 +109,7 @@ function updateNextEvent(nextEvents) {
}
/**
* @param {object} spaceApi
* @param {import("../types").SpaceApi} spaceApi
*/
function updateSpaceApiJson(spaceApi) {
const spaceApiElement = document.querySelector('#space-api > code');
@ -114,7 +117,7 @@ function updateSpaceApiJson(spaceApi) {
}
/**
* @param {object} spaceApi
* @param {import("../types").SpaceApi} spaceApi
*/
function updateState(spaceApi) {
const state = spaceApi.state.open ? 'open' : 'closed';

939
types.d.ts vendored Normal file
View File

@ -0,0 +1,939 @@
export type Storage = {
calendar?: Calendar | undefined;
spaceApi?: SpaceApi | undefined;
};
export type Calendar = CalendarEntry[];
type CalendarEntry = {
begin: string;
begin_date: `${number}.${number}.${number}`;
begin_time: `${number}:${number}`;
end: string;
end_date: `${number}.${number}.${number}`;
end_time: `${number}:${number}`;
name: string;
description: string | null;
location: string | null;
};
/**
* SpaceAPI v14
*/
export interface SpaceApi {
/**
* The versions your SpaceAPI endpoint supports
*/
api_compatibility: string[];
/**
* The name of your space
*/
space: string;
/**
* URL to your space logo
*/
logo: string;
/**
* URL to your space website
*/
url: string;
/**
* Position data such as a postal address or geographic coordinates
*/
location: {
/**
* The postal address of your space (street, block, housenumber, zip code, city, whatever you usually need in your country, and the country itself).<br>Examples: <ul><li>Netzladen e.V., Breite Straße 74, 53111 Bonn, Germany</li></ul>
*/
address?: string;
/**
* Latitude of your space location, in degree with decimal places. Use positive values for locations north of the equator, negative values for locations south of equator.
*/
lat: number;
/**
* Longitude of your space location, in degree with decimal places. Use positive values for locations east of Greenwich, and negative values for locations west of Greenwich.
*/
lon: number;
/**
* The timezone the space is located in. It should be formatted according to the <a target="_blank" href="https://en.wikipedia.org/wiki/List_of_tz_database_time_zones">TZ database location names</a>.
*/
timezone?: string;
[k: string]: unknown;
};
/**
* A flag indicating if the hackerspace uses SpaceFED, a federated login scheme so that visiting hackers can use the space WiFi with their home space credentials.
*/
spacefed?: {
/**
* See the <a target="_blank" href="https://spacefed.net/index.php/Category:Howto/Spacenet">wiki</a>.
*/
spacenet: boolean;
/**
* See the <a target="_blank" href="https://spacefed.net/index.php?title=Spacesaml">wiki</a>.
*/
spacesaml: boolean;
[k: string]: unknown;
};
/**
* URL(s) of webcams in your space
*/
cam?: [string, ...string[]];
/**
* A collection of status-related data: actual open/closed status, icons, last change timestamp etc.
*/
state?: {
/**
* A flag which indicates whether the space is currently open or closed. The state 'undefined' can be achieved by omitting this field. A missing 'open' property carries the semantics of a temporary unavailability of the state, whereas the absence of the 'state' property itself means the state is generally not implemented for this space. This field is also allowed to explicitly have the value null for backwards compatibility with older schema versions, but this is deprecated and will be removed in a future version.
*/
open?: boolean | null;
/**
* The Unix timestamp when the space status changed most recently
*/
lastchange?: number;
/**
* The person who lastly changed the state e.g. opened or closed the space
*/
trigger_person?: string;
/**
* An additional free-form string, could be something like <samp>'open for public'</samp>, <samp>'members only'</samp> or whatever you want it to be
*/
message?: string;
/**
* Icons that show the status graphically
*/
icon?: {
/**
* The URL to your customized space logo showing an open space
*/
open: string;
/**
* The URL to your customized space logo showing a closed space
*/
closed: string;
[k: string]: unknown;
};
[k: string]: unknown;
};
/**
* Events which happened recently in your space and which could be interesting to the public, like 'User X has entered/triggered/did something at timestamp Z'
*/
events?: {
/**
* Name or other identity of the subject (e.g. <samp>J. Random Hacker</samp>, <samp>fridge</samp>, <samp>3D printer</samp>, )
*/
name: string;
/**
* Action (e.g. <samp>check-in</samp>, <samp>check-out</samp>, <samp>finish-print</samp>, ). Define your own actions and use them consistently, canonical actions are not (yet) specified
*/
type: string;
/**
* Unix timestamp when the event occurred
*/
timestamp: number;
/**
* A custom text field to give more information about the event
*/
extra?: string;
[k: string]: unknown;
}[];
/**
* Contact information about your space
*/
contact: {
/**
* Phone number, including country code with a leading plus sign
*/
phone?: string;
/**
* URI for Voice-over-IP via SIP
*/
sip?: string;
/**
* Persons who carry a key and are able to open the space upon request. One of the fields irc_nick, phone, email or twitter must be specified.
*/
keymasters?: [
{
/**
* Real name
*/
name?: string;
/**
* Contact the person with this nickname directly in irc if available. The irc channel to be used is defined in the contact/irc field.
*/
irc_nick?: string;
/**
* Phone number, including country code with a leading plus sign
*/
phone?: string;
/**
* Email address which can be base64 encoded
*/
email?: string;
/**
* Twitter username with leading <code>@</code>
*/
twitter?: string;
/**
* XMPP (Jabber) ID
*/
xmpp?: string;
/**
* Mastodon username
*/
mastodon?: string;
/**
* Matrix username (including domain)
*/
matrix?: string;
[k: string]: unknown;
},
...{
/**
* Real name
*/
name?: string;
/**
* Contact the person with this nickname directly in irc if available. The irc channel to be used is defined in the contact/irc field.
*/
irc_nick?: string;
/**
* Phone number, including country code with a leading plus sign
*/
phone?: string;
/**
* Email address which can be base64 encoded
*/
email?: string;
/**
* Twitter username with leading <code>@</code>
*/
twitter?: string;
/**
* XMPP (Jabber) ID
*/
xmpp?: string;
/**
* Mastodon username
*/
mastodon?: string;
/**
* Matrix username (including domain)
*/
matrix?: string;
[k: string]: unknown;
}[]
];
/**
* URL of the IRC channel
*/
irc?: string;
/**
* Twitter username with leading <code>@</code>
*/
twitter?: string;
/**
* Mastodon username
*/
mastodon?: string;
/**
* Facebook account URL
*/
facebook?: string;
/**
* Identi.ca or StatusNet account, in the form <samp>yourspace@example.org</samp>
*/
identica?: string;
/**
* Foursquare ID, in the form <samp>4d8a9114d85f3704eab301dc</samp>
*/
foursquare?: string;
/**
* E-mail address for contacting your space. If this is a mailing list consider to use the contact/ml field.
*/
email?: string;
/**
* The e-mail address of your mailing list. If you use Google Groups then the e-mail looks like <samp>your-group@googlegroups.com</samp>.
*/
ml?: string;
/**
* A public Jabber/XMPP multi-user chatroom in the form <samp>chatroom@conference.example.net</samp>
*/
xmpp?: string;
/**
* A separate email address for issue reports. This value can be Base64-encoded.
*/
issue_mail?: string;
/**
* A URL to find information about the Space in the Gopherspace
*/
gopher?: string;
/**
* Matrix channel/community for the Hackerspace
*/
matrix?: string;
/**
* URL to a Mumble server/channel, as specified in https://wiki.mumble.info/wiki/Mumble_URL
*/
mumble?: string;
[k: string]: unknown;
};
/**
* Data of various sensors in your space (e.g. temperature, humidity, amount of Club-Mate left, ). The only canonical property is the <em>temp</em> property, additional sensor types may be defined by you. In this case, you are requested to share your definition for inclusion in this specification.
*/
sensors?: {
/**
* Temperature sensor. To convert from one unit of temperature to another consider <a href="http://en.wikipedia.org/wiki/Temperature_conversion_formulas" target="_blank">Wikipedia</a>.
*/
temperature?: {
/**
* The sensor value
*/
value: number;
/**
* The unit of the sensor value
*/
unit: '°C' | '°F' | 'K' | '°De' | '°N' | '°R' | '°Ré' | '°Rø';
/**
* The location of your sensor
*/
location: string;
/**
* This field is an additional field to give your sensor a name. This can be useful if you have multiple sensors in the same location.
*/
name?: string;
/**
* An extra field that you can use to attach some additional information to this sensor instance
*/
description?: string;
[k: string]: unknown;
}[];
/**
* Sensor type to indicate if a certain door is locked
*/
door_locked?: {
/**
* The sensor value
*/
value: boolean;
/**
* The location of your sensor
*/
location: string;
/**
* This field is an additional field to give your sensor a name. This can be useful if you have multiple sensors in the same location.
*/
name?: string;
/**
* An extra field that you can use to attach some additional information to this sensor instance
*/
description?: string;
[k: string]: unknown;
}[];
/**
* Barometer sensor
*/
barometer?: {
/**
* The sensor value
*/
value: number;
/**
* The unit of pressure used by your sensor<br>Note: The <code>hPA</code> unit is deprecated and should not be used anymore. Use the correct <code>hPa</code> unit instead.
*/
unit: 'hPa' | 'hPA';
/**
* The location of your sensor
*/
location: string;
/**
* This field is an additional field to give your sensor a name. This can be useful if you have multiple sensors in the same location.
*/
name?: string;
/**
* An extra field that you can use to attach some additional information to this sensor instance
*/
description?: string;
[k: string]: unknown;
}[];
/**
* Compound radiation sensor. Check this <a rel="nofollow" href="https://sites.google.com/site/diygeigercounter/gm-tubes-supported" target="_blank">resource</a>.
*/
radiation?: {
/**
* An alpha sensor
*/
alpha?: {
/**
* Observed counts per minute (ocpm) or actual radiation value. If the value are the observed counts then the dead_time and conversion_factor fields must be defined as well. CPM formula: <div>cpm = ocpm ( 1 + 1 / (1 - ocpm x dead_time) )</div> Conversion formula: <div>µSv/h = cpm x conversion_factor</div>
*/
value: number;
/**
* Choose the appropriate unit for your radiation sensor instance
*/
unit: 'cpm' | 'r/h' | 'µSv/h' | 'mSv/a' | 'µSv/a';
/**
* The dead time in µs. See the description of the value field to see how to use the dead time.
*/
dead_time?: number;
/**
* The conversion from the <em>cpm</em> unit to another unit hardly depends on your tube type. See the description of the value field to see how to use the conversion factor. <strong>Note:</strong> only trust your manufacturer if it comes to the actual factor value. The internet seems <a rel="nofollow" href="http://sapporohibaku.wordpress.com/2011/10/15/conversion-factor/" target="_blank">full of wrong copy & pastes</a>, don't even trust your neighbour hackerspace. If in doubt ask the tube manufacturer.
*/
conversion_factor?: number;
/**
* The location of your sensor
*/
location?: string;
/**
* This field is an additional field to give your sensor a name. This can be useful if you have multiple sensors in the same location.
*/
name?: string;
/**
* An extra field that you can use to attach some additional information to this sensor instance
*/
description?: string;
[k: string]: unknown;
}[];
/**
* A beta sensor
*/
beta?: {
/**
* Observed counts per minute (ocpm) or actual radiation value. If the value are the observed counts then the dead_time and conversion_factor fields must be defined as well. CPM formula: <div>cpm = ocpm ( 1 + 1 / (1 - ocpm x dead_time) )</div> Conversion formula: <div>µSv/h = cpm x conversion_factor</div>
*/
value: number;
/**
* Choose the appropriate unit for your radiation sensor instance
*/
unit: 'cpm' | 'r/h' | 'µSv/h' | 'mSv/a' | 'µSv/a';
/**
* The dead time in µs. See the description of the value field to see how to use the dead time.
*/
dead_time?: number;
/**
* The conversion from the <em>cpm</em> unit to another unit hardly depends on your tube type. See the description of the value field to see how to use the conversion factor. <strong>Note:</strong> only trust your manufacturer if it comes to the actual factor value. The internet seems <a rel="nofollow" href="http://sapporohibaku.wordpress.com/2011/10/15/conversion-factor/" target="_blank">full of wrong copy & pastes</a>, don't even trust your neighbour hackerspace. If in doubt ask the tube manufacturer.
*/
conversion_factor?: number;
/**
* The location of your sensor
*/
location?: string;
/**
* This field is an additional field to give your sensor a name. This can be useful if you have multiple sensors in the same location.
*/
name?: string;
/**
* An extra field that you can use to attach some additional information to this sensor instance
*/
description?: string;
[k: string]: unknown;
}[];
/**
* A gamma sensor
*/
gamma?: {
/**
* Observed counts per minute (ocpm) or actual radiation value. If the value are the observed counts then the dead_time and conversion_factor fields must be defined as well. CPM formula: <div>cpm = ocpm ( 1 + 1 / (1 - ocpm x dead_time) )</div> Conversion formula: <div>µSv/h = cpm x conversion_factor</div>
*/
value: number;
/**
* Choose the appropriate unit for your radiation sensor instance
*/
unit: 'cpm' | 'r/h' | 'µSv/h' | 'mSv/a' | 'µSv/a';
/**
* The dead time in µs. See the description of the value field to see how to use the dead time.
*/
dead_time?: number;
/**
* The conversion from the <em>cpm</em> unit to another unit hardly depends on your tube type. See the description of the value field to see how to use the conversion factor. <strong>Note:</strong> only trust your manufacturer if it comes to the actual factor value. The internet seems <a rel="nofollow" href="http://sapporohibaku.wordpress.com/2011/10/15/conversion-factor/" target="_blank">full of wrong copy & pastes</a>, don't even trust your neighbour hackerspace. If in doubt ask the tube manufacturer.
*/
conversion_factor?: number;
/**
* The location of your sensor
*/
location?: string;
/**
* This field is an additional field to give your sensor a name. This can be useful if you have multiple sensors in the same location.
*/
name?: string;
/**
* An extra field that you can use to attach some additional information to this sensor instance
*/
description?: string;
[k: string]: unknown;
}[];
/**
* A sensor which cannot filter beta and gamma radiation separately.
*/
beta_gamma?: {
/**
* Observed counts per minute (ocpm) or actual radiation value. If the value are the observed counts then the dead_time and conversion_factor fields must be defined as well. CPM formula: <div>cpm = ocpm ( 1 + 1 / (1 - ocpm x dead_time) )</div> Conversion formula: <div>µSv/h = cpm x conversion_factor</div>
*/
value: number;
/**
* Choose the appropriate unit for your radiation sensor instance
*/
unit: 'cpm' | 'r/h' | 'µSv/h' | 'mSv/a' | 'µSv/a';
/**
* The dead time in µs. See the description of the value field to see how to use the dead time.
*/
dead_time?: number;
/**
* The conversion from the <em>cpm</em> unit to another unit hardly depends on your tube type. See the description of the value field to see how to use the conversion factor. <strong>Note:</strong> only trust your manufacturer if it comes to the actual factor value. The internet seems <a rel="nofollow" href="http://sapporohibaku.wordpress.com/2011/10/15/conversion-factor/" target="_blank">full of wrong copy & pastes</a>, don't even trust your neighbour hackerspace. If in doubt ask the tube manufacturer.
*/
conversion_factor?: number;
/**
* The location of your sensor
*/
location?: string;
/**
* This field is an additional field to give your sensor a name. This can be useful if you have multiple sensors in the same location.
*/
name?: string;
/**
* An extra field that you can use to attach some additional information to this sensor instance
*/
description?: string;
[k: string]: unknown;
}[];
[k: string]: unknown;
};
/**
* Humidity sensor
*/
humidity?: {
/**
* The sensor value
*/
value: number;
/**
* The unit of the sensor value. You should always define the unit though if the sensor is a flag of a boolean type then you can of course omit it.
*/
unit: '%';
/**
* The location of your sensor
*/
location: string;
/**
* This field is an additional field to give your sensor a name. This can be useful if you have multiple sensors in the same location.
*/
name?: string;
/**
* An extra field that you can use to attach some additional information to this sensor instance
*/
description?: string;
[k: string]: unknown;
}[];
/**
* How much Mate and beer is in your fridge?
*/
beverage_supply?: {
/**
* The sensor value
*/
value: number;
/**
* The unit, either <samp>btl</samp> for bottles or <samp>crt</samp> for crates
*/
unit: 'btl' | 'crt';
/**
* The location of your sensor
*/
location?: string;
/**
* This field is an additional field to give your sensor a name. This can be useful if you have multiple sensors in the same location.
*/
name?: string;
/**
* An extra field that you can use to attach some additional information to this sensor instance
*/
description?: string;
[k: string]: unknown;
}[];
/**
* The power consumption of a specific device or of your whole space
*/
power_consumption?: {
/**
* The sensor value
*/
value: number;
/**
* The unit of the sensor value. You should always define the unit though if the sensor is a flag of a boolean type then you can of course omit it.
*/
unit: 'mW' | 'W' | 'VA';
/**
* The location of your sensor
*/
location: string;
/**
* This field is an additional field to give your sensor a name. This can be useful if you have multiple sensors in the same location.
*/
name?: string;
/**
* An extra field that you can use to attach some additional information to this sensor instance
*/
description?: string;
[k: string]: unknown;
}[];
/**
* Your wind sensor
*/
wind?: {
properties: {
speed: {
/**
* The sensor value
*/
value: number;
/**
* The unit of the sensor value. You should always define the unit though if the sensor is a flag of a boolean type then you can of course omit it.
*/
unit: 'm/s' | 'km/h' | 'kn';
[k: string]: unknown;
};
gust: {
/**
* The sensor value
*/
value: number;
/**
* The unit of the sensor value. You should always define the unit though if the sensor is a flag of a boolean type then you can of course omit it.
*/
unit: 'm/s' | 'km/h' | 'kn';
[k: string]: unknown;
};
/**
* The wind direction in degrees
*/
direction: {
/**
* The sensor value
*/
value: number;
/**
* The unit of the sensor value. You should always define the unit though if the sensor is a flag of a boolean type then you can of course omit it.
*/
unit: '°';
[k: string]: unknown;
};
/**
* Height above mean sea level
*/
elevation: {
/**
* The sensor value
*/
value: number;
/**
* The unit of the sensor value. You should always define the unit though if the sensor is a flag of a boolean type then you can of course omit it.
*/
unit: 'm';
[k: string]: unknown;
};
[k: string]: unknown;
};
/**
* The location of your sensor
*/
location: string;
/**
* This field is an additional field to give your sensor a name. This can be useful if you have multiple sensors in the same location.
*/
name?: string;
/**
* An extra field that you can use to attach some additional information to this sensor instance
*/
description?: string;
[k: string]: unknown;
}[];
/**
* This sensor type is to specify the currently active ethernet or wireless network devices. You can create different instances for each network type.
*/
network_connections?: {
/**
* This field is optional but you can use it to the network type such as <samp>wifi</samp> or <samp>cable</samp>. You can even expose the number of <a href="https://spacefed.net/wiki/index.php/Spacenet" target="_blank">spacenet</a>-authenticated connections.
*/
type?: 'wifi' | 'cable' | 'spacenet';
/**
* The amount of network connections.
*/
value: number;
/**
* The machines that are currently connected with the network.
*/
machines?: {
/**
* The machine name.
*/
name?: string;
/**
* The machine's MAC address of the format <samp>D3:3A:DB:EE:FF:00</samp>.
*/
mac: string;
[k: string]: unknown;
}[];
/**
* The location of your sensor
*/
location?: string;
/**
* This field is an additional field to give your sensor a name. This can be useful if you have multiple sensors in the same location.
*/
name?: string;
/**
* An extra field that you can use to attach some additional information to this sensor instance
*/
description?: string;
[k: string]: unknown;
}[];
/**
* How rich is your hackerspace?
*/
account_balance?: {
/**
* How much?
*/
value: number;
/**
* What's the currency? It should be formatted according to <a href="https://en.wikipedia.org/wiki/ISO_4217" target="_blank">ISO 4217</a> short-code format.
*/
unit: string;
/**
* If you have more than one account you can use this field to specify where it is.
*/
location?: string;
/**
* Give your sensor instance a name.
*/
name?: string;
/**
* An extra field that you can use to attach some additional information to this sensor instance
*/
description?: string;
[k: string]: unknown;
}[];
/**
* Specify the number of space members.
*/
total_member_count?: {
/**
* The amount of your space members.
*/
value: number;
/**
* Specify the location if your hackerspace has different departments (for whatever reason). This field is for one department. Every department should have its own sensor instance.
*/
location?: string;
/**
* You can use this field to specify if this sensor instance counts active or inactive members.
*/
name?: string;
/**
* An extra field that you can use to attach some additional information to this sensor instance
*/
description?: string;
[k: string]: unknown;
}[];
/**
* Specify the number of people that are currently in your space. Optionally you can define a list of names.
*/
people_now_present?: {
/**
* The amount of present people.
*/
value: number;
/**
* If you use multiple sensor instances for different rooms, use this field to indicate the location.
*/
location?: string;
/**
* Give this sensor a name if necessary at all. Use the location field for the rooms. This field is not intended to be used for names of hackerspace members. Use the field 'names' instead.
*/
name?: string;
/**
* List of hackerspace members that are currently occupying the space.
*/
names?: [string, ...string[]];
/**
* An extra field that you can use to attach some additional information to this sensor instance
*/
description?: string;
[k: string]: unknown;
}[];
/**
* The current network traffic, in bits/second or packets/second (or both)
*/
network_traffic?: [
{
properties: {
bits_per_second?: {
/**
* The measurement value, in bits/second
*/
value: number;
/**
* The maximum available throughput in bits/second, e.g. as sold by your ISP
*/
maximum?: number;
[k: string]: unknown;
};
packets_per_second?: {
/**
* The measurement value, in packets/second
*/
value: number;
[k: string]: unknown;
};
[k: string]: unknown;
};
/**
* Name of the measurement, e.g. to distinguish between upstream and downstream traffic
*/
name?: string;
/**
* Location the measurement relates to, e.g. <samp>WiFi</samp> or <samp>Uplink</samp>
*/
location?: string;
/**
* An extra field that you can use to attach some additional information to this sensor instance
*/
description?: string;
[k: string]: unknown;
},
...{
properties: {
bits_per_second?: {
/**
* The measurement value, in bits/second
*/
value: number;
/**
* The maximum available throughput in bits/second, e.g. as sold by your ISP
*/
maximum?: number;
[k: string]: unknown;
};
packets_per_second?: {
/**
* The measurement value, in packets/second
*/
value: number;
[k: string]: unknown;
};
[k: string]: unknown;
};
/**
* Name of the measurement, e.g. to distinguish between upstream and downstream traffic
*/
name?: string;
/**
* Location the measurement relates to, e.g. <samp>WiFi</samp> or <samp>Uplink</samp>
*/
location?: string;
/**
* An extra field that you can use to attach some additional information to this sensor instance
*/
description?: string;
[k: string]: unknown;
}[]
];
[k: string]: unknown;
};
/**
* Feeds where users can get updates of your space
*/
feeds?: {
blog?: {
/**
* Type of the feed
*/
type?: string;
/**
* Feed URL
*/
url: string;
[k: string]: unknown;
};
wiki?: {
/**
* Type of the feed
*/
type?: string;
/**
* Feed URL
*/
url: string;
[k: string]: unknown;
};
calendar?: {
/**
* Type of the feed
*/
type?: string;
/**
* Feed URL
*/
url: string;
[k: string]: unknown;
};
flickr?: {
/**
* Type of the feed
*/
type?: string;
/**
* Feed URL
*/
url: string;
[k: string]: unknown;
};
[k: string]: unknown;
};
/**
* Your project sites (links to GitHub, wikis or wherever your projects are hosted)
*/
projects?: string[];
/**
* Arbitrary links that you'd like to share
*/
links?: {
/**
* The link name
*/
name: string;
/**
* An extra field for a more detailed description of the link
*/
description?: string;
/**
* The URL
*/
url: string;
[k: string]: unknown;
}[];
/**
* A list of the different membership plans your hackerspace might have. Set the value according to your billing process. For example, if your membership fee is 10 per month, but you bill it yearly (aka. the member pays the fee once per year), set the amount to 120 an the billing_interval to yearly.
*/
membership_plans?: {
/**
* The name of the membership plan
*/
name: string;
/**
* How much does this plan cost?
*/
value: number;
/**
* What's the currency? It should be formatted according to <a href="https://en.wikipedia.org/wiki/ISO_4217" target="_blank">ISO 4217</a> short-code format.
*/
currency: string;
/**
* How often is the membership billed? If you select other, please specify in the description what your billing interval is.
*/
billing_interval: 'yearly' | 'monthly' | 'weekly' | 'daily' | 'hourly' | 'other';
/**
* A free form string
*/
description?: string;
[k: string]: unknown;
}[];
[k: string]: unknown;
}