Created
September 7, 2022 05:25
-
-
Save muedsa/8eb2a0974f4361c5337ee198aa733c32 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// ==UserScript== | |
// @name grafana loki query remove bom | |
// @namespace https://www.muedsa.com | |
// @version 0.1 | |
// @description try to take over the world! | |
// @author MUEDSA | |
// @match https://test-grafana.fskops.com/explore?* | |
// @run-at document-start | |
// @grant unsafeWindow | |
// ==/UserScript== | |
(function() { | |
'use strict'; | |
const originFetch = fetch; | |
unsafeWindow.fetch = (...args) => { | |
if(args[0].indexOf('api/datasources/proxy/1/loki/api/v1/query_range') >= 0){ | |
let replacedPath = args[0].replaceAll(/%EF|%BB|%BF/g, ''); | |
args[0] = replacedPath; | |
} | |
return originFetch(...args); | |
} | |
console.log('grafana loki query remove bom load success'); | |
})(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment