chore(prettier): format fiels with prettier

This commit is contained in:
Shintaro Jokagi 2025-05-14 09:43:02 +12:00
parent 193c159db5
commit e068816f18
No known key found for this signature in database
GPG key ID: 0DDF8FA44C9A0DA8
36 changed files with 1261 additions and 1256 deletions

View file

@ -3,25 +3,29 @@
* Returns a mapping from filename to checksum.
*/
export async function getChecksums() {
const res = await fetch('https://api.github.com/repos/zen-browser/desktop/releases/latest', {
headers: {
'Accept': 'application/vnd.github+json',
'X-GitHub-Api-Version': '2022-11-28',
'User-Agent': 'zen-browser-checksum-fetcher',
const res = await fetch(
'https://api.github.com/repos/zen-browser/desktop/releases/latest',
{
headers: {
Accept: 'application/vnd.github+json',
'X-GitHub-Api-Version': '2022-11-28',
'User-Agent': 'zen-browser-checksum-fetcher',
},
},
});
if (!res.ok) throw new Error('Failed to fetch GitHub release: ' + res.statusText);
const data = await res.json();
const body = data.body as string;
)
if (!res.ok)
throw new Error('Failed to fetch GitHub release: ' + res.statusText)
const data = await res.json()
const body = data.body as string
// Extract the checksum block
const match = body.match(/File Checksums \(SHA-256\)[\s\S]*?```([\s\S]*?)```/);
const checksums: Record<string, string> = {};
const match = body.match(/File Checksums \(SHA-256\)[\s\S]*?```([\s\S]*?)```/)
const checksums: Record<string, string> = {}
if (match && match[1]) {
match[1].split('\n').forEach(line => {
const [hash, filename] = line.trim().split(/\s+/, 2);
if (hash && filename) checksums[filename] = hash;
});
match[1].split('\n').forEach((line) => {
const [hash, filename] = line.trim().split(/\s+/, 2)
if (hash && filename) checksums[filename] = hash
})
}
return checksums;
}
return checksums
}