add firefox support
This commit is contained in:
@@ -1 +1,3 @@
|
|||||||
VITE_API_BASE_URL=https://redmine-reactions.marinkevich.ru
|
VITE_API_BASE_URL=https://redmine-reactions.marinkevich.ru
|
||||||
|
AMO_JWT_ISSUER=
|
||||||
|
AMO_JWT_SECRET=
|
||||||
|
|||||||
@@ -1,3 +1,4 @@
|
|||||||
*.swp
|
*.swp
|
||||||
dist
|
dist
|
||||||
node_modules
|
node_modules
|
||||||
|
redmine-reactions.pem
|
||||||
|
|||||||
@@ -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"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
Generated
+5959
File diff suppressed because it is too large
Load Diff
+11
-1
@@ -5,9 +5,17 @@
|
|||||||
"type": "module",
|
"type": "module",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"dev": "vite",
|
"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": {
|
"dependencies": {
|
||||||
|
"webextension-polyfill": "^0.10.0",
|
||||||
|
"web-ext": "^7.8.0",
|
||||||
|
"crx3": "^1.1.2",
|
||||||
"emoji-picker-react": "^4.9.2",
|
"emoji-picker-react": "^4.9.2",
|
||||||
"react": "^18.2.0",
|
"react": "^18.2.0",
|
||||||
"react-dom": "^18.2.0"
|
"react-dom": "^18.2.0"
|
||||||
@@ -17,8 +25,10 @@
|
|||||||
"@types/chrome": "^0.0.254",
|
"@types/chrome": "^0.0.254",
|
||||||
"@types/react": "^18.2.37",
|
"@types/react": "^18.2.37",
|
||||||
"@types/react-dom": "^18.2.15",
|
"@types/react-dom": "^18.2.15",
|
||||||
|
"@types/webextension-polyfill": "^0.10.7",
|
||||||
"@vitejs/plugin-react": "^4.2.0",
|
"@vitejs/plugin-react": "^4.2.0",
|
||||||
"typescript": "^5.2.2",
|
"typescript": "^5.2.2",
|
||||||
"vite": "^5.0.0"
|
"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 React, { useState, useEffect, useRef } from 'react';
|
||||||
import EmojiPicker, { EmojiClickData } from 'emoji-picker-react';
|
import EmojiPicker, { EmojiClickData } from 'emoji-picker-react';
|
||||||
|
import browser from 'webextension-polyfill';
|
||||||
|
|
||||||
const API_BASE_URL = import.meta.env.VITE_API_BASE_URL;
|
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; }
|
interface ReactionsProps { issueId: number; commentId: string; }
|
||||||
|
|
||||||
async function getAnonymousUserId(): Promise<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;
|
if (data.userId) return data.userId;
|
||||||
const newUserId = crypto.randomUUID();
|
const newUserId = crypto.randomUUID();
|
||||||
await chrome.storage.local.set({ userId: newUserId });
|
await browser.storage.local.set({ userId: newUserId });
|
||||||
return newUserId;
|
return newUserId;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -14,6 +14,8 @@
|
|||||||
"noEmit": true,
|
"noEmit": true,
|
||||||
"jsx": "react-jsx",
|
"jsx": "react-jsx",
|
||||||
|
|
||||||
|
"types": ["vite/client", "webextension-polyfill"],
|
||||||
|
|
||||||
/* Linting */
|
/* Linting */
|
||||||
"strict": true,
|
"strict": true,
|
||||||
"noUnusedLocals": true,
|
"noUnusedLocals": true,
|
||||||
|
|||||||
Reference in New Issue
Block a user