diff --git a/database.json b/database.json index f7120eb..8436145 100644 --- a/database.json +++ b/database.json @@ -443,6 +443,12 @@ "domain": "staylibere.com", "selector": "[class*=\"LayoutCookieBanner_buttons\"] > button:last-child" }, + { + "action": "reset", + "domain": "thetvdb.com", + "property": "overflow", + "selector": "body" + }, { "action": "click", "domain": "twitch.tv", @@ -496,6 +502,7 @@ "||cmp.inmobi.com^", "||cmp.prisa.com^", "||cmp.uniconsent.com^", + "||cms.static-bahn.de/cms/consent-layer^", "||consent.cookiebot.com^", "||consent.cookiefirst.com^", "||consent.pdf24.org^", @@ -507,10 +514,12 @@ "||cp.as.com^", "||cp.inside-digital.de^", "||download.amd.com/OneTrust^", + "||driftingchef.com/static/*/Sticky2,ConsentManager", "||emp.bbci.co.uk^", "||eu.fastcmp.com^", "||forum.vorondesign.com/js/xf/notice.min.js^", "||gdpr-tcfv2.sp-prod.net^", + "||get.optad360.io/sf/*/plugin.min.js", "||ilims.de/typo3conf/ext/nb_cookie_banner^", "||itkadmin.de/_javascripts/cookiesolution/es_cookie_solution_sources_v2.js^", "||js.vxcdn.com/usercentrics-sdk^", @@ -13988,5 +13997,5 @@ "ytm-consent-bump-v2-renderer" ] }, - "version": "1728035398000" + "version": "1728300083309" } diff --git a/packages/api/src/routes/v3/report.ts b/packages/api/src/routes/v3/report.ts index 5aedf02..9fa1c89 100644 --- a/packages/api/src/routes/v3/report.ts +++ b/packages/api/src/routes/v3/report.ts @@ -32,28 +32,33 @@ export default (server: FastifyInstance, _options: RouteShorthandOptions, done: const ua = new UAParser(userAgent ?? '').getResult(); const hostname = new URL(url).hostname.split('.').slice(-3).join('.').replace('www.', ''); const existingIssues = await octokit.request('GET /search/issues', { - per_page: 1, + per_page: 50, q: `in:title+is:issue+repo:${environment.github.owner}/${environment.github.repo}+${hostname}`, }); - const existingIssue = existingIssues.data.items[0]; + const existingIssue = existingIssues.data.items.find( + (issue) => + hostname === issue.title && + (issue.state === 'open' || + (issue.state === 'closed' && issue.labels.some((label) => label.name === 'wontfix'))) + ); try { if (existingIssue) { if (existingIssue.state === 'closed') { await octokit.request('PATCH /repos/{owner}/{repo}/issues/{issue_number}', { - owner: environment.github.owner, - repo: environment.github.repo, issue_number: existingIssue.number, labels: ['bug'], + owner: environment.github.owner, + repo: environment.github.repo, state: 'open', }); } await octokit.request('POST /repos/{owner}/{repo}/issues/{issue_number}/comments', { + body: generateText(request.body, ua), + issue_number: existingIssue.number, owner: environment.github.owner, repo: environment.github.repo, - issue_number: existingIssue.number, - body: generateText(request.body, ua), }); reply.send({ @@ -69,7 +74,7 @@ export default (server: FastifyInstance, _options: RouteShorthandOptions, done: labels: ['bug'], owner: environment.github.owner, repo: environment.github.repo, - title: url, + title: hostname, }); reply.send({ diff --git a/packages/api/src/routes/v5/issues.ts b/packages/api/src/routes/v5/issues.ts index 54d937c..2d11f53 100644 --- a/packages/api/src/routes/v5/issues.ts +++ b/packages/api/src/routes/v5/issues.ts @@ -23,17 +23,17 @@ export default (server: FastifyInstance, _options: RouteShorthandOptions, done: try { const { hostname } = request.params; const existingIssues = await octokit.request('GET /search/issues', { - per_page: 1, + per_page: 50, q: `in:title+is:issue+repo:${environment.github.owner}/${environment.github.repo}+${hostname}`, }); - const existingIssue = existingIssues.data.items[0]; + const existingIssue = existingIssues.data.items.find( + (issue) => + hostname === issue.title && + (issue.state === 'open' || + (issue.state === 'closed' && issue.labels.some((label) => label.name === 'wontfix'))) + ); - if ( - existingIssue && - (existingIssue.state === 'open' || - (existingIssue.state === 'closed' && - existingIssue.labels.some((label) => label.name === 'wontfix'))) - ) { + if (existingIssue) { reply.send({ data: { flags: existingIssue.labels.map((label) => label.name), diff --git a/packages/api/src/routes/v5/report.ts b/packages/api/src/routes/v5/report.ts index 0436f94..5f2362c 100644 --- a/packages/api/src/routes/v5/report.ts +++ b/packages/api/src/routes/v5/report.ts @@ -28,31 +28,73 @@ export default (server: FastifyInstance, _options: RouteShorthandOptions, done: validatorCompiler, }, async (request, reply) => { - const { url, userAgent } = request.body; + const { reason, url, userAgent, version } = request.body; const ua = new UAParser(userAgent ?? '').getResult(); const hostname = new URL(url).hostname.split('.').slice(-3).join('.').replace('www.', ''); const existingIssues = await octokit.request('GET /search/issues', { - per_page: 1, + per_page: 50, q: `in:title+is:issue+repo:${environment.github.owner}/${environment.github.repo}+${hostname}`, }); - const existingIssue = existingIssues.data.items[0]; + const existingIssue = existingIssues.data.items.find((issue) => hostname === issue.title); try { if (existingIssue) { + if (existingIssue.labels.some((label) => label.name === 'wontfix')) { + reply.send({ + data: existingIssue.html_url, + errors: ['This issue has been marked as "wontfix" and will not be addressed.'], + success: false, + }); + return; + } + + if (existingIssue.state === 'open') { + reply.send({ + data: existingIssue.html_url, + errors: [ + 'This issue already exists. Please refer to the existing issue for updates.', + ], + success: false, + }); + return; + } + + await octokit.request('PATCH /repos/{owner}/{repo}/issues/{issue_number}', { + issue_number: existingIssue.number, + labels: ['bug'], + owner: environment.github.owner, + repo: environment.github.repo, + state: 'open', + }); + reply.send({ - errors: [`Issue already exists, ${existingIssue.html_url}`], - success: false, + data: existingIssue.html_url, + success: true, }); return; } const response = await octokit.request('POST /repos/{owner}/{repo}/issues', { assignees: [environment.github.owner], - body: generateText(request.body, ua), + body: [ + '## Issue information', + ...(ua.browser.name && ua.browser.version + ? ['#### 🖥️ Browser', `${ua.browser.name} (${ua.browser.version})`] + : []), + ...(ua.device.type && ua.device.vendor + ? ['#### 📱 Device', `${ua.device.vendor} (${ua.device.type})`] + : []), + '#### 📝 Reason', + reason, + '#### 🔗 URL', + url, + '#### 🏷️ Version', + version, + ].join('\n'), labels: ['bug'], owner: environment.github.owner, repo: environment.github.repo, - title: url, + title: hostname, }); reply.send({ @@ -70,21 +112,3 @@ export default (server: FastifyInstance, _options: RouteShorthandOptions, done: done(); }; - -function generateText(body: PostReportBody, ua: UAParser.IResult): string { - return [ - '## Issue information', - ...(ua.browser.name && ua.browser.version - ? ['#### 🖥️ Browser', `${ua.browser.name} (${ua.browser.version})`] - : []), - ...(ua.device.type && ua.device.vendor - ? ['#### 📱 Device', `${ua.device.vendor} (${ua.device.type})`] - : []), - '#### 📝 Reason', - body.reason, - '#### 🔗 URL', - body.url, - '#### 🏷️ Version', - body.version, - ].join('\n'); -}