Skip to content

Is 10937 download script#64

Open
markoweb wants to merge 49 commits intodevfrom
IS-10937-download-script
Open

Is 10937 download script#64
markoweb wants to merge 49 commits intodevfrom
IS-10937-download-script

Conversation

@markoweb
Copy link
Contributor

No description provided.

Matus Marko and others added 30 commits December 18, 2025 15:11
IS-10806 Update start page with more links
…ading

Improve live reloading in idsvr previewer
…plates

CSS fixes for Identity Server templates
…s-once

Only run prestart tasks once when using start command from root
A small CSS adjustment on powered by Curity and authenticator buttons…
…ew-page

Remove LWA and update repo overview image
ssp previewer readme update,adding code
markoweb and others added 18 commits January 22, 2026 15:11
…e-about-bankid-qr-code-display-time

IS-10932 Change BankID message about QR Code displayed time
…-and-package-json

Remove LWA from readme and package.json
…for-version-5-in-BankID

IS-10773 Remove BankID version-5 specific template
…ail-improvements

HTML Form authenticator: improve UX when 'username is email'
IS-10937 adding GitHub Action to build previewer JRE image.
process.exit(1);
}

if (expectedSha256) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If I got it right, resolveAssetSuffix fails if platform/os isn't supported, so if expectedSha256 is not set, it probably means that this script has an error. I suggested failing in that case - or maybe always doing verifySha256 which hopefully fails if the expected hash is empty.

if (statusCode && statusCode >= 300 && statusCode < 400 && location) {
if (remainingRedirects === 0) {
fileStream.close();
fs.unlink(destinationPath, () => {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This logic with unlink seems a bit complicated. I'd say it would be simpler if the file was created only once outside the download logic and then unlinked if the download promise fails, or closed if the download promise succeeds. I didn't check in detail, though.


stream.on('error', reject);
stream.on('data', chunk => hash.update(chunk));
stream.on('end', () => {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No need to close the stream after end ?

}

await extract(nestedZipPath, { dir: targetDir });
console.log(`Unzipped nested archive ${nestedZipPath} to ${targetDir}`);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we want users to see these intermediate steps? (if this is visible to users, not sure)


request.on('error', err => {
fileStream.close();
fs.unlink(destinationPath, () => reject(err));
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Don't we need to fail or log an error here?

const nestedZipPath = path.join(targetDir, nestedZipFileName);

if (!fs.existsSync(nestedZipPath)) {
console.log(`Nested zip not found: ${nestedZipPath}`);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I suggest failing everything if this happens. The "nested zip" contains all the jars, without those there's no way to go ahead.

stream.on('end', () => {
const digest = hash.digest('hex');
if (digest !== normalizedExpected) {
reject(new Error(`SHA256 mismatch for ${filePath}: expected ${normalizedExpected}, got ${digest}`));
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I suggest deleting the downloaded file in this case, since that means the file may contain malicious contents.

await extract(source, { dir: target });
console.log(`Unzipped ${source} to ${target}`);

await extractNestedZip(target, `ui-kit-runtime-${version}.zip`);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why not claenup here by deleting the unnecessary zip files that were downloaded?

"scripts": {
"prestart": "npm run build --workspace @curity/ui-kit-icons --workspace @curity/ui-kit-css-lib --workspace @curity/ui-kit-css --workspace @curity/ui-kit-component-library && npm run unzip-libs --workspace @curity/ui-kit-identity-server",
"prestart": "npm run build --workspace @curity/ui-kit-icons --workspace @curity/ui-kit-css-lib --workspace @curity/ui-kit-css --workspace @curity/ui-kit-component-library --workspace @curity/ui-kit-identity-server && npm run unzip-libs --workspace @curity/ui-kit-identity-server",
"start": "SKIP_PRESTART=1 concurrently \"npm run start:identity-server\" \"npm run start:ssp\" \"npm run start:css\" \"npm run start:component-library\" \"open index.html\"",
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please ask some AI to make the scripts all runnable also on Windows.
Would be nice if npm was smart enough to do that but apparently it's pretty dumb.

@markoweb markoweb changed the base branch from main to dev February 11, 2026 13:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants