Implemented: Simple logging page (#279)

This commit is contained in:
nobody 2021-02-21 19:50:41 +01:00
parent fada320de2
commit 529fea844c
No known key found for this signature in database
GPG Key ID: 8F6DE3D614FCFD7A
14 changed files with 329 additions and 8 deletions

View File

@ -216,6 +216,7 @@ const Links = {
'LOCALCDN_TEST': 'https://www.localcdn.org/test',
'LOCALCDN_TEST_WEBSITE': 'https://www.localcdn.org/test/check',
'WEBLATE': 'https://hosted.weblate.org/projects/localcdn/localcdn/',
'LOGGING': chrome.extension.getURL('pages/logging/logging.html'),
};
const CDNs = {

View File

@ -41,7 +41,7 @@ interceptor.handleRequest = function (requestDetails, tabIdentifier, tab) {
};
}
targetDetails = requestAnalyzer.getLocalTarget(requestDetails);
targetDetails = requestAnalyzer.getLocalTarget(requestDetails, tab.url);
targetPath = targetDetails.path;
if (Regex.GOOGLE_FONTS.test(requestDetails.url)) {

View File

@ -107,6 +107,15 @@ messenger._handleMessageReceived = function (message, sender, sendResponse) {
'runAt': 'document_start'
});
}
if (topic === 'logs:get') {
sendResponse({'logs': log.data});
return MessageResponse.SYNCHRONOUS;
}
if (topic === 'logs:delete') {
log.data = [];
}
};

View File

@ -65,7 +65,7 @@ requestAnalyzer.isValidCandidate = function (requestDetails, tabDetails) {
return requestDetails.method === WebRequest.GET;
};
requestAnalyzer.getLocalTarget = function (requestDetails) {
requestAnalyzer.getLocalTarget = function (requestDetails, initiator) {
let destinationUrl, destinationHost, destinationPath, hostMappings, basePath,
resourceMappings, destinationSearchString;
@ -95,7 +95,7 @@ requestAnalyzer.getLocalTarget = function (requestDetails) {
// Return either the local target's path or false.
// eslint-disable-next-line max-len
return requestAnalyzer._findLocalTarget(resourceMappings, basePath, destinationHost, destinationPath, destinationSearchString);
return requestAnalyzer._findLocalTarget(resourceMappings, basePath, destinationHost, destinationPath, destinationSearchString, initiator);
};
@ -114,7 +114,7 @@ requestAnalyzer._matchBasePath = function (hostMappings, channelPath) {
};
// eslint-disable-next-line max-len
requestAnalyzer._findLocalTarget = function (resourceMappings, basePath, channelHost, channelPath, destinationSearchString) {
requestAnalyzer._findLocalTarget = function (resourceMappings, basePath, channelHost, channelPath, destinationSearchString, initiator) {
let resourcePath, versionNumber, resourcePattern, filename, shorthandResource;
storageManager.type.get(Setting.LOGGING, function (items) {

120
icons/logging-dark.svg Normal file
View File

@ -0,0 +1,120 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!-- Generator: Adobe Illustrator 16.0.0, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
<svg
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:cc="http://creativecommons.org/ns#"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:svg="http://www.w3.org/2000/svg"
xmlns="http://www.w3.org/2000/svg"
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
version="1.1"
id="Capa_1"
x="0px"
y="0px"
width="548.291px"
height="548.291px"
viewBox="0 0 548.291 548.291"
style="enable-background:new 0 0 548.291 548.291;"
xml:space="preserve"
sodipodi:docname="logging-dark.svg"
inkscape:version="0.92.5 (2060ec1f9f, 2020-04-08)"><metadata
id="metadata43"><rdf:RDF><cc:Work
rdf:about=""><dc:format>image/svg+xml</dc:format><dc:type
rdf:resource="http://purl.org/dc/dcmitype/StillImage" /><dc:title></dc:title></cc:Work></rdf:RDF></metadata><defs
id="defs41" /><sodipodi:namedview
pagecolor="#ffffff"
bordercolor="#666666"
borderopacity="1"
objecttolerance="10"
gridtolerance="10"
guidetolerance="10"
inkscape:pageopacity="0"
inkscape:pageshadow="2"
inkscape:window-width="1680"
inkscape:window-height="997"
id="namedview39"
showgrid="false"
inkscape:zoom="0.43042836"
inkscape:cx="15.101236"
inkscape:cy="274.14551"
inkscape:window-x="0"
inkscape:window-y="25"
inkscape:window-maximized="1"
inkscape:current-layer="Capa_1" />
<g
id="g6"
style="fill:#777777;fill-opacity:1">
<path
d="M 486.201,196.124 H 473.035 V 132.59 c 0,-0.396 -0.062,-0.795 -0.115,-1.196 -0.021,-2.523 -0.825,-5 -2.552,-6.963 L 364.657,3.677 C 364.624,3.646 364.593,3.635 364.572,3.604 363.942,2.897 363.208,2.312 362.429,1.809 362.2,1.652 361.968,1.523 361.727,1.388 361.055,1.022 360.34,0.717 359.606,0.496 359.406,0.441 359.227,0.36 359.029,0.308 358.23,0.118 357.401,0 356.562,0 H 96.757 C 84.894,0 75.256,9.651 75.256,21.502 V 196.115 H 62.092 c -16.971,0 -30.732,13.756 -30.732,30.733 V 386.66 c 0,16.968 13.761,30.731 30.732,30.731 H 75.256 V 526.79 c 0,11.854 9.638,21.501 21.501,21.501 h 354.776 c 11.853,0 21.501,-9.647 21.501,-21.501 V 417.392 H 486.2 c 16.966,0 30.729,-13.764 30.729,-30.731 V 226.854 c 10e-4,-16.982 -13.762,-30.73 -30.728,-30.73 z M 96.757,21.502 h 249.054 v 110.009 c 0,5.939 4.817,10.75 10.751,10.75 h 94.972 v 53.861 H 96.757 Z m 221.059,281.925 c 0,47.77 -28.973,76.746 -71.558,76.746 -43.234,0 -68.531,-32.641 -68.531,-74.152 0,-43.679 27.887,-76.319 70.906,-76.319 44.756,0 69.183,33.511 69.183,73.725 z M 82.153,377.79 V 232.085 h 33.073 v 118.039 h 57.944 v 27.66 H 82.153 Z M 451.534,520.962 H 96.757 v -103.57 h 354.776 v 103.57 z m 9.642,-149.87 c -10.162,3.454 -29.402,8.209 -48.641,8.209 -26.589,0 -45.833,-6.698 -59.24,-19.664 -13.396,-12.535 -20.75,-31.568 -20.529,-52.967 0.214,-48.436 35.448,-76.108 83.229,-76.108 18.814,0 33.292,3.688 40.431,7.139 l -6.92,26.37 c -7.999,-3.457 -17.942,-6.268 -33.942,-6.268 -27.449,0 -48.209,15.567 -48.209,47.134 0,30.049 18.807,47.771 45.831,47.771 7.564,0 13.623,-0.852 16.21,-2.152 v -30.488 h -22.478 v -25.723 h 54.258 z"
id="path2"
inkscape:connector-curvature="0"
style="fill:#777777;fill-opacity:1" />
<path
d="m 212.533,305.37 c 0,28.535 13.407,48.64 35.452,48.64 22.268,0 35.021,-21.186 35.021,-49.5 0,-26.153 -12.539,-48.655 -35.237,-48.655 -22.265,-10e-4 -35.236,21.192 -35.236,49.515 z"
id="path4"
inkscape:connector-curvature="0"
style="fill:#777777;fill-opacity:1" />
</g>
<g
id="g8"
style="fill:#777777;fill-opacity:1">
</g>
<g
id="g10"
style="fill:#777777;fill-opacity:1">
</g>
<g
id="g12"
style="fill:#777777;fill-opacity:1">
</g>
<g
id="g14"
style="fill:#777777;fill-opacity:1">
</g>
<g
id="g16"
style="fill:#777777;fill-opacity:1">
</g>
<g
id="g18"
style="fill:#777777;fill-opacity:1">
</g>
<g
id="g20"
style="fill:#777777;fill-opacity:1">
</g>
<g
id="g22"
style="fill:#777777;fill-opacity:1">
</g>
<g
id="g24"
style="fill:#777777;fill-opacity:1">
</g>
<g
id="g26"
style="fill:#777777;fill-opacity:1">
</g>
<g
id="g28"
style="fill:#777777;fill-opacity:1">
</g>
<g
id="g30"
style="fill:#777777;fill-opacity:1">
</g>
<g
id="g32"
style="fill:#777777;fill-opacity:1">
</g>
<g
id="g34"
style="fill:#777777;fill-opacity:1">
</g>
<g
id="g36"
style="fill:#777777;fill-opacity:1">
</g>
</svg>

After

Width:  |  Height:  |  Size: 4.4 KiB

120
icons/logging-light.svg Normal file
View File

@ -0,0 +1,120 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!-- Generator: Adobe Illustrator 16.0.0, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
<svg
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:cc="http://creativecommons.org/ns#"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:svg="http://www.w3.org/2000/svg"
xmlns="http://www.w3.org/2000/svg"
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
version="1.1"
id="Capa_1"
x="0px"
y="0px"
width="548.291px"
height="548.291px"
viewBox="0 0 548.291 548.291"
style="enable-background:new 0 0 548.291 548.291;"
xml:space="preserve"
sodipodi:docname="logging-light.svg"
inkscape:version="0.92.5 (2060ec1f9f, 2020-04-08)"><metadata
id="metadata43"><rdf:RDF><cc:Work
rdf:about=""><dc:format>image/svg+xml</dc:format><dc:type
rdf:resource="http://purl.org/dc/dcmitype/StillImage" /><dc:title></dc:title></cc:Work></rdf:RDF></metadata><defs
id="defs41" /><sodipodi:namedview
pagecolor="#ffffff"
bordercolor="#666666"
borderopacity="1"
objecttolerance="10"
gridtolerance="10"
guidetolerance="10"
inkscape:pageopacity="0"
inkscape:pageshadow="2"
inkscape:window-width="1680"
inkscape:window-height="997"
id="namedview39"
showgrid="false"
inkscape:zoom="0.43042836"
inkscape:cx="15.101236"
inkscape:cy="274.14551"
inkscape:window-x="0"
inkscape:window-y="25"
inkscape:window-maximized="1"
inkscape:current-layer="Capa_1" />
<g
id="g6"
style="fill:#f2f2f2;fill-opacity:1">
<path
d="M 486.201,196.124 H 473.035 V 132.59 c 0,-0.396 -0.062,-0.795 -0.115,-1.196 -0.021,-2.523 -0.825,-5 -2.552,-6.963 L 364.657,3.677 C 364.624,3.646 364.593,3.635 364.572,3.604 363.942,2.897 363.208,2.312 362.429,1.809 362.2,1.652 361.968,1.523 361.727,1.388 361.055,1.022 360.34,0.717 359.606,0.496 359.406,0.441 359.227,0.36 359.029,0.308 358.23,0.118 357.401,0 356.562,0 H 96.757 C 84.894,0 75.256,9.651 75.256,21.502 V 196.115 H 62.092 c -16.971,0 -30.732,13.756 -30.732,30.733 V 386.66 c 0,16.968 13.761,30.731 30.732,30.731 H 75.256 V 526.79 c 0,11.854 9.638,21.501 21.501,21.501 h 354.776 c 11.853,0 21.501,-9.647 21.501,-21.501 V 417.392 H 486.2 c 16.966,0 30.729,-13.764 30.729,-30.731 V 226.854 c 10e-4,-16.982 -13.762,-30.73 -30.728,-30.73 z M 96.757,21.502 h 249.054 v 110.009 c 0,5.939 4.817,10.75 10.751,10.75 h 94.972 v 53.861 H 96.757 Z m 221.059,281.925 c 0,47.77 -28.973,76.746 -71.558,76.746 -43.234,0 -68.531,-32.641 -68.531,-74.152 0,-43.679 27.887,-76.319 70.906,-76.319 44.756,0 69.183,33.511 69.183,73.725 z M 82.153,377.79 V 232.085 h 33.073 v 118.039 h 57.944 v 27.66 H 82.153 Z M 451.534,520.962 H 96.757 v -103.57 h 354.776 v 103.57 z m 9.642,-149.87 c -10.162,3.454 -29.402,8.209 -48.641,8.209 -26.589,0 -45.833,-6.698 -59.24,-19.664 -13.396,-12.535 -20.75,-31.568 -20.529,-52.967 0.214,-48.436 35.448,-76.108 83.229,-76.108 18.814,0 33.292,3.688 40.431,7.139 l -6.92,26.37 c -7.999,-3.457 -17.942,-6.268 -33.942,-6.268 -27.449,0 -48.209,15.567 -48.209,47.134 0,30.049 18.807,47.771 45.831,47.771 7.564,0 13.623,-0.852 16.21,-2.152 v -30.488 h -22.478 v -25.723 h 54.258 z"
id="path2"
inkscape:connector-curvature="0"
style="fill:#f2f2f2;fill-opacity:1" />
<path
d="m 212.533,305.37 c 0,28.535 13.407,48.64 35.452,48.64 22.268,0 35.021,-21.186 35.021,-49.5 0,-26.153 -12.539,-48.655 -35.237,-48.655 -22.265,-10e-4 -35.236,21.192 -35.236,49.515 z"
id="path4"
inkscape:connector-curvature="0"
style="fill:#f2f2f2;fill-opacity:1" />
</g>
<g
id="g8"
style="fill:#f2f2f2;fill-opacity:1">
</g>
<g
id="g10"
style="fill:#f2f2f2;fill-opacity:1">
</g>
<g
id="g12"
style="fill:#f2f2f2;fill-opacity:1">
</g>
<g
id="g14"
style="fill:#f2f2f2;fill-opacity:1">
</g>
<g
id="g16"
style="fill:#f2f2f2;fill-opacity:1">
</g>
<g
id="g18"
style="fill:#f2f2f2;fill-opacity:1">
</g>
<g
id="g20"
style="fill:#f2f2f2;fill-opacity:1">
</g>
<g
id="g22"
style="fill:#f2f2f2;fill-opacity:1">
</g>
<g
id="g24"
style="fill:#f2f2f2;fill-opacity:1">
</g>
<g
id="g26"
style="fill:#f2f2f2;fill-opacity:1">
</g>
<g
id="g28"
style="fill:#f2f2f2;fill-opacity:1">
</g>
<g
id="g30"
style="fill:#f2f2f2;fill-opacity:1">
</g>
<g
id="g32"
style="fill:#f2f2f2;fill-opacity:1">
</g>
<g
id="g34"
style="fill:#f2f2f2;fill-opacity:1">
</g>
<g
id="g36"
style="fill:#f2f2f2;fill-opacity:1">
</g>
</svg>

After

Width:  |  Height:  |  Size: 4.4 KiB

28
modules/internal/log.js Normal file
View File

@ -0,0 +1,28 @@
/**
* Log
* Belongs to LocalCDN
*
* @author nobody
* @since 2021-02-19
*
* @license MPL 2.0
*
* 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/.
*/
'use strict';
/**
* Log
*/
var log = {};
log.append = function (initiator, resource, target, highlight) {
log.data.push({initiator, resource, target, highlight});
};
log.data = [];

View File

@ -12,6 +12,7 @@
<script src="../../modules/internal/targets.js"></script>
<script src="../../modules/internal/helpers.js"></script>
<script src="../../modules/internal/stats.js"></script>
<script src="../../modules/internal/log.js"></script>
<script src="../../core/resources.js"></script>
<script src="../../core/mappings.js"></script>

View File

@ -302,7 +302,8 @@
<li><a id="link-changelog" class="no-icon">Changelog (In-App)</a></li>
<li><a id="link-donate" class="no-icon">Donate (In-App)</a></li>
<li><a id="link-faq" class="no-icon">FAQ (In-App)</a></li>
<li><a id="link-statistic" class="no-icon"><span data-i18n-content="internalStatisticsTitle">Statistics</span> <span>(In-App)</span></a></li><br>
<li><a id="link-statistic" class="no-icon"><span data-i18n-content="internalStatisticsTitle">Statistics</span> <span>(In-App)</span></a></li>
<li><a id="link-logging" class="no-icon">Logs (In-App)</span></a></li><br>
<li><a id="link-codeberg" href="https://codeberg.org/nobody/LocalCDN" target="_blank" rel="nofollow noopener noreferrer">Source (www.codeberg.org)</a></li>
<li><a id="link-website" href="https://www.localcdn.org" target="_blank" rel="nofollow noopener noreferrer">Website (www.localcdn.org)</a></li>
<li><a id="link-website-test" href="https://www.localcdn.org/test" target="_blank" rel="nofollow noopener noreferrer">Testing Utility (www.localcdn.org/test)</a></li>

View File

@ -260,6 +260,12 @@ options.onOptionChanged = function ({target}) {
case Setting.SELECTED_ICON:
optionsOther._setIcon(optionValue);
break;
case Setting.LOGGING:
console.log(optionValue);
if (optionValue === false) {
chrome.runtime.sendMessage({'topic': 'logs:delete', 'value': ''});
}
break;
}
storageManager.type.set({

View File

@ -196,7 +196,7 @@ footer {
float: right;
font-size: 12px;
margin-left: 10px;
padding: 5px 22px;
padding: 5px 10px;
-moz-user-select: none;
-ms-user-select: none;
-webkit-user-select: none;
@ -265,12 +265,18 @@ footer {
#statistics-button:hover {
filter: contrast(0.5);
#logging-button-svg {
background-image: url("../../icons/logging-dark.svg");
}
#statistics-button {
#statistics-button, #logging-button {
display: none;
}
#options-button:hover, #statistics-button:hover, #logging-button:hover {
filter: contrast(0.5);
}
/**
* Toggles
*/
@ -497,6 +503,10 @@ input:checked + .slider:hover {
background-image: url("data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iVVRGLTgiIHN0YW5kYWxvbmU9Im5vIj8+CjxzdmcKICAgeG1sbnM6ZGM9Imh0dHA6Ly9wdXJsLm9yZy9kYy9lbGVtZW50cy8xLjEvIgogICB4bWxuczpjYz0iaHR0cDovL2NyZWF0aXZlY29tbW9ucy5vcmcvbnMjIgogICB4bWxuczpyZGY9Imh0dHA6Ly93d3cudzMub3JnLzE5OTkvMDIvMjItcmRmLXN5bnRheC1ucyMiCiAgIHhtbG5zOnN2Zz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciCiAgIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIKICAgeG1sbnM6c29ka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cGVzPSJzc3Nzc3Nzc3MiIC8+CiAgPC9nPgo8L3N2Zz4K");
}
#logging-button-svg {
background-image: url("../../icons/logging-light.svg");
}
input:checked + .slider {
background-color: #6bb798;
}

View File

@ -57,6 +57,9 @@
<div id="testing-utility">
<a id="testing-utility-link" class="link-text" data-i18n-content="websiteBroken">Website broken?</a>
</div>
<div id="logging-button" class="button">
<div id="logging-button-svg" class="button-svg"></div>
</div>
<div id="statistics-button" class="button" data-i18n-title="headerStatistics">
<div id="statistics-button-svg" class="button-svg"></div>
</div>

View File

@ -77,6 +77,11 @@ popup._renderNonContextualContents = function () {
document.getElementById('statistics-button').style.display = 'block';
document.getElementById('statistics-button').addEventListener('mouseup', popup._onStatisticsButtonClicked);
}
if (popup._loggingStatus) {
document.getElementById('logging-button').style.display = 'block';
document.getElementById('logging-button').addEventListener('mouseup', popup._onLoggingButtonClicked);
}
};
popup._renderContextualContents = function () {
@ -261,8 +266,12 @@ popup._readLocalStorage = function () {
popup._readStorage = function () {
return new Promise((resolve) => {
storageManager.type.get([Setting.NEGATE_HTML_FILTER_LIST], function (items) {
storageManager.type.get([
Setting.NEGATE_HTML_FILTER_LIST,
Setting.LOGGING
], function (items) {
popup.negateHtmlFilterList = items.negateHtmlFilterList;
popup._loggingStatus = items.enableLogging;
resolve();
});
});
@ -538,6 +547,17 @@ popup._onStatisticsButtonClicked = function () {
}
};
popup._onLoggingButtonClicked = function () {
if (event.button === 0 || event.button === 1) {
chrome.tabs.create({
'url': Links.LOGGING,
'active': event.button === 0,
});
}
if (event.button === 0) {
window.close();
}
};
/**
* Initializations
@ -545,5 +565,6 @@ popup._onStatisticsButtonClicked = function () {
popup.negateHtmlFilterList = false;
popup._statisticsStatus = false;
popup._loggingStatus = false;
document.addEventListener('DOMContentLoaded', popup._onDocumentLoaded);

View File

@ -26,6 +26,7 @@
</div>
<ul>
<li>Fixed: Check status code in HTML filter (<a href="https://codeberg.org/nobody/LocalCDN/issues/277">#277</a>)</li>
<li>Implemented: Simple logging page (<a href="https://codeberg.org/nobody/LocalCDN/issues/279">#279</a>)</li>
</ul>
<div id="generator-section">
<div class="topic-label">