IgnoreList Creator

Start check

by Lissandro Dittmar

HTML

<div id="banner-message">
  <p>Ignorelist creator</p>
  <button>Do it!</button>
</div>
<div style="background-color: white;">
  <ol id="liste"></ol>
  <span id="result"></span>
</div>

CSS

i {
  color: #669FAB;
}

body {
  background: #20262E;
  padding: 20px;
  font-family: Helvetica;
}

#banner-message {
  background: #fff;
  border-radius: 4px;
  padding: 20px;
  font-size: 25px;
  text-align: center;
  transition: all 0.2s;
  margin: 0 auto;
  width: 300px;
}

button {
  background: #0084ff;
  border: none;
  border-radius: 5px;
  padding: 8px 14px;
  font-size: 15px;
  color: #fff;
}

#banner-message.alt {
  background: #0084ff;
  color: #fff;
  margin-top: 40px;
  width: 200px;
}

#banner-message.alt button {
  background: #fff;
  color: #000;
}

JavaScript

const createNew = true;

const issueTitle = "Think about to fix the issues found by adapter checker";

const adapterTestLink = "https://3jjxddo33l.execute-api.eu-west-1.amazonaws.com/default/checkAdapter?url=";

let adapterList;

const start = async function(){
		if(createNew){
      	adapterList = await getAdapterList('ignoreData.json');
      }else{
				adapterList = await getAdapterList('data.json');
      }
   if(adapterList){
   	$('#liste').append("<li style='color: blue;'>ignored: " + adapterList["ignore"].length + "/<span id='ignore'></span></li>");
      $('#liste').append("<li style='color: blue;'>noIoPackage: " + adapterList["noIoPackage"].length + "/<span id='noIoPackage'></span></li>");
      $('#liste').append("<li style='color: blue;'>checkError: " + Object.keys(adapterList["checkError"]).length + "/<span id='checkError'></span></li>");
      $('#liste').append("<li style='color: blue;'>checkOk: " + adapterList["checkOk"].length + "/<span id='checkOk'></span></li>");
      await startFunc();
      console.log(JSON.stringify(adapterList));
    	$('#ignore').text(adapterList["ignore"].length);
      $('#noIoPackage').text(adapterList["noIoPackage"].length);
      $('#checkOk').text(adapterList["checkOk"].length);
      $('#checkError').text(Object.keys(adapterList["checkError"]).length);
      $('#result').text(JSON.stringify(adapterList));
   }else{
   	$('#liste').append("<li style='color: red;'>ERROR</li>");
   }
} 

async function getAdapterList(file){
	const link = "https://raw.githubusercontent.com/ioBrokerChecker/testData/master/" + file;
   try{  
      return await (await fetch(link)).json();
   }catch(e){
      return {};
   }
}


const startFunc = async function(){

	await updateAdapterList();   

  	for (i = 1; i < 8; i++) {
   	const adapters = await (await fetch("https://api.github.com/search/repositories?q=iobroker+in:name&sort=updated&page=" + i + "&per_page=100")).json();
       if(adapters && adapters.items){
        ...