com.robotsquid.squidhub 0.5.2 → 0.5.4
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/CHANGELOG.md +37 -0
- package/Editor/SquidHubAudit.cs +13 -17
- package/Editor/SquidHubBuildProcessor.cs +0 -3
- package/Editor/SquidHubHtml.cs +0 -41
- package/README.md +9 -7
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,42 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 0.5.4
|
|
4
|
+
|
|
5
|
+
**No functional change from 0.5.3.**
|
|
6
|
+
|
|
7
|
+
Published to supersede an accidental blanket deprecation: `npm deprecate` was
|
|
8
|
+
run without a version specifier, which marks *every* published version rather
|
|
9
|
+
than one, so 0.5.0 through 0.5.3 all carry npm's generic "Package no longer
|
|
10
|
+
supported" text — including the version people should have been installing.
|
|
11
|
+
|
|
12
|
+
Deprecation is per-version and there is no package-level flag, so a new release
|
|
13
|
+
is undeprecated by definition. ⚠️ The older versions keep their misleading
|
|
14
|
+
marking; three of them ought to be deprecated anyway (0.5.0 ships no root
|
|
15
|
+
`.meta` files, 0.5.1 predates the uncompressed-upload model, 0.5.2 rewrites
|
|
16
|
+
compressed asset URLs for a hosting model that no longer exists), just not for
|
|
17
|
+
the reason the text gives.
|
|
18
|
+
|
|
19
|
+
⚠️ **`npm deprecate <package>` with no `@version` applies to everything.** Always
|
|
20
|
+
write `npm deprecate <package>@<version>`.
|
|
21
|
+
|
|
22
|
+
## 0.5.3
|
|
23
|
+
|
|
24
|
+
**Compressed builds are now refused in the Editor**, with a message naming the
|
|
25
|
+
setting to change. Player Settings → Publishing Settings → **Compression Format
|
|
26
|
+
→ Disabled**.
|
|
27
|
+
|
|
28
|
+
SquidHub serves build assets uncompressed and Cloudflare compresses them at the
|
|
29
|
+
edge. A build compressed beforehand cannot be served at all: R2 stores it
|
|
30
|
+
correctly, but the edge either strips `Content-Encoding` or compresses the body
|
|
31
|
+
a second time, and no zone configuration preserves it. `squidhub-release`
|
|
32
|
+
refuses such files at upload too — this check exists so the failure lands in the
|
|
33
|
+
Editor, next to the setting that causes it.
|
|
34
|
+
|
|
35
|
+
⚠️ **Removes 0.5.2's rewriting of compressed asset URLs.** That pointed
|
|
36
|
+
`web.wasm.br` at the key it was stored under, which was correct for a hosting
|
|
37
|
+
model since disproven. With compressed builds refused outright there is nothing
|
|
38
|
+
left for it to rewrite.
|
|
39
|
+
|
|
3
40
|
## 0.5.2
|
|
4
41
|
|
|
5
42
|
⚠️ **Fixes `Unable to load file Build/<name>.br!` — a Unity build that reached
|
package/Editor/SquidHubAudit.cs
CHANGED
|
@@ -87,27 +87,23 @@ namespace SquidHub.Editor
|
|
|
87
87
|
AllowThreadsDefine + " to the WebGL scripting define symbols to silence this.");
|
|
88
88
|
}
|
|
89
89
|
|
|
90
|
+
// ⚠️ FATAL, not a warning. A precompressed build cannot be served: R2
|
|
91
|
+
// stores it fine, but Cloudflare either strips Content-Encoding or
|
|
92
|
+
// compresses the body a second time, and no zone configuration
|
|
93
|
+
// preserves it. squidhub-release refuses these at upload too — this
|
|
94
|
+
// check exists so the failure lands in the Editor, next to the setting
|
|
95
|
+
// that causes it, rather than in a CLI twenty minutes later.
|
|
90
96
|
private static void CheckCompression(List<Finding> findings)
|
|
91
97
|
{
|
|
92
98
|
var format = PlayerSettings.WebGL.compressionFormat;
|
|
99
|
+
if (format == WebGLCompressionFormat.Disabled) return;
|
|
93
100
|
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
}
|
|
101
|
-
|
|
102
|
-
// ⚠️ Not an error — just weight. The platform serves the correct
|
|
103
|
-
// Content-Encoding, so the JS decompressor never has to run.
|
|
104
|
-
if (PlayerSettings.WebGL.decompressionFallback)
|
|
105
|
-
{
|
|
106
|
-
Warn(findings,
|
|
107
|
-
"Decompression Fallback is on. squidhub-release strips the .br suffix and " +
|
|
108
|
-
"records Content-Encoding: br in R2, so the browser decompresses natively " +
|
|
109
|
-
"and the bundled JS decompressor is dead weight. Turning it off is safe here.");
|
|
110
|
-
}
|
|
101
|
+
Fatal(findings,
|
|
102
|
+
"Compression Format is " + format + ". SquidHub serves build assets " +
|
|
103
|
+
"uncompressed and Cloudflare compresses them at the edge — a build " +
|
|
104
|
+
"compressed beforehand reaches the browser either undeclared or " +
|
|
105
|
+
"double-encoded, and the loader fails naming the wrong cause. Set " +
|
|
106
|
+
"Player Settings > Publishing Settings > Compression Format to Disabled.");
|
|
111
107
|
}
|
|
112
108
|
|
|
113
109
|
private static bool AllowsThreads()
|
|
@@ -79,9 +79,6 @@ namespace SquidHub.Editor
|
|
|
79
79
|
if (result.Extracted.Count == 0)
|
|
80
80
|
log.Append(" · no inline scripts to hoist\n");
|
|
81
81
|
|
|
82
|
-
if (result.SuffixesStripped > 0)
|
|
83
|
-
log.Append(" ✓ pointed ").Append(result.SuffixesStripped)
|
|
84
|
-
.Append(" compressed asset URL(s) at the key they are stored under\n");
|
|
85
82
|
|
|
86
83
|
File.WriteAllText(indexPath, result.Html);
|
|
87
84
|
foreach (var note in result.Notes) log.Append(" ✓ ").Append(note).Append('\n');
|
package/Editor/SquidHubHtml.cs
CHANGED
|
@@ -25,8 +25,6 @@ namespace SquidHub.Editor
|
|
|
25
25
|
public readonly List<KeyValuePair<string, string>> Extracted =
|
|
26
26
|
new List<KeyValuePair<string, string>>();
|
|
27
27
|
public readonly List<string> Notes = new List<string>();
|
|
28
|
-
/// <summary>How many compressed-asset URLs had their suffix stripped.</summary>
|
|
29
|
-
public int SuffixesStripped;
|
|
30
28
|
}
|
|
31
29
|
|
|
32
30
|
private static readonly Regex ScriptTag = new Regex(
|
|
@@ -51,36 +49,6 @@ namespace SquidHub.Editor
|
|
|
51
49
|
"text/ecmascript", "application/ecmascript",
|
|
52
50
|
};
|
|
53
51
|
|
|
54
|
-
// ⚠️ squidhub-release stores `web.wasm.br` at the key `web.wasm` and
|
|
55
|
-
// records Content-Encoding: br, so the browser decodes it natively. But
|
|
56
|
-
// Unity's loader asks for the name on disk — `Build/web.wasm.br` — and
|
|
57
|
-
// gets a 404, because nothing is stored under that key.
|
|
58
|
-
//
|
|
59
|
-
// ⚠️ Rewriting the URL is also what makes the loader behave. Unity
|
|
60
|
-
// decides whether to run its own JS decompressor by looking for a .br
|
|
61
|
-
// or .gz on the URL; with the suffix gone it fetches normally and lets
|
|
62
|
-
// the browser decode, which is exactly what the stored headers want.
|
|
63
|
-
//
|
|
64
|
-
// ⚠️ Not Unity-specific, despite the trigger. ANY reference a build
|
|
65
|
-
// makes to a file it ships as `X.br` is broken the same way, because
|
|
66
|
-
// the upload strips the suffix from every one of them.
|
|
67
|
-
private static readonly Regex CompressedAssetUrl = new Regex(
|
|
68
|
-
@"([""'])([^""']+\.(?:data|wasm|js|json|symbols\.json))\.(?:br|gz)\1",
|
|
69
|
-
RegexOptions.IgnoreCase | RegexOptions.CultureInvariant);
|
|
70
|
-
|
|
71
|
-
/// <summary>Points compressed-asset URLs at the key they are actually stored under.</summary>
|
|
72
|
-
internal static string StripCompressionSuffixes(string source, out int stripped)
|
|
73
|
-
{
|
|
74
|
-
var count = 0;
|
|
75
|
-
var result = CompressedAssetUrl.Replace(source, match =>
|
|
76
|
-
{
|
|
77
|
-
count++;
|
|
78
|
-
return match.Groups[1].Value + match.Groups[2].Value + match.Groups[1].Value;
|
|
79
|
-
});
|
|
80
|
-
stripped = count;
|
|
81
|
-
return result;
|
|
82
|
-
}
|
|
83
|
-
|
|
84
52
|
public static Result Apply(string html, string bridgeFileName)
|
|
85
53
|
{
|
|
86
54
|
var result = new Result { Html = html };
|
|
@@ -105,9 +73,6 @@ namespace SquidHub.Editor
|
|
|
105
73
|
if (!IsExecutable(attrs)) return match.Value; // data, not code
|
|
106
74
|
|
|
107
75
|
var name = "squidhub-inline-" + index++ + ".js";
|
|
108
|
-
int strippedHere;
|
|
109
|
-
body = StripCompressionSuffixes(body, out strippedHere);
|
|
110
|
-
result.SuffixesStripped += strippedHere;
|
|
111
76
|
result.Extracted.Add(new KeyValuePair<string, string>(name, body));
|
|
112
77
|
|
|
113
78
|
// ⚠️ Attributes are carried across verbatim. Dropping a
|
|
@@ -117,12 +82,6 @@ namespace SquidHub.Editor
|
|
|
117
82
|
return "<script" + carried + " src=\"" + name + "\"></script>";
|
|
118
83
|
});
|
|
119
84
|
|
|
120
|
-
// The document itself can carry them too — a template that lists the
|
|
121
|
-
// build files, or a preload hint.
|
|
122
|
-
int strippedInHtml;
|
|
123
|
-
rewritten = StripCompressionSuffixes(rewritten, out strippedInHtml);
|
|
124
|
-
result.SuffixesStripped += strippedInHtml;
|
|
125
|
-
|
|
126
85
|
var tag = "<script src=\"" + bridgeFileName + "\"></script>";
|
|
127
86
|
result.Html = InsertBridge(rewritten, tag, result);
|
|
128
87
|
result.Changed = !ReferenceEquals(result.Html, html) && result.Html != html;
|
package/README.md
CHANGED
|
@@ -103,8 +103,7 @@ The package checks these for you, but for reference:
|
|
|
103
103
|
| Setting | Value | Why |
|
|
104
104
|
|---|---|---|
|
|
105
105
|
| Native C/C++ Multithreading | **off** | SquidHub's default tier is not cross-origin isolated, so `SharedArrayBuffer` does not exist. A pthreads build cannot start. Ask about the isolated tier if you genuinely need threads — it carries no ads |
|
|
106
|
-
| Compression Format |
|
|
107
|
-
| Decompression Fallback | off | The header is already correct, so the bundled JS decompressor is dead weight |
|
|
106
|
+
| Compression Format | **Disabled** | ⚠️ Required, and the build is refused otherwise. SquidHub stores assets uncompressed and Cloudflare compresses them at the edge, per client. A precompressed build cannot be served correctly at all |
|
|
108
107
|
|
|
109
108
|
## Things that will otherwise bite
|
|
110
109
|
|
|
@@ -135,11 +134,14 @@ is discarded. Change a real file and rebuild.
|
|
|
135
134
|
|
|
136
135
|
## ⚠️ Status
|
|
137
136
|
|
|
138
|
-
**
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
137
|
+
**Verified end to end on 2026-09-04.** A real Unity WebGL build completed the
|
|
138
|
+
portal handshake, received its session, read a save, and had `commerce.purchase`
|
|
139
|
+
correctly refused as an ungranted capability.
|
|
140
|
+
|
|
141
|
+
⚠️ **Upload your build UNCOMPRESSED** — Player Settings → Publishing Settings →
|
|
142
|
+
Compression Format → **Disabled**. Cloudflare compresses at the edge and sets the
|
|
143
|
+
header; a precompressed build cannot be served correctly and fails in the loader
|
|
144
|
+
with a message naming the wrong cause.
|
|
143
145
|
|
|
144
146
|
## Support
|
|
145
147
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "com.robotsquid.squidhub",
|
|
3
|
-
"version": "0.5.
|
|
3
|
+
"version": "0.5.4",
|
|
4
4
|
"displayName": "SquidHub",
|
|
5
5
|
"description": "Cloud saves, analytics and the coin economy for Unity WebGL games published on SquidHub. Installs the C# wrapper, the .jslib half and the page bridge, and rewrites the exported index.html so it survives the platform's CSP.",
|
|
6
6
|
"unity": "2021.3",
|