From ffa6d744003de6bb14d46f2d54d564eebc2b8526 Mon Sep 17 00:00:00 2001 From: DeepSource Bot Date: Thu, 1 Sep 2022 21:24:02 +0000 Subject: [PATCH 1/5] Add .deepsource.toml --- .deepsource.toml | 77 ++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 77 insertions(+) create mode 100644 .deepsource.toml diff --git a/.deepsource.toml b/.deepsource.toml new file mode 100644 index 00000000..c7affdf5 --- /dev/null +++ b/.deepsource.toml @@ -0,0 +1,77 @@ +version = 1 + +[[analyzers]] +name = "docker" +enabled = true + +[[analyzers]] +name = "go" +enabled = true + + [analyzers.meta] + import_root = "github.com/Watemlifts/internet_monitor" + +[[analyzers]] +name = "php" +enabled = true + +[[analyzers]] +name = "csharp" +enabled = true + +[[analyzers]] +name = "ruby" +enabled = true + +[[analyzers]] +name = "python" +enabled = true + + [analyzers.meta] + runtime_version = "3.x.x" + +[[analyzers]] +name = "javascript" +enabled = true + + [analyzers.meta] + plugins = [ + "react", + "angularjs" + ] + +[[analyzers]] +name = "shell" +enabled = true + +[[analyzers]] +name = "test-coverage" +enabled = true + +[[transformers]] +name = "gofumpt" +enabled = true + +[[transformers]] +name = "php-cs-fixer" +enabled = true + +[[transformers]] +name = "dotnet-format" +enabled = true + +[[transformers]] +name = "rubocop" +enabled = true + +[[transformers]] +name = "standardrb" +enabled = true + +[[transformers]] +name = "autopep8" +enabled = true + +[[transformers]] +name = "standardjs" +enabled = true \ No newline at end of file From 0fdcd9a30f31e908b6024263175bee3b56c95a2e Mon Sep 17 00:00:00 2001 From: "deepsource-autofix[bot]" <62050782+deepsource-autofix[bot]@users.noreply.github.com> Date: Thu, 1 Sep 2022 21:26:37 +0000 Subject: [PATCH 2/5] Removes the console expressions --- public/cache_thumbs.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/public/cache_thumbs.js b/public/cache_thumbs.js index 6f42a249..f4bb34e2 100644 --- a/public/cache_thumbs.js +++ b/public/cache_thumbs.js @@ -84,7 +84,7 @@ $( function () { map.geomap( 'option', 'bbox', bboxen[ feature.id ] ); setTimeout( storeImage, 2000 ); } else { - console.log( 'missing country for ' + feature.id ); + cacheIdx++; $( 'progress' ).prop( 'value', cacheIdx ); @@ -117,7 +117,7 @@ $( function () { } ); } } else { - console.log( 'cannot create dataURL for ' + feature.id ); + } mapCountriesService.geomap('remove', feature); From 1a80b37aee2bf5bf0fa7b126bdb9e18f63e6d19e Mon Sep 17 00:00:00 2001 From: "deepsource-autofix[bot]" <62050782+deepsource-autofix[bot]@users.noreply.github.com> Date: Thu, 1 Sep 2022 21:26:52 +0000 Subject: [PATCH 3/5] Format code with autopep8, standardrb, standardjs, rubocop, php-cs-fixer, gofumpt and dotnet-format --- public/cache_thumbs.js | 142 ++++++++++++++++++++--------------------- 1 file changed, 68 insertions(+), 74 deletions(-) diff --git a/public/cache_thumbs.js b/public/cache_thumbs.js index f4bb34e2..682a7980 100644 --- a/public/cache_thumbs.js +++ b/public/cache_thumbs.js @@ -1,16 +1,16 @@ -$( function () { - if ( $( '#cacheThumbs' ).length ) { - var map = $( '#cacheThumbs' ).geomap( { +$(function () { + if ($('#cacheThumbs').length) { + const map = $('#cacheThumbs').geomap({ tilingScheme: null, bboxMax: [-180, -85, 180, 85], services: [ { id: 'map-countries-service', type: 'shingled', - src: "" + src: '' } ], - center: [ 0, 20 ], + center: [0, 20], zoom: 2, zoomMin: 0, mode: 'static', @@ -18,15 +18,14 @@ $( function () { height: 0, width: 0 } - } ); + }) - - var mapCountriesService = $( '#map-countries-service' ).geomap( 'option', 'shapeStyle', { + const mapCountriesService = $('#map-countries-service').geomap('option', 'shapeStyle', { color: '#ccc', fillOpacity: 1, stroke: '#fefefe', strokeWidth: '2px' - } ); + }) /* color: '#366936', fillOpacity: 1, @@ -34,122 +33,117 @@ $( function () { */ // map countries from server - var mapCountries = { + const mapCountries = { length: 0 - }; + } - var features = null; - var bboxen = null + let features = null + let bboxen = null - $.each( map.data( 'mapCountries' ), function( ) { - mapCountries[ this.iso3_code ] = this; - mapCountries.length++; - } ); + $.each(map.data('mapCountries'), function () { + mapCountries[this.iso3_code] = this + mapCountries.length++ + }) // grab the world countries file $.getJSON('/world-countries.json', function (result) { - // append them to the map - features = result.features; - $( 'progress' ).attr( 'max', features.length ); - - $.each( features, function( ) { - mapCountriesService.geomap('append', this, null, false); - } ); + features = result.features + $('progress').attr('max', features.length) - map.geomap('refresh'); + $.each(features, function () { + mapCountriesService.geomap('append', this, null, false) + }) + map.geomap('refresh') - $.getJSON( '/country_bbox.json', function( result ) { - bboxen = result; - cacheThumb(); - } ); - }); + $.getJSON('/country_bbox.json', function (result) { + bboxen = result + cacheThumb() + }) + }) - var cacheIdx = 0; - var feature = null; - var country = null; + let cacheIdx = 0 + let feature = null + let country = null - function cacheThumb( ) { - feature = $.extend( {}, features[ cacheIdx ] ); - country = mapCountries[ feature.id ]; + function cacheThumb () { + feature = $.extend({}, features[cacheIdx]) + country = mapCountries[feature.id] - if ( country ) { + if (country) { mapCountriesService.geomap('append', feature, { color: '#5ec1a5', fillOpacity: 1, stroke: '#fefefe', strokeWidth: '2px' - }, false); - map.geomap( 'option', 'bbox', bboxen[ feature.id ] ); - setTimeout( storeImage, 2000 ); + }, false) + map.geomap('option', 'bbox', bboxen[feature.id]) + setTimeout(storeImage, 2000) } else { - - cacheIdx++; - $( 'progress' ).prop( 'value', cacheIdx ); + cacheIdx++ + $('progress').prop('value', cacheIdx) - if ( cacheIdx < features.length ) { - setTimeout( cacheThumb, 32 ); + if (cacheIdx < features.length) { + setTimeout(cacheThumb, 32) } } } - function storeImage() { - var dataUrl = $( '#map-countries-service img' ).prop( 'src' ); + function storeImage () { + const dataUrl = $('#map-countries-service img').prop('src') - if ( dataUrl ) { - $( '#thumb' ).prop( 'src', dataUrl ); - $( '#imgSrc' ).text( dataUrl ); + if (dataUrl) { + $('#thumb').prop('src', dataUrl) + $('#imgSrc').text(dataUrl) - var file = dataURLtoBlob( dataUrl ); + const file = dataURLtoBlob(dataUrl) - if ( file !== null ) { - var fd = new FormData(); + if (file !== null) { + const fd = new FormData() - fd.append( 'country[thumb]', file ); + fd.append('country[thumb]', file) - $.ajax( { + $.ajax({ url: '/countries/' + country.id, type: 'PUT', data: fd, processData: false, contentType: false - } ); + }) } } else { - + } - mapCountriesService.geomap('remove', feature); + mapCountriesService.geomap('remove', feature) - cacheIdx++; - $( 'progress' ).prop( 'value', cacheIdx ); + cacheIdx++ + $('progress').prop('value', cacheIdx) - if ( cacheIdx < features.length ) { - cacheThumb(); + if (cacheIdx < features.length) { + cacheThumb() } } // Convert dataURL to Blob object - function dataURLtoBlob(dataURL) { + function dataURLtoBlob (dataURL) { try { // Decode the dataURL - var binary = atob(dataURL.split(',')[1]); + const binary = atob(dataURL.split(',')[1]) // Create 8-bit unsigned array - var array = []; - for(var i = 0; i < binary.length; i++) { - array.push(binary.charCodeAt(i)); + const array = [] + for (let i = 0; i < binary.length; i++) { + array.push(binary.charCodeAt(i)) } // Return our Blob object - return new Blob([new Uint8Array(array)], {type: 'image/png'}); - } catch ( ex ) { - console.log( 'error creating image for ' + feature.id ); + return new Blob([new Uint8Array(array)], { type: 'image/png' }) + } catch (ex) { + console.log('error creating image for ' + feature.id) } - return null; + return null } - } - -} ); +}) From 7c404bc56d1a14df819de5d47a0903d185d7e1a8 Mon Sep 17 00:00:00 2001 From: Omony Denis <23052810+Watemlifts@users.noreply.github.com> Date: Fri, 7 Mar 2025 20:16:27 +0300 Subject: [PATCH 4/5] Create Funding # Generate the sponsorship information sponsorship_info = f""" # GitHub Sponsors github: {', '.join(github_sponsors)} # Patreon patreon: {patreon} # Open Collective open_collective: {open_collective} # Ko-fi ko_fi: {ko_fi} # Tidelift tidelift: {tidelift} # Community Bridge community_bridge: {community_bridge} # Liberapay liberapay: {liberapay} # IssueHunt issuehunt: {issuehunt} # LFX Crowdfunding lfx_crowdfunding: {lfx_crowdfunding} # Polar polar: {polar} """ --- Funding | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) create mode 100644 Funding diff --git a/Funding b/Funding new file mode 100644 index 00000000..a99ad801 --- /dev/null +++ b/Funding @@ -0,0 +1,32 @@ +# Generate the sponsorship information +sponsorship_info = f""" +# GitHub Sponsors +github: {', '.join(github_sponsors)} + +# Patreon +patreon: {patreon} + +# Open Collective +open_collective: {open_collective} + +# Ko-fi +ko_fi: {ko_fi} + +# Tidelift +tidelift: {tidelift} + +# Community Bridge +community_bridge: {community_bridge} + +# Liberapay +liberapay: {liberapay} + +# IssueHunt +issuehunt: {issuehunt} + +# LFX Crowdfunding +lfx_crowdfunding: {lfx_crowdfunding} + +# Polar +polar: {polar} +""" From 6d6f36682d815c97233482bb3821081da4a97c93 Mon Sep 17 00:00:00 2001 From: Omony Denis <23052810+Watemlifts@users.noreply.github.com> Date: Tue, 11 Mar 2025 11:28:34 +0300 Subject: [PATCH 5/5] Delete Funding --- Funding | 32 -------------------------------- 1 file changed, 32 deletions(-) delete mode 100644 Funding diff --git a/Funding b/Funding deleted file mode 100644 index a99ad801..00000000 --- a/Funding +++ /dev/null @@ -1,32 +0,0 @@ -# Generate the sponsorship information -sponsorship_info = f""" -# GitHub Sponsors -github: {', '.join(github_sponsors)} - -# Patreon -patreon: {patreon} - -# Open Collective -open_collective: {open_collective} - -# Ko-fi -ko_fi: {ko_fi} - -# Tidelift -tidelift: {tidelift} - -# Community Bridge -community_bridge: {community_bridge} - -# Liberapay -liberapay: {liberapay} - -# IssueHunt -issuehunt: {issuehunt} - -# LFX Crowdfunding -lfx_crowdfunding: {lfx_crowdfunding} - -# Polar -polar: {polar} -"""