This repository was archived by the owner on Nov 25, 2025. It is now read-only.
File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -636,6 +636,19 @@ export async function setupZig(context: vscode.ExtensionContext) {
636636 break ;
637637 }
638638
639+ let mirrors : vscode . Uri [ ] = [ ] ;
640+ try {
641+ const response = await fetch ( "https://ziglang.org/download/community-mirrors.txt" ) ;
642+ if ( response . status !== 200 ) throw Error ( "invalid mirrors" ) ;
643+ const mirrorList = await response . text ( ) ;
644+ mirrors = mirrorList
645+ . trim ( )
646+ . split ( "\n" )
647+ . map ( ( u ) => vscode . Uri . parse ( u ) ) ;
648+ } catch {
649+ // Cannot fetch mirrors, attempt downloading from canonical source.
650+ }
651+
639652 versionManagerConfig = {
640653 context : context ,
641654 title : "Zig" ,
@@ -645,13 +658,7 @@ export async function setupZig(context: vscode.ExtensionContext) {
645658 minisignKey : minisign . parseKey ( "RWSGOq2NVecA2UPNdBUZykf1CCb147pkmdtYxgb3Ti+JO/wCYvhbAb/U" ) ,
646659 versionArg : "version" ,
647660 // taken from https://github.com/mlugg/setup-zig/blob/main/mirrors.json
648- mirrorUrls : [
649- vscode . Uri . parse ( "https://pkg.machengine.org/zig" ) ,
650- vscode . Uri . parse ( "https://zigmirror.hryx.net/zig" ) ,
651- vscode . Uri . parse ( "https://zig.linus.dev/zig" ) ,
652- vscode . Uri . parse ( "https://fs.liujiacai.net/zigbuilds" ) ,
653- vscode . Uri . parse ( "https://zigmirror.nesovic.dev/zig" ) ,
654- ] ,
661+ mirrorUrls : mirrors ,
655662 canonicalUrl : {
656663 release : vscode . Uri . parse ( "https://ziglang.org/download" ) ,
657664 nightly : vscode . Uri . parse ( "https://ziglang.org/builds" ) ,
You can’t perform that action at this time.
0 commit comments