mozilla / addons

☂ Umbrella repository for Mozilla Addons ✨
Other
125 stars 41 forks source link

Please return a full file from the Compare API when there are no changes #6736

Closed bobsilverberg closed 5 years ago

bobsilverberg commented 5 years ago

Currently the Compare API returns an empty file for the file contents when there are no changes. Instead of that could it please return the full contents of the file, with all lines showing as unchanged?

This will fix https://github.com/mozilla/addons-code-manager/issues/831 and should also help with the work on https://github.com/mozilla/addons-code-manager/issues/672.

kumar303 commented 5 years ago

@EnTeQuAk the API response below for an unmodified file is still returning diff: null. That should be a diff with the fake hunk you added, right? I'm re-opening this just so we don't lose track of it but let me know if I should open a separate issue.

https://addons-dev.allizom.org/api/v5/reviewers/addon/502868/versions/1541685/compare_to/1688187/?file=Grammarly.html&lang=en-US
Full response ```js { "id": 1688187, "channel": "listed", "compatibility": { "firefox": { "min": "57.0", "max": "*" } }, "edit_url": "https://addons-dev.allizom.org/en-US/developers/addon/grammarly-for-dev/versions/1688187", "is_strict_compatibility_enabled": false, "license": { "id": 3338, "is_custom": false, "name": null, "text": { "en-US": "This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0. If a copy of the MPL was not distributed with this file, You can obtain one at http://mozilla.org/MPL/2.0/." }, "url": "http://www.mozilla.org/MPL/2.0/" }, "release_notes": null, "reviewed": null, "version": "8.846.200a9", "file": { "id": 408848, "created": "2019-05-21T11:40:33Z", "hash": "sha256:9cd00167efdbfad37b08916f592d3114f1819979303eacb561f98500b2d9b8b5", "is_restart_required": false, "is_webextension": true, "is_mozilla_signed_extension": false, "platform": "all", "size": 5014747, "status": "public", "url": "https://addons-dev.allizom.org/firefox/downloads/file/408848/grammarly_for_firefox-8.846.200a9-fx.xpi?src=", "permissions": [ "", "tabs", "notifications", "cookies", "clipboardWrite", "storage", "activeTab", "background", "bookmarks", "contextMenus", "history", "pageCapture", "sessions" ], "diff": null, "entries": { "Grammarly.html": { "depth": 0, "filename": "Grammarly.html", "sha256": "0d082a84227a90611d7d2e8bb16bddd16cbc1cf830584bbc5fb33661bd33ef52", "mime_category": "text", "mimetype": "text/html", "path": "Grammarly.html", "size": 71, "modified": "2019-05-21T11:45:22Z", "status": "" }, "META-INF": { "depth": 0, "filename": "META-INF", "sha256": "", "mime_category": "directory", "mimetype": "application/octet-stream", "path": "META-INF", "size": null, "modified": "2019-05-21T11:45:22Z", "status": "" }, "META-INF/cose.manifest": { "depth": 1, "filename": "cose.manifest", "sha256": "246d8902e1972629870da05d07b41d85b2b6212e5c78b2a4471b597265f7a560", "mime_category": "binary", "mimetype": "application/x-ms-manifest", "path": "META-INF/cose.manifest", "size": 6411, "modified": "2019-05-21T11:45:22Z", "status": "A" }, "META-INF/cose.sig": { "depth": 1, "filename": "cose.sig", "sha256": "f961627b5487caa639bf53cdcceee328073369d6bf16aacdab8e924ea464db5e", "mime_category": "binary", "mimetype": "application/octet-stream", "path": "META-INF/cose.sig", "size": 3128, "modified": "2019-05-21T11:45:22Z", "status": "A" }, "META-INF/manifest.mf": { "depth": 1, "filename": "manifest.mf", "sha256": "7c1ec1561a45b84dfce96e4ed9b903651fbe7448b8983cfbcaf8c061f5f056f7", "mime_category": "binary", "mimetype": null, "path": "META-INF/manifest.mf", "size": 6732, "modified": "2019-05-21T11:45:22Z", "status": "M" }, "META-INF/mozilla.rsa": { "depth": 1, "filename": "mozilla.rsa", "sha256": "54fe13fa2b120c6ef352dd82695ec92f92b0e25810f18e62e80c977365df0899", "mime_category": "binary", "mimetype": "application/octet-stream", "path": "META-INF/mozilla.rsa", "size": 4341, "modified": "2019-05-21T11:45:22Z", "status": "M" }, "META-INF/mozilla.sf": { "depth": 1, "filename": "mozilla.sf", "sha256": "a85e0e1d910cf548e5ac2d1b850ff64ce608baf664459b79ccb932851fddfcaf", "mime_category": "binary", "mimetype": null, "path": "META-INF/mozilla.sf", "size": 144, "modified": "2019-05-21T11:45:22Z", "status": "M" }, "manifest.json": { "depth": 0, "filename": "manifest.json", "sha256": "a5e0425fb150243a77b5193ceac78c6d8fcd5ac03fd56694e650474b564d0cee", "mime_category": "text", "mimetype": "application/json", "path": "manifest.json", "size": 1505, "modified": "2019-05-21T11:45:22Z", "status": "M" }, "src": { "depth": 0, "filename": "src", "sha256": "", "mime_category": "directory", "mimetype": "application/octet-stream", "path": "src", "size": null, "modified": "2019-05-21T11:45:22Z", "status": "" }, "src/css": { "depth": 1, "filename": "css", "sha256": "", "mime_category": "directory", "mimetype": "application/octet-stream", "path": "src/css", "size": null, "modified": "2019-05-21T11:45:22Z", "status": "" }, "src/css/Grammarly-popup.styles.css": { "depth": 2, "filename": "Grammarly-popup.styles.css", "sha256": "759bac3a7e7d6804ec7d67f56903098ef751c18950b49414314efba98f3a7a05", "mime_category": "text", "mimetype": "text/css", "path": "src/css/Grammarly-popup.styles.css", "size": 634450, "modified": "2019-05-21T11:45:22Z", "status": "" }, "src/css/Grammarly-signin.styles.css": { "depth": 2, "filename": "Grammarly-signin.styles.css", "sha256": "7afbe58a2166dac89352e964a06610ae6f93adfb1a0aee42152ced3a3f997b2d", "mime_category": "text", "mimetype": "text/css", "path": "src/css/Grammarly-signin.styles.css", "size": 130422, "modified": "2019-05-21T11:45:22Z", "status": "" }, "src/css/Grammarly.styles.css": { "depth": 2, "filename": "Grammarly.styles.css", "sha256": "5d03f618d99944a96a11fb99dff8a97118a385a1085c4cbe4199bd2eebd4267b", "mime_category": "text", "mimetype": "text/css", "path": "src/css/Grammarly.styles.css", "size": 1982025, "modified": "2019-05-21T11:45:22Z", "status": "" }, "src/css/modal.css": { "depth": 2, "filename": "modal.css", "sha256": "f6333a92ef1181e2710320c953b02ed8ac60858c4a6a5ba2a3e02fcb5cd5045b", "mime_category": "text", "mimetype": "text/css", "path": "src/css/modal.css", "size": 930, "modified": "2019-05-21T11:45:22Z", "status": "A" }, "src/css/modal.js": { "depth": 2, "filename": "modal.js", "sha256": "bac66881a6971d2693ba085a4c811610fef970f11b93af202d94427f588bce51", "mime_category": "text", "mimetype": "text/javascript", "path": "src/css/modal.js", "size": 2033, "modified": "2019-05-21T11:45:22Z", "status": "A" }, "src/css/popup.css": { "depth": 2, "filename": "popup.css", "sha256": "87c860720e842069381750f80e15207865915c0e999674eb3bee13b363b59fd7", "mime_category": "text", "mimetype": "text/css", "path": "src/css/popup.css", "size": 3102, "modified": "2019-05-21T11:45:22Z", "status": "A" }, "src/icon": { "depth": 1, "filename": "icon", "sha256": "", "mime_category": "directory", "mimetype": "application/octet-stream", "path": "src/icon", "size": null, "modified": "2019-05-21T11:45:22Z", "status": "" }, "src/icon/icon100.png": { "depth": 2, "filename": "icon100.png", "sha256": "30aebc0c5c085c5324179130461bc1406ecba5f1b7162495703aa9073c80db29", "mime_category": "image", "mimetype": "image/png", "path": "src/icon/icon100.png", "size": 3273, "modified": "2019-05-21T11:45:22Z", "status": "" }, "src/icon/icon128-edge.png": { "depth": 2, "filename": "icon128-edge.png", "sha256": "75011a7c2eba7fffff28ceee77e1fd0ef37535c05f91cc8ddc6c6dd23c0b02f3", "mime_category": "image", "mimetype": "image/png", "path": "src/icon/icon128-edge.png", "size": 5927, "modified": "2019-05-21T11:45:22Z", "status": "" }, "src/icon/icon128.png": { "depth": 2, "filename": "icon128.png", "sha256": "70a6f8413be000c36d4e350f02887330062f097ac2ca6a2f3e5d3c8d04c4833a", "mime_category": "image", "mimetype": "image/png", "path": "src/icon/icon128.png", "size": 5430, "modified": "2019-05-21T11:45:22Z", "status": "" }, "src/icon/icon16-bang.png": { "depth": 2, "filename": "icon16-bang.png", "sha256": "d33d48e4bb13e35351dc3b279ef79d34130ff66fd4caaf22662a9967a2932342", "mime_category": "image", "mimetype": "image/png", "path": "src/icon/icon16-bang.png", "size": 737, "modified": "2019-05-21T11:45:22Z", "status": "" }, "src/icon/icon16.png": { "depth": 2, "filename": "icon16.png", "sha256": "d6fdb4df70db60fca627da8dae88f86decbe18e5abc321e507ccc7a0f210ac96", "mime_category": "image", "mimetype": "image/png", "path": "src/icon/icon16.png", "size": 1273, "modified": "2019-05-21T11:45:22Z", "status": "" }, "src/icon/icon19-bang.png": { "depth": 2, "filename": "icon19-bang.png", "sha256": "d92f535004f1228062fa9c8b745ec786582848084ecfc49cb040e79d5aedd32d", "mime_category": "image", "mimetype": "image/png", "path": "src/icon/icon19-bang.png", "size": 936, "modified": "2019-05-21T11:45:22Z", "status": "" }, "src/icon/icon19.png": { "depth": 2, "filename": "icon19.png", "sha256": "e84909e65bdc9cdf0309ae8e5e115b9f48910cc63f233ac037e2f959182eaee9", "mime_category": "image", "mimetype": "image/png", "path": "src/icon/icon19.png", "size": 761, "modified": "2019-05-21T11:45:22Z", "status": "" }, "src/icon/icon20-edge.png": { "depth": 2, "filename": "icon20-edge.png", "sha256": "50ff14b3da7b7fb8980fc55e348a052b7c3fac31b0455bfee9b5e094f4c954e6", "mime_category": "image", "mimetype": "image/png", "path": "src/icon/icon20-edge.png", "size": 752, "modified": "2019-05-21T11:45:22Z", "status": "" }, "src/icon/icon32-bang.png": { "depth": 2, "filename": "icon32-bang.png", "sha256": "d92f535004f1228062fa9c8b745ec786582848084ecfc49cb040e79d5aedd32d", "mime_category": "image", "mimetype": "image/png", "path": "src/icon/icon32-bang.png", "size": 936, "modified": "2019-05-21T11:45:22Z", "status": "" }, "src/icon/icon32-safari-bang.png": { "depth": 2, "filename": "icon32-safari-bang.png", "sha256": "e9ea8b20220a1c7d726435937501e7fa6d359a610c4cabff87f0f885f0a17baf", "mime_category": "image", "mimetype": "image/png", "path": "src/icon/icon32-safari-bang.png", "size": 1628, "modified": "2019-05-21T11:45:22Z", "status": "" }, "src/icon/icon32-safari-off.png": { "depth": 2, "filename": "icon32-safari-off.png", "sha256": "e9ea8b20220a1c7d726435937501e7fa6d359a610c4cabff87f0f885f0a17baf", "mime_category": "image", "mimetype": "image/png", "path": "src/icon/icon32-safari-off.png", "size": 1628, "modified": "2019-05-21T11:45:22Z", "status": "" }, "src/icon/icon32.png": { "depth": 2, "filename": "icon32.png", "sha256": "95359496f14271f5494ef968606acc8dd581ceac912025e461a7993aa5c813a4", "mime_category": "image", "mimetype": "image/png", "path": "src/icon/icon32.png", "size": 1325, "modified": "2019-05-21T11:45:22Z", "status": "" }, "src/icon/icon38-bang.png": { "depth": 2, "filename": "icon38-bang.png", "sha256": "6f3b214a809f257e84f1906526b7b5e7bc625b7b644f17567635e5be0ae921ae", "mime_category": "image", "mimetype": "image/png", "path": "src/icon/icon38-bang.png", "size": 2077, "modified": "2019-05-21T11:45:22Z", "status": "" }, "src/icon/icon38.png": { "depth": 2, "filename": "icon38.png", "sha256": "e60f8c9972e4005ecb8c6730ba3f9e2fbc27e26ca6727a2a1b542edac190981d", "mime_category": "image", "mimetype": "image/png", "path": "src/icon/icon38.png", "size": 1613, "modified": "2019-05-21T11:45:22Z", "status": "" }, "src/icon/icon40-edge.png": { "depth": 2, "filename": "icon40-edge.png", "sha256": "28eb18f3c7c2a00d64ff5e1f3316f44542264ccef2b8364f24cc3bafe188e5de", "mime_category": "image", "mimetype": "image/png", "path": "src/icon/icon40-edge.png", "size": 1599, "modified": "2019-05-21T11:45:22Z", "status": "" }, "src/icon/icon48-chrome.png": { "depth": 2, "filename": "icon48-chrome.png", "sha256": "dbff979df435c51ce2c6a6044494112f307771d2815db90ee6de156bf6129dda", "mime_category": "image", "mimetype": "image/png", "path": "src/icon/icon48-chrome.png", "size": 2682, "modified": "2019-05-21T11:45:22Z", "status": "" }, "src/icon/icon48.png": { "depth": 2, "filename": "icon48.png", "sha256": "4b40db5f47a0813272e54bac926fc8138567237ba798eb48217b940492d859f7", "mime_category": "image", "mimetype": "image/png", "path": "src/icon/icon48.png", "size": 1954, "modified": "2019-05-21T11:45:22Z", "status": "" }, "src/icon/icon64-bang.png": { "depth": 2, "filename": "icon64-bang.png", "sha256": "abeb55d4ae65ae876aa689b6b53782c893d5c5330f1558bb7b4f2cee52ebc8b0", "mime_category": "image", "mimetype": "image/png", "path": "src/icon/icon64-bang.png", "size": 3563, "modified": "2019-05-21T11:45:22Z", "status": "" }, "src/icon/icon64.png": { "depth": 2, "filename": "icon64.png", "sha256": "c0d8f2d0da492221952a8e76a018e94b01c4da3f3ad888ae277d4e88848a5d3e", "mime_category": "image", "mimetype": "image/png", "path": "src/icon/icon64.png", "size": 2625, "modified": "2019-05-21T11:45:22Z", "status": "" }, "src/js": { "depth": 1, "filename": "js", "sha256": "", "mime_category": "directory", "mimetype": "application/octet-stream", "path": "src/js", "size": null, "modified": "2019-05-21T11:45:22Z", "status": "" }, "src/js/Grammarly-bg.js": { "depth": 2, "filename": "Grammarly-bg.js", "sha256": "2b00692a31e73e3669caaaa04d544188afbd73f52af414d1d85cb742b1ed3d35", "mime_category": "text", "mimetype": "text/javascript", "path": "src/js/Grammarly-bg.js", "size": 813750, "modified": "2019-05-21T11:45:22Z", "status": "M" }, "src/js/Grammarly-bg.styles.js": { "depth": 2, "filename": "Grammarly-bg.styles.js", "sha256": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", "mime_category": "text", "mimetype": "text/javascript", "path": "src/js/Grammarly-bg.styles.js", "size": 0, "modified": "2019-05-21T11:45:22Z", "status": "" }, "src/js/Grammarly-popup.js": { "depth": 2, "filename": "Grammarly-popup.js", "sha256": "95df9e4f2b23c1fa58fdd9b3b5e50c0f2fcfafdb781063eef0951c1555d1adcf", "mime_category": "text", "mimetype": "text/javascript", "path": "src/js/Grammarly-popup.js", "size": 383294, "modified": "2019-05-21T11:45:22Z", "status": "" }, "src/js/Grammarly-popup.styles.js": { "depth": 2, "filename": "Grammarly-popup.styles.js", "sha256": "d7a82c7126ad6b472c13d3a77cc3e20da566e7e2849fd32a1f47fec97734364d", "mime_category": "text", "mimetype": "text/javascript", "path": "src/js/Grammarly-popup.styles.js", "size": 635384, "modified": "2019-05-21T11:45:22Z", "status": "" }, "src/js/Grammarly-signin.js": { "depth": 2, "filename": "Grammarly-signin.js", "sha256": "dd6b4445899e29a5ad3dcd201bd94f75f214efd98489f7d97dc64b30cc68c91d", "mime_category": "text", "mimetype": "text/javascript", "path": "src/js/Grammarly-signin.js", "size": 323020, "modified": "2019-05-21T11:45:22Z", "status": "" }, "src/js/Grammarly-signin.styles.js": { "depth": 2, "filename": "Grammarly-signin.styles.js", "sha256": "497404673a9ac1b62e0240554bf0783aded0c31b1151175af93f1d0d15f40179", "mime_category": "text", "mimetype": "text/javascript", "path": "src/js/Grammarly-signin.styles.js", "size": 132073, "modified": "2019-05-21T11:45:22Z", "status": "" }, "src/js/Grammarly.js": { "depth": 2, "filename": "Grammarly.js", "sha256": "1a3172fa95370ca8d4823e358ca624df1d117217883549101416e848b5b25c69", "mime_category": "binary", "mimetype": "application/octet-stream", "path": "src/js/Grammarly.js", "size": 1315927, "modified": "2019-05-21T11:45:22Z", "status": "M" }, "src/js/Grammarly.styles.js": { "depth": 2, "filename": "Grammarly.styles.js", "sha256": "82197e4a16e36f264df653ca0b904bd73aeff051db5db149c1b7d75774a66b2f", "mime_category": "text", "mimetype": "text/javascript", "path": "src/js/Grammarly.styles.js", "size": 1988823, "modified": "2019-05-21T11:45:22Z", "status": "" }, "src/js/Person.java": { "depth": 2, "filename": "Person.java", "sha256": "12e69588a061e7fabb55b64008c2401a9acdc11227e0ce5c4b2c0ecdb7e5af97", "mime_category": "text", "mimetype": "text/x-c", "path": "src/js/Person.java", "size": 2118, "modified": "2019-05-21T11:45:22Z", "status": "A" }, "src/js/editor-popup.js": { "depth": 2, "filename": "editor-popup.js", "sha256": "c89c8df5b46b29ea3c3e19c450a52368d85d1846859a34bb09087b4c3b17b82c", "mime_category": "text", "mimetype": "text/html", "path": "src/js/editor-popup.js", "size": 1967683, "modified": "2019-05-21T11:45:22Z", "status": "M" }, "src/popup.html": { "depth": 1, "filename": "popup.html", "sha256": "dedad09f0690afd1a7d06abb28b14881c0b99134a25548344d714379f9bff48c", "mime_category": "text", "mimetype": "text/html", "path": "src/popup.html", "size": 413, "modified": "2019-05-21T11:45:22Z", "status": "" }, "src/signin.html": { "depth": 1, "filename": "signin.html", "sha256": "77990568f11986b95e00bed6d496045e2bc83c4a704d93fe7393be7f70cc6fc4", "mime_category": "text", "mimetype": "text/html", "path": "src/signin.html", "size": 286, "modified": "2019-05-21T11:45:22Z", "status": "" }, "src/icon/favicon.ico": { "depth": 2, "filename": "favicon.ico", "sha256": null, "mime_category": null, "mimetype": "image/vnd.microsoft.icon", "path": "src/icon/favicon.ico", "size": null, "modified": null, "status": "D" }, "src/icon/icon176-edge.png": { "depth": 2, "filename": "icon176-edge.png", "sha256": null, "mime_category": null, "mimetype": "image/png", "path": "src/icon/icon176-edge.png", "size": null, "modified": null, "status": "D" }, "src/icon/icon24-edge.png": { "depth": 2, "filename": "icon24-edge.png", "sha256": null, "mime_category": null, "mimetype": "image/png", "path": "src/icon/icon24-edge.png", "size": null, "modified": null, "status": "D" }, "src/icon/icon32-safari-new.png": { "depth": 2, "filename": "icon32-safari-new.png", "sha256": null, "mime_category": null, "mimetype": "image/png", "path": "src/icon/icon32-safari-new.png", "size": null, "modified": null, "status": "D" }, "src/icon/icon32-safari.png": { "depth": 2, "filename": "icon32-safari.png", "sha256": null, "mime_category": null, "mimetype": "image/png", "path": "src/icon/icon32-safari.png", "size": null, "modified": null, "status": "D" }, "src/icon/icon48-edge.png": { "depth": 2, "filename": "icon48-edge.png", "sha256": null, "mime_category": null, "mimetype": "image/png", "path": "src/icon/icon48-edge.png", "size": null, "modified": null, "status": "D" } }, "selected_file": "Grammarly.html", "download_url": "https://addons-dev.allizom.org/en-US/reviewers/download-git-file/1688187/Grammarly.html/" }, "validation_url": "https://addons-dev.allizom.org/en-US/developers/addon/grammarly-for-dev/file/408848/validation", "validation_url_json": "https://addons-dev.allizom.org/en-US/developers/addon/grammarly-for-dev/file/408848/validation.json", "has_been_validated": true, "addon": { "id": 502868, "slug": "grammarly-for-dev", "name": { "en-US": "Grammarly for Firefox" }, "icon_url": "https://addons-dev-cdn.allizom.org/static/img/addon-icons/default-64.png" } } ```
EnTeQuAk commented 5 years ago

Yeah, I'll look into this and see if this needs a separate issue or not.

EnTeQuAk commented 5 years ago

@EnTeQuAk the API response below for an unmodified file is still returning diff: null

The problem was a cache-layer I had to put into the API that cached multiple calls to generating diffs (which we are to fetch all the information in various places). This got fixed and should be heading to dev any minute now.

ioanarusiczki commented 5 years ago

@EnTeQuAk My test results:

Samples I tested with https://code.addons-dev.allizom.org/en-US/browse/390151/versions/1688302/ https://code.addons.allizom.org/en-US/compare/1002795/versions/2474830...2474841/

An example

-dev https://addons-dev.allizom.org/api/v5/reviewers/addon/390151/versions/1688198/compare_to/1688302/?file=background.js

Full response ```js { "id": 1688302, "channel": "listed", "compatibility": { "firefox": { "min": "49.0", "max": "*" }, "android": { "min": "49.0", "max": "*" } }, "edit_url": "https://addons-dev.allizom.org/en-US/developers/addon/terms-of-service-didn-t-read/versions/1688302", "is_strict_compatibility_enabled": false, "license": { "id": 3338, "is_custom": false, "name": null, "text": { "en-US": "This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0. If a copy of the MPL was not distributed with this file, You can obtain one at http://mozilla.org/MPL/2.0/." }, "url": "http://www.mozilla.org/MPL/2.0/" }, "release_notes": null, "reviewed": null, "version": "2.0.6", "file": { "id": 408963, "created": "2019-06-14T13:10:08Z", "hash": "sha256:da256979ae77b959ecb072ef147d9b17c7a3066c19218fd533e1fa15a780accd", "is_restart_required": false, "is_webextension": true, "is_mozilla_signed_extension": false, "platform": "all", "size": 221061, "status": "public", "url": "https://addons-dev.allizom.org/firefox/downloads/file/408963/terms_of_service_didnt_read-2.0.6-an+fx.xpi?src=", "permissions": [ "*://tosdr.org/*", "tabs", "notifications", "storage" ], "diff": { "path": "background.js", "size": 0, "lines_added": 0, "lines_deleted": 0, "is_binary": false, "mode": " ", "hunks": [ { "header": "@@ -0 +0 @@", "old_start": 0, "new_start": 0, "old_lines": 111, "new_lines": 111, "changes": [ { "content": "/* global browser, localStorage, log, RATING_TEXT, getServices, getService, getIconForService */", "type": " ", "old_line_number": 0, "new_line_number": 0 }, { "content": "/* requires ./popup/js/servicedata.js */", "type": " ", "old_line_number": 1, "new_line_number": 1 }, { "content": "", "type": " ", "old_line_number": 2, "new_line_number": 2 }, { "content": "function checkNotification(service) {", "type": " ", "old_line_number": 3, "new_line_number": 3 }, { "content": " const last = localStorage.getItem(`notification/${service.name}/last/update`);", "type": " ", "old_line_number": 4, "new_line_number": 4 }, { "content": " const lastRate = localStorage.getItem(`notification/${service.name}/last/rate`);", "type": " ", "old_line_number": 5, "new_line_number": 5 }, { "content": " let shouldShow = false;", "type": " ", "old_line_number": 6, "new_line_number": 6 }, { "content": "", "type": " ", "old_line_number": 7, "new_line_number": 7 }, { "content": " if (!service.rated) { return; }", "type": " ", "old_line_number": 8, "new_line_number": 8 }, { "content": "", "type": " ", "old_line_number": 9, "new_line_number": 9 }, { "content": " const rate = service.rated;", "type": " ", "old_line_number": 10, "new_line_number": 10 }, { "content": " if (rate === 'D' || rate === 'E') {", "type": " ", "old_line_number": 11, "new_line_number": 11 }, { "content": " if (last) {", "type": " ", "old_line_number": 12, "new_line_number": 12 }, { "content": " const lastModified = parseInt(Date.parse(last), 10);", "type": " ", "old_line_number": 13, "new_line_number": 13 }, { "content": " log(lastModified);", "type": " ", "old_line_number": 14, "new_line_number": 14 }, { "content": " const daysSinceLast = (new Date().getTime() - lastModified) / (1000 * 60 * 60 * 24);", "type": " ", "old_line_number": 15, "new_line_number": 15 }, { "content": " log(daysSinceLast);", "type": " ", "old_line_number": 16, "new_line_number": 16 }, { "content": "", "type": " ", "old_line_number": 17, "new_line_number": 17 }, { "content": " if (daysSinceLast > 7) {", "type": " ", "old_line_number": 18, "new_line_number": 18 }, { "content": " shouldShow = true;", "type": " ", "old_line_number": 19, "new_line_number": 19 }, { "content": " }", "type": " ", "old_line_number": 20, "new_line_number": 20 }, { "content": " } else {", "type": " ", "old_line_number": 21, "new_line_number": 21 }, { "content": " shouldShow = true;", "type": " ", "old_line_number": 22, "new_line_number": 22 }, { "content": " }", "type": " ", "old_line_number": 23, "new_line_number": 23 }, { "content": " } else if (lastRate === 'D' || lastRate === 'E') {", "type": " ", "old_line_number": 24, "new_line_number": 24 }, { "content": " shouldShow = true;", "type": " ", "old_line_number": 25, "new_line_number": 25 }, { "content": " }", "type": " ", "old_line_number": 26, "new_line_number": 26 }, { "content": "", "type": " ", "old_line_number": 27, "new_line_number": 27 }, { "content": "", "type": " ", "old_line_number": 28, "new_line_number": 28 }, { "content": " if (shouldShow) {", "type": " ", "old_line_number": 29, "new_line_number": 29 }, { "content": " localStorage.setItem(`notification/${service.name}/last/update`, new Date().toDateString());", "type": " ", "old_line_number": 30, "new_line_number": 30 }, { "content": " localStorage.setItem(`notification/${service.name}/last/rate`, rate);", "type": " ", "old_line_number": 31, "new_line_number": 31 }, { "content": "", "type": " ", "old_line_number": 32, "new_line_number": 32 }, { "content": " browser.notifications.create('tosdr-notify', {", "type": " ", "old_line_number": 33, "new_line_number": 33 }, { "content": " type: 'basic',", "type": " ", "old_line_number": 34, "new_line_number": 34 }, { "content": " title: service.name,", "type": " ", "old_line_number": 35, "new_line_number": 35 }, { "content": " message: RATING_TEXT[rate],", "type": " ", "old_line_number": 36, "new_line_number": 36 }, { "content": " iconUrl: './icons/icon@2x.png',", "type": " ", "old_line_number": 37, "new_line_number": 37 }, { "content": " });", "type": " ", "old_line_number": 38, "new_line_number": 38 }, { "content": "", "type": " ", "old_line_number": 39, "new_line_number": 39 }, { "content": " browser.notifications.onClicked.addListener((notificationId) => {", "type": " ", "old_line_number": 40, "new_line_number": 40 }, { "content": " browser.notifications.clear(notificationId);", "type": " ", "old_line_number": 41, "new_line_number": 41 }, { "content": " browser.tabs.create({", "type": " ", "old_line_number": 42, "new_line_number": 42 }, { "content": " url: `https://tosdr.org/#${service.slug}`,", "type": " ", "old_line_number": 43, "new_line_number": 43 }, { "content": " });", "type": " ", "old_line_number": 44, "new_line_number": 44 }, { "content": " });", "type": " ", "old_line_number": 45, "new_line_number": 45 }, { "content": " }", "type": " ", "old_line_number": 46, "new_line_number": 46 }, { "content": "}", "type": " ", "old_line_number": 47, "new_line_number": 47 }, { "content": "", "type": " ", "old_line_number": 48, "new_line_number": 48 }, { "content": "/*", "type": " ", "old_line_number": 49, "new_line_number": 49 }, { "content": "Initialize the page action: set icon and title, then show.", "type": " ", "old_line_number": 50, "new_line_number": 50 }, { "content": "Only operates on tabs whose URL's protocol is applicable.", "type": " ", "old_line_number": 51, "new_line_number": 51 }, { "content": "*/", "type": " ", "old_line_number": 52, "new_line_number": 52 }, { "content": "function initializePageAction(tab) {", "type": " ", "old_line_number": 53, "new_line_number": 53 }, { "content": " // console.log('initializePageAction', tab);", "type": " ", "old_line_number": 54, "new_line_number": 54 }, { "content": " return getService(tab).then((service) => {", "type": " ", "old_line_number": 55, "new_line_number": 55 }, { "content": " // console.log('got service', service);", "type": " ", "old_line_number": 56, "new_line_number": 56 }, { "content": " if (service) {", "type": " ", "old_line_number": 57, "new_line_number": 57 }, { "content": " browser.pageAction.setIcon({", "type": " ", "old_line_number": 58, "new_line_number": 58 }, { "content": " tabId: tab.id,", "type": " ", "old_line_number": 59, "new_line_number": 59 }, { "content": " path: getIconForService(service),", "type": " ", "old_line_number": 60, "new_line_number": 60 }, { "content": " });", "type": " ", "old_line_number": 61, "new_line_number": 61 }, { "content": " browser.pageAction.setPopup({", "type": " ", "old_line_number": 62, "new_line_number": 62 }, { "content": " tabId: tab.id,", "type": " ", "old_line_number": 63, "new_line_number": 63 }, { "content": " popup: `popup/popup.html#${service.mainDomain}`,", "type": " ", "old_line_number": 64, "new_line_number": 64 }, { "content": " });", "type": " ", "old_line_number": 65, "new_line_number": 65 }, { "content": " browser.pageAction.show(tab.id);", "type": " ", "old_line_number": 66, "new_line_number": 66 }, { "content": " checkNotification(service);", "type": " ", "old_line_number": 67, "new_line_number": 67 }, { "content": " } else {", "type": " ", "old_line_number": 68, "new_line_number": 68 }, { "content": " browser.pageAction.setIcon({", "type": " ", "old_line_number": 69, "new_line_number": 69 }, { "content": " tabId: tab.id,", "type": " ", "old_line_number": 70, "new_line_number": 70 }, { "content": " path: 'icons/class/none.png',", "type": " ", "old_line_number": 71, "new_line_number": 71 }, { "content": " });", "type": " ", "old_line_number": 72, "new_line_number": 72 }, { "content": " browser.pageAction.setPopup({", "type": " ", "old_line_number": 73, "new_line_number": 73 }, { "content": " tabId: tab.id,", "type": " ", "old_line_number": 74, "new_line_number": 74 }, { "content": " popup: 'popup/popup.html#none',", "type": " ", "old_line_number": 75, "new_line_number": 75 }, { "content": " });", "type": " ", "old_line_number": 76, "new_line_number": 76 }, { "content": " browser.pageAction.show(tab.id);", "type": " ", "old_line_number": 77, "new_line_number": 77 }, { "content": " }", "type": " ", "old_line_number": 78, "new_line_number": 78 }, { "content": " }).catch((err) => {", "type": " ", "old_line_number": 79, "new_line_number": 79 }, { "content": " if (err.message === 'no domain name provided') {", "type": " ", "old_line_number": 80, "new_line_number": 80 }, { "content": " return;", "type": " ", "old_line_number": 81, "new_line_number": 81 }, { "content": " }", "type": " ", "old_line_number": 82, "new_line_number": 82 }, { "content": " console.error(err); // eslint-disable-line no-console", "type": " ", "old_line_number": 83, "new_line_number": 83 }, { "content": " });", "type": " ", "old_line_number": 84, "new_line_number": 84 }, { "content": "}", "type": " ", "old_line_number": 85, "new_line_number": 85 }, { "content": "", "type": " ", "old_line_number": 86, "new_line_number": 86 }, { "content": "getServices().then((services) => {", "type": " ", "old_line_number": 87, "new_line_number": 87 }, { "content": " browser.storage.local.set(services).then(() => {", "type": " ", "old_line_number": 88, "new_line_number": 88 }, { "content": " /* When first loaded, initialize the page action for all tabs.", "type": " ", "old_line_number": 89, "new_line_number": 89 }, { "content": " */", "type": " ", "old_line_number": 90, "new_line_number": 90 }, { "content": " const gettingAllTabs = browser.tabs.query({});", "type": " ", "old_line_number": 91, "new_line_number": 91 }, { "content": " return gettingAllTabs.then((tabs) => {", "type": " ", "old_line_number": 92, "new_line_number": 92 }, { "content": " tabs.forEach((t) => {", "type": " ", "old_line_number": 93, "new_line_number": 93 }, { "content": " // Only active tabs should get the pageAction", "type": " ", "old_line_number": 94, "new_line_number": 94 }, { "content": " if (t.active) {", "type": " ", "old_line_number": 95, "new_line_number": 95 }, { "content": " initializePageAction(t);", "type": " ", "old_line_number": 96, "new_line_number": 96 }, { "content": " }", "type": " ", "old_line_number": 97, "new_line_number": 97 }, { "content": " });", "type": " ", "old_line_number": 98, "new_line_number": 98 }, { "content": " });", "type": " ", "old_line_number": 99, "new_line_number": 99 }, { "content": " });", "type": " ", "old_line_number": 100, "new_line_number": 100 }, { "content": "});", "type": " ", "old_line_number": 101, "new_line_number": 101 }, { "content": "", "type": " ", "old_line_number": 102, "new_line_number": 102 }, { "content": "// Run when loading the tab completes", "type": " ", "old_line_number": 103, "new_line_number": 103 }, { "content": "// console.log('setting tab event listeners');", "type": " ", "old_line_number": 104, "new_line_number": 104 }, { "content": "browser.tabs.onUpdated.addListener((id, changeInfo, tab) => {", "type": " ", "old_line_number": 105, "new_line_number": 105 }, { "content": " // console.log('updated', id, changeInfo, tab);", "type": " ", "old_line_number": 106, "new_line_number": 106 }, { "content": " if (changeInfo.status === 'complete') {", "type": " ", "old_line_number": 107, "new_line_number": 107 }, { "content": " initializePageAction(tab);", "type": " ", "old_line_number": 108, "new_line_number": 108 }, { "content": " }", "type": " ", "old_line_number": 109, "new_line_number": 109 }, { "content": "});", "type": " ", "old_line_number": 110, "new_line_number": 110 }, { "content": "", "type": " ", "old_line_number": 111, "new_line_number": 111 } ] } ], "old_path": "background.js", "parent": "4eb7b8f8ee54045fdfc5f3de60383e07ee77a8db", "hash": "ff2279f17a05efab4645dcb820c5f487b84e2a0a", "new_ending_new_line": true, "old_ending_new_line": true }, "entries": { "META-INF": { "depth": 0, "filename": "META-INF", "sha256": "", "mime_category": "directory", "mimetype": "application/octet-stream", "path": "META-INF", "size": null, "modified": "2019-06-14T13:31:41Z", "status": "" }, "META-INF/cose.manifest": { "depth": 1, "filename": "cose.manifest", "sha256": "2339b4b9a2ba6f4f46ecd9841af00158e5b567e2a1e653b345bf749e527bba54", "mime_category": "binary", "mimetype": "application/x-ms-manifest", "path": "META-INF/cose.manifest", "size": 5319, "modified": "2019-06-14T13:31:41Z", "status": "M" }, "META-INF/cose.sig": { "depth": 1, "filename": "cose.sig", "sha256": "b7511f43cd5d6adda0796187087e88067d7b245b2e9dfe5c5b5a8ddd920699ed", "mime_category": "binary", "mimetype": "application/octet-stream", "path": "META-INF/cose.sig", "size": 3130, "modified": "2019-06-14T13:31:41Z", "status": "M" }, "META-INF/manifest.mf": { "depth": 1, "filename": "manifest.mf", "sha256": "3b2b6b78fae135d150f8bcedd2581e4214a2153f2209daeee0fe2f86b08098df", "mime_category": "binary", "mimetype": null, "path": "META-INF/manifest.mf", "size": 5640, "modified": "2019-06-14T13:31:41Z", "status": "M" }, "META-INF/mozilla.rsa": { "depth": 1, "filename": "mozilla.rsa", "sha256": "1000ea6ddd73cc0e0b428ed403a9607efbe2c7748ecea1cd7a91ffb283610327", "mime_category": "binary", "mimetype": "application/octet-stream", "path": "META-INF/mozilla.rsa", "size": 4343, "modified": "2019-06-14T13:31:41Z", "status": "M" }, "META-INF/mozilla.sf": { "depth": 1, "filename": "mozilla.sf", "sha256": "d20d16068c8270df2fa243815d9dcfcc9d2c75c0c90a5fd22735120dd0422dfa", "mime_category": "binary", "mimetype": null, "path": "META-INF/mozilla.sf", "size": 144, "modified": "2019-06-14T13:31:41Z", "status": "M" }, "_locales": { "depth": 0, "filename": "_locales", "sha256": "", "mime_category": "directory", "mimetype": "application/octet-stream", "path": "_locales", "size": null, "modified": "2019-06-14T13:31:41Z", "status": "" }, "_locales/ar": { "depth": 1, "filename": "ar", "sha256": "", "mime_category": "directory", "mimetype": "application/octet-stream", "path": "_locales/ar", "size": null, "modified": "2019-06-14T13:31:41Z", "status": "" }, "_locales/ar/messages.json": { "depth": 2, "filename": "messages.json", "sha256": "82942e4a8e01fe4ca6bc4b94afbcc6cfb8d9af4fd4488968e17abdddc8e6bdbc", "mime_category": "text", "mimetype": "application/json", "path": "_locales/ar/messages.json", "size": 559, "modified": "2019-06-14T13:31:41Z", "status": "" }, "_locales/en": { "depth": 1, "filename": "en", "sha256": "", "mime_category": "directory", "mimetype": "application/octet-stream", "path": "_locales/en", "size": null, "modified": "2019-06-14T13:31:41Z", "status": "" }, "_locales/en/messages.json": { "depth": 2, "filename": "messages.json", "sha256": "a69d1083f5ffb15f16e3a421e8c7418cc32c05ccda278c6ff729d7317d8bb06b", "mime_category": "text", "mimetype": "application/json", "path": "_locales/en/messages.json", "size": 355, "modified": "2019-06-14T13:31:41Z", "status": "" }, "_locales/fr": { "depth": 1, "filename": "fr", "sha256": "", "mime_category": "directory", "mimetype": "application/octet-stream", "path": "_locales/fr", "size": null, "modified": "2019-06-14T13:31:41Z", "status": "" }, "_locales/fr/messages.json": { "depth": 2, "filename": "messages.json", "sha256": "677abee8f332f36b00488fa2118aeb00253a3c51dfc68657e26606c57a8c61bb", "mime_category": "text", "mimetype": "application/json", "path": "_locales/fr/messages.json", "size": 421, "modified": "2019-06-14T13:31:41Z", "status": "" }, "_locales/zh_CN": { "depth": 1, "filename": "zh_CN", "sha256": "", "mime_category": "directory", "mimetype": "application/octet-stream", "path": "_locales/zh_CN", "size": null, "modified": "2019-06-14T13:31:41Z", "status": "" }, "_locales/zh_CN/messages.json": { "depth": 2, "filename": "messages.json", "sha256": "028bc47acb7fbbbe3fd8b81a9496da1205e1dec84eec9bd7ba4b3109deae5578", "mime_category": "text", "mimetype": "application/json", "path": "_locales/zh_CN/messages.json", "size": 313, "modified": "2019-06-14T13:31:41Z", "status": "" }, "background.js": { "depth": 0, "filename": "background.js", "sha256": "dc93f9e01ada532e5a6e44d2a4c247b8c52c24c0d8e0e7d292f30b270bcae8cc", "mime_category": "text", "mimetype": "text/javascript", "path": "background.js", "size": 3249, "modified": "2019-06-14T13:31:41Z", "status": "" }, "button": { "depth": 0, "filename": "button", "sha256": "", "mime_category": "directory", "mimetype": "application/octet-stream", "path": "button", "size": null, "modified": "2019-06-14T13:31:41Z", "status": "" }, "button/icon-19.png": { "depth": 1, "filename": "icon-19.png", "sha256": "b4527b71f031a17a602b41f05c502928c62c73bada06884d35c559d0a2b22548", "mime_category": "image", "mimetype": "image/png", "path": "button/icon-19.png", "size": 1328, "modified": "2019-06-14T13:31:41Z", "status": "" }, "button/icon-38.png": { "depth": 1, "filename": "icon-38.png", "sha256": "f5eac8f529597b1bc7d4f54153a03b1acba4fbffbf12cae5e23eec5368a1d824", "mime_category": "image", "mimetype": "image/png", "path": "button/icon-38.png", "size": 2071, "modified": "2019-06-14T13:31:41Z", "status": "" }, "icons": { "depth": 0, "filename": "icons", "sha256": "", "mime_category": "directory", "mimetype": "application/octet-stream", "path": "icons", "size": null, "modified": "2019-06-14T13:31:41Z", "status": "" }, "icons/class": { "depth": 1, "filename": "class", "sha256": "", "mime_category": "directory", "mimetype": "application/octet-stream", "path": "icons/class", "size": null, "modified": "2019-06-14T13:31:41Z", "status": "" }, "icons/class/a.png": { "depth": 2, "filename": "a.png", "sha256": "e516d302140e29afeda57b6ecd2b7b002876a8a79a1d2e871ad2023ccec2471f", "mime_category": "image", "mimetype": "image/png", "path": "icons/class/a.png", "size": 585, "modified": "2019-06-14T13:31:41Z", "status": "" }, "icons/class/b.png": { "depth": 2, "filename": "b.png", "sha256": "8ae1feed70886c6af966c2c14b16e9216a619895b5c44329bef31865ac6ef8c3", "mime_category": "image", "mimetype": "image/png", "path": "icons/class/b.png", "size": 573, "modified": "2019-06-14T13:31:41Z", "status": "" }, "icons/class/c.png": { "depth": 2, "filename": "c.png", "sha256": "38a4552655b8e64b5cf35b123f821cf3c3d72f0ffbcdc9cf898050a1d9af0700", "mime_category": "image", "mimetype": "image/png", "path": "icons/class/c.png", "size": 546, "modified": "2019-06-14T13:31:41Z", "status": "" }, "icons/class/d.png": { "depth": 2, "filename": "d.png", "sha256": "3bb469ec9470f67648ebeb3c85c0abbf06000d2290b5b5cf0b72850ef3bf86ab", "mime_category": "image", "mimetype": "image/png", "path": "icons/class/d.png", "size": 430, "modified": "2019-06-14T13:31:41Z", "status": "" }, "icons/class/e.png": { "depth": 2, "filename": "e.png", "sha256": "912719d8924b5b3aad21bf3c6842344c9fcaba8350d79e1ee593354dc846cc98", "mime_category": "image", "mimetype": "image/png", "path": "icons/class/e.png", "size": 247, "modified": "2019-06-14T13:31:41Z", "status": "" }, "icons/class/false.png": { "depth": 2, "filename": "false.png", "sha256": "45d36ff93d6b132428908c3562e2ef216acfe92ab3a3dd2871a83a36c9b44a97", "mime_category": "image", "mimetype": "image/png", "path": "icons/class/false.png", "size": 489, "modified": "2019-06-14T13:31:41Z", "status": "" }, "icons/class/none.png": { "depth": 2, "filename": "none.png", "sha256": "dbad9e3e6a48c33e9662adde87f97a539e5d40c5ebe9d59b37c32041bfde3996", "mime_category": "image", "mimetype": "image/png", "path": "icons/class/none.png", "size": 342, "modified": "2019-06-14T13:31:41Z", "status": "" }, "icons/icon.png": { "depth": 1, "filename": "icon.png", "sha256": "b033841b089997120c5e1f2f8b36eebcd99314a3f55a493aca7608d634244f2c", "mime_category": "image", "mimetype": "image/png", "path": "icons/icon.png", "size": 2090, "modified": "2019-06-14T13:31:41Z", "status": "" }, "icons/icon@2x.png": { "depth": 1, "filename": "icon@2x.png", "sha256": "740748025be6b71feca90c8381e1c9054de5fcd3e21ccd9ee54098b95d2e6b79", "mime_category": "image", "mimetype": "image/png", "path": "icons/icon@2x.png", "size": 3623, "modified": "2019-06-14T13:31:41Z", "status": "" }, "manifest.json": { "depth": 0, "filename": "manifest.json", "sha256": "969cfb8676d283b9a1ce1f137c49ee5a6a27dc1c0aad7dab3e81a43397a38261", "mime_category": "text", "mimetype": "application/json", "path": "manifest.json", "size": 836, "modified": "2019-06-14T13:31:41Z", "status": "M" }, "mozilla-recommendation.json": { "depth": 0, "filename": "mozilla-recommendation.json", "sha256": "9e17383cf9b84ae37407cc436ef9c9676ce7888c56879ec638e02f8d8739a78c", "mime_category": "text", "mimetype": "application/json", "path": "mozilla-recommendation.json", "size": 183, "modified": "2019-06-14T13:31:41Z", "status": "A" }, "popup": { "depth": 0, "filename": "popup", "sha256": "", "mime_category": "directory", "mimetype": "application/octet-stream", "path": "popup", "size": null, "modified": "2019-06-14T13:31:41Z", "status": "" }, "popup/css": { "depth": 1, "filename": "css", "sha256": "", "mime_category": "directory", "mimetype": "application/octet-stream", "path": "popup/css", "size": null, "modified": "2019-06-14T13:31:41Z", "status": "" }, "popup/css/bootstrap.min.css": { "depth": 2, "filename": "bootstrap.min.css", "sha256": "f75e846cc83bd11432f4b1e21a45f31bc85283d11d372f7b19accd1bf6a2635c", "mime_category": "text", "mimetype": "text/css", "path": "popup/css/bootstrap.min.css", "size": 121200, "modified": "2019-06-14T13:31:41Z", "status": "" }, "popup/css/custom.css": { "depth": 2, "filename": "custom.css", "sha256": "9da51dec050af5720190396dda0d10c994490f20d2999a8523aa05b51e630195", "mime_category": "text", "mimetype": "text/css", "path": "popup/css/custom.css", "size": 22328, "modified": "2019-06-14T13:31:41Z", "status": "" }, "popup/fonts": { "depth": 1, "filename": "fonts", "sha256": "", "mime_category": "directory", "mimetype": "application/octet-stream", "path": "popup/fonts", "size": null, "modified": "2019-06-14T13:31:41Z", "status": "" }, "popup/fonts/glyphicons-halflings-regular.eot": { "depth": 2, "filename": "glyphicons-halflings-regular.eot", "sha256": "13634da87d9e23f8c3ed9108ce1724d183a39ad072e73e1b3d8cbf646d2d0407", "mime_category": "binary", "mimetype": "application/vnd.ms-fontobject", "path": "popup/fonts/glyphicons-halflings-regular.eot", "size": 20127, "modified": "2019-06-14T13:31:41Z", "status": "" }, "popup/fonts/glyphicons-halflings-regular.svg": { "depth": 2, "filename": "glyphicons-halflings-regular.svg", "sha256": "42f60659d265c1a3c30f9fa42abcbb56bd4a53af4d83d316d6dd7a36903c43e5", "mime_category": "image", "mimetype": "image/svg+xml", "path": "popup/fonts/glyphicons-halflings-regular.svg", "size": 108738, "modified": "2019-06-14T13:31:41Z", "status": "" }, "popup/fonts/glyphicons-halflings-regular.ttf": { "depth": 2, "filename": "glyphicons-halflings-regular.ttf", "sha256": "e395044093757d82afcb138957d06a1ea9361bdcf0b442d06a18a8051af57456", "mime_category": "binary", "mimetype": "application/font-sfnt", "path": "popup/fonts/glyphicons-halflings-regular.ttf", "size": 45404, "modified": "2019-06-14T13:31:41Z", "status": "" }, "popup/fonts/glyphicons-halflings-regular.woff": { "depth": 2, "filename": "glyphicons-halflings-regular.woff", "sha256": "a26394f7ede100ca118eff2eda08596275a9839b959c226e15439557a5a80742", "mime_category": "binary", "mimetype": "application/octet-stream", "path": "popup/fonts/glyphicons-halflings-regular.woff", "size": 23424, "modified": "2019-06-14T13:31:41Z", "status": "" }, "popup/fonts/glyphicons-halflings-regular.woff2": { "depth": 2, "filename": "glyphicons-halflings-regular.woff2", "sha256": "fe185d11a49676890d47bb783312a0cda5a44c4039214094e7957b4c040ef11c", "mime_category": "binary", "mimetype": "application/octet-stream", "path": "popup/fonts/glyphicons-halflings-regular.woff2", "size": 18028, "modified": "2019-06-14T13:31:41Z", "status": "" }, "popup/images": { "depth": 1, "filename": "images", "sha256": "", "mime_category": "directory", "mimetype": "application/octet-stream", "path": "popup/images", "size": null, "modified": "2019-06-14T13:31:41Z", "status": "" }, "popup/images/tosdr-logo-32.png": { "depth": 2, "filename": "tosdr-logo-32.png", "sha256": "b47420b318922b93dba90f69346892e2ceafd2570093e2f3084b0ddeff7e7aef", "mime_category": "image", "mimetype": "image/png", "path": "popup/images/tosdr-logo-32.png", "size": 3998, "modified": "2019-06-14T13:31:41Z", "status": "" }, "popup/js": { "depth": 1, "filename": "js", "sha256": "", "mime_category": "directory", "mimetype": "application/octet-stream", "path": "popup/js", "size": null, "modified": "2019-06-14T13:31:41Z", "status": "" }, "popup/js/bootstrap.min.js": { "depth": 2, "filename": "bootstrap.min.js", "sha256": "53964478a7c634e8dad34ecc303dd8048d00dce4993906de1bacf67f663486ef", "mime_category": "text", "mimetype": "text/javascript", "path": "popup/js/bootstrap.min.js", "size": 37045, "modified": "2019-06-14T13:31:41Z", "status": "" }, "popup/js/jquery-3.2.1.min.js": { "depth": 2, "filename": "jquery-3.2.1.min.js", "sha256": "87083882cc6015984eb0411a99d3981817f5dc5c90ba24f0940420c5548d82de", "mime_category": "text", "mimetype": "text/javascript", "path": "popup/js/jquery-3.2.1.min.js", "size": 86659, "modified": "2019-06-14T13:31:41Z", "status": "" }, "popup/js/popup.js": { "depth": 2, "filename": "popup.js", "sha256": "a00d9c22f523d8778ef7eec1d5017fdf5584606d7aea1c4f5d24cb26355b968d", "mime_category": "text", "mimetype": "text/javascript", "path": "popup/js/popup.js", "size": 4718, "modified": "2019-06-14T13:31:41Z", "status": "" }, "popup/js/servicedata.js": { "depth": 2, "filename": "servicedata.js", "sha256": "8eb8e1a44b321a2449d612e3e0bae24cceb06e1e47a4ca8ba503805a965822be", "mime_category": "text", "mimetype": "text/x-c", "path": "popup/js/servicedata.js", "size": 4100, "modified": "2019-06-14T13:31:41Z", "status": "" }, "popup/js/underscore-min.js": { "depth": 2, "filename": "underscore-min.js", "sha256": "a1b6400a21ddee090e93d8882ffa629963132785bfa41b0abbea199d278121e9", "mime_category": "text", "mimetype": "text/javascript", "path": "popup/js/underscore-min.js", "size": 16449, "modified": "2019-06-14T13:31:41Z", "status": "" }, "popup/popup.html": { "depth": 1, "filename": "popup.html", "sha256": "94f948f2e9bed0685d92110b6635cc9c3c62bd80b88dbf1892336a6d8adc0cab", "mime_category": "text", "mimetype": "text/html", "path": "popup/popup.html", "size": 1448, "modified": "2019-06-14T13:31:41Z", "status": "" } }, "selected_file": "background.js", "download_url": "https://addons-dev.allizom.org/en-US/reviewers/download-git-file/1688302/background.js/" }, "validation_url": "https://addons-dev.allizom.org/en-US/developers/addon/terms-of-service-didn-t-read/file/408963/validation", "validation_url_json": "https://addons-dev.allizom.org/en-US/developers/addon/terms-of-service-didn-t-read/file/408963/validation.json", "has_been_validated": true, "addon": { "id": 390151, "slug": "terms-of-service-didn-t-read", "name": { "en-US": "Terms of Service; Didn’t Read", "fr": "Terms of Service; Didn’t Read" }, "icon_url": "https://addons-dev-cdn.allizom.org/user-media/addon_icons/390/390151-64.png?modified=1558962603" } } ```

Looks like this

cose sig

and the diff is

diff for cose sig

ioanarusiczki commented 5 years ago

@EnTeQuAk As discussed , the diff for cose.sig and mozilla.rsa looks as expected.

EnTeQuAk commented 5 years ago

@bobsilverberg @kumar303

So, we're now returning the full data of unchanged lines for unchanged files, except for binary files where we don't render any hunk information. That safes me from issues like mozilla/addons#6757 but I figured, while we're only interested in "this binary file has changed", we might be more interested in the future about changes to images. Currently the download_url only contains the new-versions file download-url and there's no easy way to retrieve the parent-versions file download-url.

Would that be something worth adding? (I'd assume not too high priority though)

kumar303 commented 5 years ago

Would that be something worth adding? (I'd assume not too high priority though)

Since we have quite a queue of feature requests I think we can wait until a reviewer requests it. I expect that we'll get some good feature requests once we are able to ship v1 and get reviewers using it daily.