From 815bcd875c9093ecb0fde9e1526079fc0c95dc40 Mon Sep 17 00:00:00 2001 From: eranshmil Date: Wed, 20 Mar 2019 23:19:00 +0200 Subject: [PATCH] chore: temporary disable reporter key --- package.json | 2 +- src/background.ts | 4 +++- src/core/api-service.ts | 6 +++--- src/core/bot.ts | 32 ++++++++++++++++---------------- src/manifest.json | 4 ++-- src/styles/_modal.scss | 6 +++--- src/templates/report-modal.html | 4 ++-- 7 files changed, 30 insertions(+), 28 deletions(-) diff --git a/package.json b/package.json index 6f7edb0..77f9df3 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "botz", "description": "Recognizes suspicious social media behavior.", - "version": "1.0.0", + "version": "1.0.5", "repository": "https://github.com/botim/botz.git", "license": "GPL-3.0", "scripts": { diff --git a/src/background.ts b/src/background.ts index e78fe38..e2e2755 100644 --- a/src/background.ts +++ b/src/background.ts @@ -18,7 +18,9 @@ browser.runtime.onMessage.addListener((message, _, respond) => { } if (message.type === MessageTypes.REPORT) { - const { reporterKey, ...body } = message.body; + // const { reporterKey, ...body } = message.body; + const { body } = message; + const reporterKey = 'Bots-R-us'; return onReportMessage(body, reporterKey); } }); diff --git a/src/core/api-service.ts b/src/core/api-service.ts index c757f0e..6b7bc2b 100644 --- a/src/core/api-service.ts +++ b/src/core/api-service.ts @@ -28,9 +28,9 @@ export class ApiService { } public async report(body: any): Promise { - if (!body.reporterKey) { - throw new Error('מפתח מדווח חסר או שגוי'); - } + // if (!body.reporterKey) { + // throw new Error('מפתח מדווח חסר או שגוי'); + // } const responseStatus: number = await window.browser.runtime.sendMessage({ type: MessageTypes.REPORT, diff --git a/src/core/bot.ts b/src/core/bot.ts index c7c56b3..ea6956b 100644 --- a/src/core/bot.ts +++ b/src/core/bot.ts @@ -10,7 +10,7 @@ import { import { ObjectKeyMap, UserData } from './symbols'; import { Parser } from '../parsers'; -const STORAGE_REPORTER_KEY = 'botzReporterKey'; +// const STORAGE_REPORTER_KEY = 'botzReporterKey'; /** * Create a link element to report a user. @@ -29,11 +29,11 @@ export function createReportButton(parser: Parser): HTMLElement { if (input) { try { - window.localStorage[STORAGE_REPORTER_KEY] = input.reporterKey; + // window.localStorage[STORAGE_REPORTER_KEY] = input.reporterKey; await parser.reportUser(input); } catch (error) { - delete window.localStorage[STORAGE_REPORTER_KEY]; - openModal('invalid-reporter-key'); + // delete window.localStorage[STORAGE_REPORTER_KEY]; + // openModal('invalid-reporter-key'); } } }); @@ -65,17 +65,17 @@ export async function loadTemplate(name: string, data?: Partial): Prom * If there's already a reporter key in local storage, * set it in form and hide reporter key input */ -function initReporterKeyInput(modalWrapperElement: Element) { - const reporterKeyInput: HTMLInputElement = modalWrapperElement.querySelector( - '[name="reporterKey"]' - ); - const reporterKey = window.localStorage[STORAGE_REPORTER_KEY] || null; - - if (reporterKey) { - reporterKeyInput.value = reporterKey; - reporterKeyInput.classList.add(MODAL_HIDE_REPORTER_KEY_CLASS); - } -} +// function initReporterKeyInput(modalWrapperElement: Element) { +// const reporterKeyInput: HTMLInputElement = modalWrapperElement.querySelector( +// '[name="reporterKey"]' +// ); +// const reporterKey = window.localStorage[STORAGE_REPORTER_KEY] || null; + +// if (reporterKey) { +// reporterKeyInput.value = reporterKey; +// reporterKeyInput.classList.add(MODAL_HIDE_REPORTER_KEY_CLASS); +// } +// } /** * Open modal on the screen and send form data to server. @@ -124,7 +124,7 @@ export async function openModal( .querySelector(`.${MODAL_CLOSE_CLASS}`) .addEventListener('click', () => modalWrapperElement.remove()); - initReporterKeyInput(modalWrapperElement); + // initReporterKeyInput(modalWrapperElement); }); } diff --git a/src/manifest.json b/src/manifest.json index 05d653a..65ca137 100644 --- a/src/manifest.json +++ b/src/manifest.json @@ -1,8 +1,8 @@ { "manifest_version": 2, "name": "Botz", - "version": "1.0", - "description": "Recognizes suspicious social media behavior.", + "version": "1.0.5", + "description": "פרויקט הבוטים הגדול מוקדש לזהות פעילויות לא אורגניות בפלטפורמות החברתיות.", "icons": { "16": "images/icon16.png", "48": "images/icon48.png", diff --git a/src/styles/_modal.scss b/src/styles/_modal.scss index 55bad3b..91137b9 100644 --- a/src/styles/_modal.scss +++ b/src/styles/_modal.scss @@ -57,7 +57,7 @@ margin: 0 0 12px 0; } - input[name='reporterKey'].hidden { - display: none; - } + // input[name='reporterKey'].hidden { + // display: none; + // } } diff --git a/src/templates/report-modal.html b/src/templates/report-modal.html index 57b2f9b..069a7eb 100644 --- a/src/templates/report-modal.html +++ b/src/templates/report-modal.html @@ -3,9 +3,9 @@
מדוע אתם מדווחים על החשבון {{ username }}?
-

+