This repository has been archived by the owner on Sep 4, 2022. It is now read-only.
generated from Alex4386/typescript-kickstart
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbrowser.js
77 lines (68 loc) · 2.79 KB
/
browser.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
const HOST = 'http://localhost:8080';
function applyTheseCerts(certs) {
const certTable = document.getElementById('xwup_cert_table').getElementsByTagName('tbody')[0];
let certRows = [];
for (const thisCert of certs) {
const thisCertSubject = thisCert.subject ? thisCert.subject.map((n) => n.name + '=' + n.value).join(',') : '';
const thisCertIssuer = thisCert.issuer ? thisCert.issuer.map((n) => n.name + '=' + n.value).join(',') : '';
const commonNames = thisCert.subject.filter((n) => n.name === 'cn');
const commonName = commonNames.length > 0 ? commonNames[0].value : 'undefined';
const rowString = `
<tr role="row" aria-selected="true" subject="${thisCertSubject}" issuer="${thisCertIssuer}" serial="${
thisCert.serial
}" tabindex="0" class="xwup-tableview${thisCert.selected ? '-selected' : ''}-row" style="">
<td style="">
<div class="xwup-tableview-cell" title="${thisCert.selected ? '선택 ' : ''}${
thisCert.status ? thisCert.status + ' ' : '정상 '
}인증서" style="display: none; width: 0px; height: 0px;">
${thisCert.selected ? '선택 ' : ''}${thisCert.status ? thisCert.status + ' ' : '정상 '} 인증서
</div>
<div class="xwup-tableview-cell" title="${thisCert.type ? '은행개인 ' : ''}" style="">
<img src="https://www.gov.kr/webPlugins/AnySign4PC_LITE/AnySign4PC/img/cert${
thisCert.img ? thisCert.img : '0'
}.png" alt="정상 인증서" style="">
은행개인
</div>
</td>
<td style="font-family: monospace !important;">
<div class="xwup-tableview-cell" title="${commonName}" style="display: block; font-family: monospace !important;">
${commonName.replace(' ', ' ')}
</div>
</td>
<td style="">
<div class="xwup-tableview-cell" title="${thisCert.expiresAt}" style="display: block; text-align: center;">
${thisCert.expiresAt}
</div>
</td>
<td style="">
<div class="xwup-tableview-cell" title="${thisCert.issuedBy}" style="display: block; text-align: center;">
${thisCert.issuedBy}
</div>
</td>
</tr>`;
certRows.push(rowString);
}
certTable.innerHTML = certRows.join('\n');
}
function wait(ms) {
return new Promise((res, rej) => {
setTimeout(() => {
res();
}, ms);
});
}
async function loadFrame(frame) {
const imageFile = frame.toString().padStart(5, '0') + '.png';
console.log('Loaded Frame');
const result = await fetch(HOST + '/gpki/' + imageFile);
const json = await result.json();
applyTheseCerts(json);
}
async function start() {
for (let i = 1; i < 5259; i++) {
try {
await loadFrame(i);
await wait(1000 / 24);
} catch (e) {}
}
}