Compare commits

...

5 commits

9 changed files with 1438 additions and 381 deletions

26
.stylelintrc.cjs Normal file
View file

@ -0,0 +1,26 @@
module.exports = {
extends: ["stylelint-config-standard"],
plugins: ["stylelint-plugin-defensive-css", "stylelint-plugin-logical-css"],
rules: {
"custom-property-empty-line-before": null,
"color-hex-length": "long",
"plugin/use-defensive-css": [true, {
"accidental-hover": false,
"background-repeat": true,
"custom-property-fallbacks": false,
"flex-wrapping": false,
"scroll-chaining": false,
"vendor-prefix-grouping": true
}],
"plugin/use-logical-properties-and-values": [true, {
"severity": "warning",
"disable-auto-fix": true,
"ignore": ["overflow-y", "overflow-x"]
}],
"plugin/use-logical-units": [true, {
"severity": "warning",
"disable-auto-fix": true,
"ignore": ["dvh", "dvw"]
}]
}
};

View file

@ -9,15 +9,18 @@ All notable changes to this project will be documented in this file.
- Add commitlint to enforce commit message format - Add commitlint to enforce commit message format
- Update the changelog automatically on every commit - Update the changelog automatically on every commit
- Improve colors, refactor css, support rtl lang - Improve colors, refactor css, support rtl lang
- Add `stylelint` and add check to lint script
### 🐛 Bug Fixes ### 🐛 Bug Fixes
- Correctly update the changelog on release - Correctly update the changelog on release
- Add newer version of `addon-linter` via override to support newer browser APIs
### 🚜 Refactor ### 🚜 Refactor
- Improve browser-polyfill inject - Improve browser-polyfill inject
- Move homepage url to config - Move homepage url to config
- Use `storage.session` instead of `storage.local`
### 📚 Documentation ### 📚 Documentation
@ -33,6 +36,8 @@ All notable changes to this project will be documented in this file.
- Update @commitlint/{cli,config-conventional} - Update @commitlint/{cli,config-conventional}
- Update @commitlint/{cli,config-conventional} - Update @commitlint/{cli,config-conventional}
- Update @commitlint/{cli,config-conventional,cz-commitlint}
- Update @commitlint/{cli,config-conventional,cz-commitlint}, git-cliff
## \[[0.9.2](https://gitea.usrspace.at/XimeX/usrspace-browser-addon/releases/tag/v0.9.2)] - 2023-05-24 ## \[[0.9.2](https://gitea.usrspace.at/XimeX/usrspace-browser-addon/releases/tag/v0.9.2)] - 2023-05-24

1747
package-lock.json generated

File diff suppressed because it is too large Load diff

View file

@ -1,27 +1,38 @@
{ {
"name": "usrspace-browser-addon", "name": "usrspace-browser-addon",
"description": "WebExtension for the Hacker-/Maker-Space /usr/space", "description": "WebExtension for the Hacker-/Maker-Space /usr/space",
"version": "0.9.2", "version": "0.9.3",
"dependencies": { "dependencies": {
"webextension-polyfill": "^0.10.0" "webextension-polyfill": "^0.10.0"
}, },
"devDependencies": { "devDependencies": {
"@commitlint/cli": "^17.6.7", "@commitlint/cli": "^17.7.1",
"@commitlint/config-conventional": "^17.6.7", "@commitlint/config-conventional": "^17.7.0",
"@commitlint/cz-commitlint": "^17.6.7", "@commitlint/cz-commitlint": "^17.7.1",
"@types/firefox-webext-browser": "^111.0.1", "@types/firefox-webext-browser": "^111.0.1",
"commitizen": "^4.3.0", "commitizen": "^4.3.0",
"git-cliff": "^1.2.0", "git-cliff": "^1.3.0",
"husky": "^8.0.3", "husky": "^8.0.3",
"stylelint": "^15.10.3",
"stylelint-config-standard": "^34.0.0",
"stylelint-plugin-defensive-css": "^0.8.1",
"stylelint-plugin-logical-css": "^0.13.2",
"web-ext": "^7.6.2" "web-ext": "^7.6.2"
}, },
"overrides": {
"web-ext@^7.6.2": {
"addons-linter": "^6.12.0"
}
},
"scripts": { "scripts": {
"copy-browser-polyfill": "cp node_modules/webextension-polyfill/dist/browser-polyfill.js src/browser-polyfill.js", "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]#import '\\./browser-polyfill\\.js';#\" src/*.js", "inject-browser-polyfill": "sed -i -r \"s#// \\[INJECT-BROWSER-POLYFILL]#import '\\./browser-polyfill\\.js';#\" src/*.js",
"uninject-browser-polyfill": "sed -i -r \"s#import '\\./browser-polyfill\\.js';#// \\[INJECT-BROWSER-POLYFILL]#\" src/*.js", "uninject-browser-polyfill": "sed -i -r \"s#import '\\./browser-polyfill\\.js';#// \\[INJECT-BROWSER-POLYFILL]#\" src/*.js",
"copy-version": "sed -i 's/^\t\"version\": \".*\",$/\t\"version\": \"'$(rg '^\t\"version\": \"(.+)\",$' -r '$1' < package.json)'\",/' src/manifest.json", "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", "update-changelog": "npm exec git-cliff > CHANGELOG.md",
"lint": "web-ext lint -w", "lint": "npm run lint:web-ext && npm run lint:css",
"lint:web-ext": "web-ext lint -w",
"lint:css": "stylelint \"src/*.css\"",
"test": "echo \"Error: no test specified\" && exit 0", "test": "echo \"Error: no test specified\" && exit 0",
"watch:firefox": "web-ext run -t firefox-desktop", "watch:firefox": "web-ext run -t firefox-desktop",
"watch:firefox-android": "web-ext run -t firefox-android", "watch:firefox-android": "web-ext run -t firefox-android",

View file

@ -9,10 +9,6 @@ browser.runtime.onInstalled.addListener(async (details) => {
} }
}); });
browser.runtime.onStartup.addListener(async () => {
await browser.storage.local.remove(['calendar', 'spaceApi']);
});
browser.alarms.onAlarm.addListener((alarm) => { browser.alarms.onAlarm.addListener((alarm) => {
if (alarm.name === 'fetchData') { if (alarm.name === 'fetchData') {
fetchNewData(); fetchNewData();
@ -68,13 +64,13 @@ async function fetchNewData() {
/** /**
* @type {import("../types").Storage} * @type {import("../types").Storage}
*/ */
const { spaceApi } = await browser.storage.local.get('spaceApi'); const { spaceApi } = await browser.storage.session.get('spaceApi');
if (spaceApi && spaceApi.state.open !== spaceApiJson.state.open) { if (spaceApi && spaceApi.state.open !== spaceApiJson.state.open) {
await createStatusChangedNotification(spaceApiJson.state.open); await createStatusChangedNotification(spaceApiJson.state.open);
} }
} }
await browser.storage.local.set({ await browser.storage.session.set({
calendar: calendarJson, calendar: calendarJson,
spaceApi: spaceApiJson, spaceApi: spaceApiJson,
}); });

View file

@ -2,6 +2,8 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this * 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/. */ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
/* stylelint-disable */
/* Global */ /* Global */
html, html,
body { body {

View file

@ -2,7 +2,7 @@
"manifest_version": 3, "manifest_version": 3,
"name": "__MSG_extensionName__", "name": "__MSG_extensionName__",
"description": "__MSG_extensionDescription__", "description": "__MSG_extensionDescription__",
"version": "0.9.2", "version": "0.9.3",
"icons": { "icons": {
"48": "icons/favicon.svg", "48": "icons/favicon.svg",
"96": "icons/favicon.svg" "96": "icons/favicon.svg"
@ -28,7 +28,7 @@
"browser_specific_settings": { "browser_specific_settings": {
"gecko": { "gecko": {
"id": "{c9a907ad-a047-4cf6-8b5d-95097d31aa5b}", "id": "{c9a907ad-a047-4cf6-8b5d-95097d31aa5b}",
"strict_min_version": "112.0" "strict_min_version": "115.0"
} }
} }
} }

View file

@ -48,7 +48,7 @@ body {
padding: 6px 12px; padding: 6px 12px;
color: var(--color); color: var(--color);
background-color: var(--background); background-color: var(--background);
font-family: 'Nunito Sans'; font-family: 'Nunito Sans', sans-serif;
} }
section.no-padding { section.no-padding {

View file

@ -57,7 +57,7 @@ async function init() {
/** /**
* @type {import("../types").Storage} * @type {import("../types").Storage}
*/ */
const { calendar, spaceApi } = await browser.storage.local.get(['calendar', 'spaceApi']); const { calendar, spaceApi } = await browser.storage.session.get(['calendar', 'spaceApi']);
if (calendar) { if (calendar) {
updateNextEvent(calendar); updateNextEvent(calendar);