fix(browser-extension): send user url

This commit is contained in:
wanhose 2024-09-07 12:17:06 +02:00
parent 6da1d0762b
commit b4a315e309
2 changed files with 3 additions and 4 deletions

View File

@ -65,13 +65,13 @@ const refreshData = (callback) => {
const report = async (message, tab, callback) => {
try {
const reason = message.reason;
const url = message.url;
const userAgent = message.userAgent;
const version = browser.runtime.getManifest().version;
const body = JSON.stringify({ reason, url: tab.url, userAgent, version });
const body = JSON.stringify({ reason, url, userAgent, version });
const headers = { 'Cache-Control': 'no-cache', 'Content-type': 'application/json' };
const url = `${apiUrl}/report/`;
const response = await fetch(url, { body, headers, method: 'POST' });
const response = await fetch(`${apiUrl}/report/`, { body, headers, method: 'POST' });
callback?.((await response.json()).data);
} catch {
console.error("Can't send report");

View File

@ -247,7 +247,6 @@ async function submitButtonClickHandler(event) {
const issueButton = dialog?.getElementsByClassName('report-dialog-issue-button')[0];
const submitView = dialog?.getElementsByClassName('report-dialog-submit-view')[0];
const userAgent = window.navigator.userAgent;
const issueUrl = await dispatch({ userAgent, reason: reasonText, url: urlText, type: 'REPORT' });
formView?.setAttribute('hidden', 'true');