Compare commits

...

2 Commits

Author SHA1 Message Date
Сергей Маринкевич 5708a8d9a0 add readme 4 months ago
Сергей Маринкевич af7be11eb2 add firefox support 4 months ago

1
.gitignore vendored

@ -1,3 +1,4 @@
*.swp
dist
node_modules
redmine-reactions.pem

@ -0,0 +1,18 @@
Build
=====
docker-compose run --rm builder npm run build:chrome
or
docker-compose run --rm builder npm run build:firefox
Signed
======
Needs AMO API key from Mozilla.
docker-compose run --rm \
-e AMO_JWT_ISSUER="$USER" \
-e AMO_JWT_SECRET="$SECRET" \
builder npm run package:firefox-signed

@ -0,0 +1,16 @@
{
"manifest_version": 3,
"name": "Redmine Reactions",
"version": "0.1.0",
"description": "Добавляет реакции на комментарии в локальном Redmine.",
"permissions": ["storage"],
"icons": {
"128": "public/icon.png"
},
"content_scripts": [
{
"matches": ["https://red.eltex.loc/issues/*"],
"js": ["src/content.tsx"]
}
]
}

@ -0,0 +1,24 @@
{
"manifest_version": 3,
"name": "Redmine Reactions",
"version": "0.1.0",
"description": "Добавляет реакции на комментарии в локальном Redmine.",
"permissions": [
"storage",
"https://your-domain.com/*"
],
"icons": {
"128": "public/icon.png"
},
"content_scripts": [
{
"matches": ["https://red.eltex.loc/issues/*"],
"js": ["src/content.tsx"]
}
],
"browser_specific_settings": {
"gecko": {
"id": "reactions@your-company.com"
}
}
}

5959
package-lock.json generated

File diff suppressed because it is too large Load Diff

@ -5,9 +5,17 @@
"type": "module",
"scripts": {
"dev": "vite",
"build": "tsc && vite build"
"build": "tsc && vite build",
"build:firefox": "cp manifest-firefox.json manifest.json && tsc && vite build",
"package:firefox": "npm run build:firefox && web-ext build --source-dir dist/ --overwrite-dest",
"package:firefox-signed": "echo -e 'nameserver 1.1.1.1\noptions single-request-reopen' > /etc/resolv.conf && npm run build:firefox && web-ext sign --source-dir dist/ --api-key=$AMO_JWT_ISSUER --api-secret=$AMO_JWT_SECRET",
"build:chrome": "cp manifest-chrome.json manifest.json && npm run build",
"package:chrome": "npm run build:chrome && crx3 dist/ --key redmine-reactions.pem --output dist/redmine-reactions.crx"
},
"dependencies": {
"webextension-polyfill": "^0.10.0",
"web-ext": "^7.8.0",
"crx3": "^1.1.2",
"emoji-picker-react": "^4.9.2",
"react": "^18.2.0",
"react-dom": "^18.2.0"
@ -17,8 +25,10 @@
"@types/chrome": "^0.0.254",
"@types/react": "^18.2.37",
"@types/react-dom": "^18.2.15",
"@types/webextension-polyfill": "^0.10.7",
"@vitejs/plugin-react": "^4.2.0",
"typescript": "^5.2.2",
"vite": "^5.0.0"
}
}

Binary file not shown.

Before

Width:  |  Height:  |  Size: 23 KiB

After

Width:  |  Height:  |  Size: 22 KiB

@ -1,5 +1,6 @@
import React, { useState, useEffect, useRef } from 'react';
import EmojiPicker, { EmojiClickData } from 'emoji-picker-react';
import browser from 'webextension-polyfill';
const API_BASE_URL = import.meta.env.VITE_API_BASE_URL;
@ -7,10 +8,10 @@ type CommentReactions = { [emoji: string]: string[] };
interface ReactionsProps { issueId: number; commentId: string; }
async function getAnonymousUserId(): Promise<string> {
const data = await chrome.storage.local.get('userId');
const data = await browser.storage.local.get('userId');
if (data.userId) return data.userId;
const newUserId = crypto.randomUUID();
await chrome.storage.local.set({ userId: newUserId });
await browser.storage.local.set({ userId: newUserId });
return newUserId;
}

@ -14,6 +14,8 @@
"noEmit": true,
"jsx": "react-jsx",
"types": ["vite/client", "webextension-polyfill"],
/* Linting */
"strict": true,
"noUnusedLocals": true,

Loading…
Cancel
Save