mastodon.social is one of the many independent Mastodon servers you can use to participate in the fediverse.
The original server operated by the Mastodon gGmbH non-profit

Administered by:

Server stats:

380K
active users

Bloody hell, *finally* got certificate authorities installing properly in Windows for codeberg.org/small-tech/auto-e

The hardest bit? Windows paths with spaces in them + a likely a bug in PowerShell’s command parser when nesting single and double quotes.

Long story short:

safeDirectoryPathForWindows (directoryPath) {
return execSync(`Powershell (New-Object -ComObject Scripting.FileSystemObject).GetFolder('${directoryPath}').ShortPath`).toString().replace('\r\n', '')
}

FML.

Codeberg.orgauto-encrypt-localhostAutomatically provisions and installs locally-trusted TLS certificates for Node.js https servers in 100% JavaScript (without any native dependencies like mkcert and certutil).

@aral I'm sure there's reasons you ended up on this result. If you didn't come across it, you can base64 encode a command for PowerShell and pass it in via the -EncodedCommand to not have to worry about multiple levels of quoting through shells. I'm a little worried about the comment on spaces in paths, node should be able to handle them just fine.

A recommendation is to use spawnSync instead and pass in a proper argument array which will work around the need to spawn a shell and quoting issues

@gibwar Ooh, both great suggestions and, yes, you’re right, it seems that Node is tripping over the quotes (same command directly in PowerShell does work so it’s not the PowerShell lexer). I’ll implement one of the two ways you’ve suggested today.

Appreciate it, thank you :)

gibwar

@aral certainly! Feel free to ping me if you have any questions. I use both PowerShell and node pretty heavily (as well as Windows) so I've been around the issues a time or two!