silksong-coop-mod 0.4.4 → 0.4.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +2 -2
- package/SSMP/SSMP.dll +0 -0
- package/package.json +1 -1
- package/update.ps1 +36 -4
package/README.md
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
# silksong-coop-mod 0.4.
|
|
1
|
+
# silksong-coop-mod 0.4.6
|
|
2
2
|
|
|
3
3
|
The files a player needs to install a two-player co-op build of **SSMP**, packaged so they can be fetched from
|
|
4
4
|
a mirror that is reachable inside mainland China. This is not a Node library: nothing here is imported or run
|
|
@@ -14,4 +14,4 @@ The BepInEx loader is included, so the install needs no network access at all.
|
|
|
14
14
|
|
|
15
15
|
The multiplayer mod is the work of [Extremelyd1](https://github.com/Extremelyd1/SSMP). This is a modified copy
|
|
16
16
|
that adds a shared two-player save; please do not take questions about it to the original author. Distributed
|
|
17
|
-
under the GNU LGPL 2.1 - see `LICENSE`. Built from https://github.com/Candy-649/SSMP at `
|
|
17
|
+
under the GNU LGPL 2.1 - see `LICENSE`. Built from https://github.com/Candy-649/SSMP at `db8df94`.
|
package/SSMP/SSMP.dll
CHANGED
|
Binary file
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "silksong-coop-mod",
|
|
3
|
-
"version": "0.4.
|
|
3
|
+
"version": "0.4.6",
|
|
4
4
|
"description": "Offline installer payload for a two-player co-op build of the SSMP Silksong multiplayer mod. Not a Node library.",
|
|
5
5
|
"license": "LGPL-2.1-or-later",
|
|
6
6
|
"author": "Candy-649 (https://github.com/Candy-649)",
|
package/update.ps1
CHANGED
|
@@ -18,6 +18,11 @@ param(
|
|
|
18
18
|
# Skip the search and use this game folder. Handy when the game lives somewhere unusual.
|
|
19
19
|
[string] $GameDir,
|
|
20
20
|
|
|
21
|
+
# Ask only these registries, instead of the mirror first and npm itself second. A mirror that answers from a
|
|
22
|
+
# stale cache is the one failure this script cannot tell apart from being up to date, so there has to be a
|
|
23
|
+
# way straight past it.
|
|
24
|
+
[string[]] $Registry,
|
|
25
|
+
|
|
21
26
|
# Report what would happen and change nothing.
|
|
22
27
|
[switch] $WhatIfOnly
|
|
23
28
|
)
|
|
@@ -34,6 +39,7 @@ $Registries = @(
|
|
|
34
39
|
'https://registry.npmmirror.com',
|
|
35
40
|
'https://registry.npmjs.org'
|
|
36
41
|
)
|
|
42
|
+
if ($Registry) { $Registries = $Registry }
|
|
37
43
|
|
|
38
44
|
function Write-Step($text) { Write-Host ""; Write-Host "==> $text" -ForegroundColor Cyan }
|
|
39
45
|
function Write-Ok($text) { Write-Host " $text" -ForegroundColor Green }
|
|
@@ -114,15 +120,41 @@ try {
|
|
|
114
120
|
Write-Step 'Asking what the newest build is'
|
|
115
121
|
$meta = $null
|
|
116
122
|
$usedRegistry = $null
|
|
123
|
+
$bestVersion = $null
|
|
117
124
|
foreach ($registry in $Registries) {
|
|
118
|
-
|
|
125
|
+
# Both the query string and the headers are here on purpose. A CDN in front of a mirror can hold an old
|
|
126
|
+
# answer for this exact URL: one player's updater reported the version before last, and said it was
|
|
127
|
+
# already up to date, while the very same URL answered correctly from another network. Headers alone are
|
|
128
|
+
# not enough, because an edge is free to ignore them - but a URL it has never seen is always a miss.
|
|
129
|
+
$url = "$registry/$PackageName/latest?t=$([DateTimeOffset]::UtcNow.ToUnixTimeMilliseconds())"
|
|
119
130
|
try {
|
|
120
|
-
$
|
|
121
|
-
|
|
122
|
-
|
|
131
|
+
$answer = Invoke-RestMethod -Uri $url -UseBasicParsing -TimeoutSec 30 -Headers @{
|
|
132
|
+
'Cache-Control' = 'no-cache'
|
|
133
|
+
'Pragma' = 'no-cache'
|
|
134
|
+
}
|
|
123
135
|
} catch {
|
|
124
136
|
Write-Warn2 "$registry did not answer ($($_.Exception.Message))"
|
|
137
|
+
continue
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
# Every registry is asked and the newest answer wins, rather than the first one to reply. The order used
|
|
141
|
+
# to decide it, which quietly made each player depend on the route that suits the other: the mirror is
|
|
142
|
+
# the one that works from the mainland, but a player outside it was sent to the mirror first and was told
|
|
143
|
+
# by a stale cache that they were already up to date. Whichever side of the border you are on, the answer
|
|
144
|
+
# is now the newest one either registry has, and the tarball comes from that same answer.
|
|
145
|
+
$answerVersion = Get-ComparableVersion $answer.version
|
|
146
|
+
if (-not $answerVersion) {
|
|
147
|
+
Write-Warn2 "$registry gave a version this cannot read ('$($answer.version)')"
|
|
148
|
+
continue
|
|
125
149
|
}
|
|
150
|
+
|
|
151
|
+
if ($bestVersion -and $answerVersion -le $bestVersion) {
|
|
152
|
+
continue
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
$meta = $answer
|
|
156
|
+
$bestVersion = $answerVersion
|
|
157
|
+
$usedRegistry = $registry
|
|
126
158
|
}
|
|
127
159
|
if (-not $meta) {
|
|
128
160
|
throw ("No registry answered, so there is nothing to compare against. Your network may be blocking`n" +
|