User:Cyberwolf/gadgets/WikiVirus.js
(Redirected from User:Cyberwolf/gadgets/virustotal.js)
Code that you insert on this page could contain malicious content capable of compromising your account. If you import a script from another page with "importScript", "mw.loader.load", "iusc", or "lusc", take note that this causes you to dynamically load a remote script, which could be changed by others. Editors are responsible for all edits and actions they perform, including by scripts. User scripts are not centrally supported and may malfunction or become inoperable due to software changes. A guide to help you find broken scripts is available. If you are unsure whether code you are adding to this page is safe, you can ask at the appropriate village pump. This code will be executed when previewing this page. |
![]() | This user script seems to have a documentation page at User:Cyberwolf/gadgets/WikiVirus. |
//devolpment build= shit dont work
//public build= shit works OK
//sandbox build = everything is probably broken !!dont install this!!
//things to fix-urgent
///FETCH wont respond correctly and only responds with ERROR:TypeError: Load failed; issue found
///Total virus does not support CORS
////Currently building a proxy slowly
//public v0.5 roadmap
///- fetches the json file places in log file
///- fetches the result from the content of the json
//public v1
/// provide a button to edit the page
///iron out the inevitable kinks
//public v2
///provide a button that automatically finds the link and deletes it
/// provides api limits
///use blame to find who added and report that in log
//----------
//portletlink =(√)
//apikey fetch = (√)
//urlfetch from ui= (√)
//url to virustotal= (√)
//virustotal to proxy =(×)
//proxy to wikivirus =(x)
// display result in console = (×)
var portlet = mw.util.addPortletLink('p-tb', '#', 'WikiVirus');
var Apikey = window.virustotalpublicapikey;
$( portlet ).click( function(e) {
e.preventDefault();
//do some stuff
if ( window.virustotalpublicapikey == 'PLACE API KEY HERE' ){
(OO.ui.alert( 'Your API key for VirusTotal has not been entered please create or sign into an VirusTotal account and get your key and place it in your commons js entry for this script' ).done( function () {
console.log( 'User closed the dialog.' );}))}else { OO.ui.prompt( 'WikiVirus Devlopment Build Currently Non functional v0.87 using VirusTotals V3 API', { textInput: { placeholder: 'url' } } ).done( function ( result ) {
if ( result !== null ) {
console.log( 'User typed "' + result + '" then clicked "OK".' );
var URL = result;
console.log( URL )
const options = {
method: 'POST',
headers: {
accept: 'application/json',
'x-apikey': Apikey ,
'content-type': 'application/x-www-form-urlencoded' },
body: new URLSearchParams({url: URL })
};
fetch('http://www.virustotal.com/api/v3/urls', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));
}})}});