diff --git a/.editorconfig b/.editorconfig index 50d72c8..45dd978 100644 --- a/.editorconfig +++ b/.editorconfig @@ -3,7 +3,7 @@ # top-most EditorConfig file root = true -[*.{html,css,js,json,svg}] +[*.{html,css,js,json,svg,toml}] indent_style = tab indent_size = 2 end_of_line = lf diff --git a/CHANGELOG.md b/CHANGELOG.md index f8cde2e..e49add4 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,36 +5,41 @@ All notable changes to this project will be documented in this file. ## [unreleased] ### Features + - Add git-cliff to update the CHANGELOG.md ### Miscellaneous Tasks + - Update husky +- Improve CHANGELOG config +- Unify and improve codestyle ### Other -- Add pre-commit hook with husky +- Add pre-commit hook with husky ## [v0.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 - ## [v0.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 - ## [v0.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 @@ -44,52 +49,53 @@ All notable changes to this project will be documented in this file. - Remove persistent flag in manifest config - Open usrspace.at homepage on install - ## [v0.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 +- Change addon id to currently used one ## [v0.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 - ## [v0.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 - ## [v0.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 +- Update strict_min_version to 57.0 ## [v0.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 - ## [v0.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 @@ -101,10 +107,10 @@ All notable changes to this project will be documented in this file. - Unfiy codestyle - Cleanup data on startup - ## [v0.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 @@ -119,15 +125,16 @@ All notable changes to this project will be documented in this file. - Increase svg size - Set build filename - ## [v0.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 @@ -143,27 +150,28 @@ All notable changes to this project will be documented in this file. - Change icon - Remove old html code and load right svg - ## [v0.4](https://gitea.usrspace.at/XimeX/usrspace-browser-addon/releases/tag/v0.4) - 2019-10-04 ### Bug Fixes -- Fix wrong icon +- Fix wrong icon ## [v0.3](https://gitea.usrspace.at/XimeX/usrspace-browser-addon/releases/tag/v0.3) - 2019-10-04 ### Other -- Improve popup content +- Improve popup content ## [v0.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 @@ -183,5 +191,4 @@ All notable changes to this project will be documented in this file. - Combine updateBadge promises - Check for online/offline events if fetching should be enabled - diff --git a/README.md b/README.md index 6b63ac6..27f7749 100644 --- a/README.md +++ b/README.md @@ -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,6 +14,7 @@ - Quick-Links (Homepage, Wiki, Gitea, Nextcloud) ## Install + ```ssh $ git clone https://gitea.usrspace.at/XimeX/usrspace-browser-addon.git $ npm i -g web-ext @@ -20,6 +22,7 @@ $ npm i ``` ## Run / Develop / Debug + ```ssh $ npm run watch:{firefox|firefox-android|chromium} ``` @@ -27,6 +30,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 +38,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 +47,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 diff --git a/cliff.toml b/cliff.toml index 5211d68..a121118 100644 --- a/cliff.toml +++ b/cliff.toml @@ -11,16 +11,16 @@ All notable changes to this project will be documented in this file.\n # https://tera.netlify.app/docs/#introduction body = """ {% if version %}\ - ## [{{ version }}](https://gitea.usrspace.at/XimeX/usrspace-browser-addon/releases/tag/{{ version }}) - {{ timestamp | date(format="%Y-%m-%d") }} + ## [{{ version }}](https://gitea.usrspace.at/XimeX/usrspace-browser-addon/releases/tag/{{ version }}) - {{ timestamp | date(format="%Y-%m-%d") }} {% else %}\ - ## [unreleased] + ## [unreleased] {% endif %}\ {% for group, commits in commits | group_by(attribute="group") %} - ### {{ group | upper_first }} - {% for commit in commits %}\ - - {% if commit.breaking %}[**breaking**] {% endif %}{{ commit.message | upper_first | trim_end }} - {% endfor %}\ -{% endfor %}\n\n + ### {{ group | 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 @@ -38,24 +38,24 @@ filter_unconventional = false split_commits = false # regex for preprocessing the commit messages commit_preprocessors = [ - # { pattern = '\((\w+\s)?#([0-9]+)\)', replace = "([#${2}](https://github.com/orhun/git-cliff/issues/${2}))"}, # replace issue numbers + # { pattern = '\((\w+\s)?#([0-9]+)\)', replace = "([#${2}](https://github.com/orhun/git-cliff/issues/${2}))" }, # replace issue numbers ] # regex for parsing and grouping commits commit_parsers = [ - { message = "^feat", group = "Features"}, - { message = "^fix", group = "Bug Fixes"}, - { message = "^doc", group = "Documentation"}, - { message = "^perf", group = "Performance"}, - { message = "^refactor", group = "Refactor"}, - { message = "^style", group = "Styling"}, - { message = "^test", group = "Testing"}, - { message = "^chore\\(release\\): prepare for", skip = true}, - { message = "^chore", group = "Miscellaneous Tasks"}, - { body = ".*security", group = "Security"}, - { message = "^[0-9]+.[0-9]+.[0-9]+", skip = true}, - { message = "^release v0.[0-9]", skip = true}, - { message = "^Merge branch ", skip = true}, - { message = ".*", group = "Other", default_scope = "other"}, + { message = "^feat", group = "Features" }, + { message = "^fix", group = "Bug Fixes" }, + { message = "^doc", group = "Documentation" }, + { message = "^perf", group = "Performance" }, + { message = "^refactor", group = "Refactor" }, + { message = "^style", group = "Styling" }, + { message = "^test", group = "Testing" }, + { message = "^chore\\(release\\): prepare for", skip = true }, + { message = "^chore", group = "Miscellaneous Tasks" }, + { body = ".*security", group = "Security" }, + { message = "^[0-9]+.[0-9]+.[0-9]+", skip = true }, + { message = "^release v0.[0-9]", skip = true }, + { message = "^Merge branch ", skip = true }, + { message = ".*", group = "Other", default_scope = "other" }, ] # protect breaking changes from being skipped due to matching a skipping commit_parser protect_breaking_commits = false diff --git a/src/_locales/de/messages.json b/src/_locales/de/messages.json index 6bb20c7..06d2953 100644 --- a/src/_locales/de/messages.json +++ b/src/_locales/de/messages.json @@ -41,8 +41,8 @@ "stateNotificationMessage": { "message": "Space ist jetzt $STATE$.", "placeholders": { - "STATE" : { - "content" : "$1" + "STATE": { + "content": "$1" } } }, diff --git a/src/_locales/en/messages.json b/src/_locales/en/messages.json index 73c4a01..e867915 100644 --- a/src/_locales/en/messages.json +++ b/src/_locales/en/messages.json @@ -41,8 +41,8 @@ "stateNotificationMessage": { "message": "Space is now $STATE$.", "placeholders": { - "STATE" : { - "content" : "$1" + "STATE": { + "content": "$1" } } }, diff --git a/src/background.html b/src/background.html index 9adf49c..ed0229e 100644 --- a/src/background.html +++ b/src/background.html @@ -1,10 +1,10 @@ - - - /usr/space + + + /usr/space - - - + + + diff --git a/src/background.js b/src/background.js index 37a5ca6..598bb71 100644 --- a/src/background.js +++ b/src/background.js @@ -65,7 +65,7 @@ async function fetchNewData() { await setBadgeStatus(spaceApiJson.state.open, eventActive); - const {spaceApi} = await browser.storage.local.get('spaceApi'); + const { spaceApi } = await browser.storage.local.get('spaceApi'); if (spaceApi && spaceApi.state.open !== spaceApiJson.state.open) { await createStatusChangedNotification(spaceApiJson.state.open); } @@ -87,8 +87,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 }); } /** diff --git a/src/popup.css b/src/popup.css index f00dc8f..5fb4eb9 100644 --- a/src/popup.css +++ b/src/popup.css @@ -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 { diff --git a/src/popup.html b/src/popup.html index 01f0f1f..e3dd1e9 100644 --- a/src/popup.html +++ b/src/popup.html @@ -1,99 +1,99 @@ - - - /usr/space - + + + /usr/space + - - - - - - - - - - + + + +
+

+
+
+
+ + +
+
+

+
+
+
+
+

+
+
+
- - - + + + diff --git a/src/popup.js b/src/popup.js index 81a4ffc..0e05411 100644 --- a/src/popup.js +++ b/src/popup.js @@ -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,7 @@ async function init() { linkElement.addEventListener('click', linkElementClickListener); }); - const {calendar, spaceApi} = await browser.storage.local.get(['calendar', 'spaceApi']); + const { calendar, spaceApi } = await browser.storage.local.get(['calendar', 'spaceApi']); if (calendar) { updateNextEvent(calendar);