eyeling 1.24.19 → 1.24.20
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/HANDBOOK.md +1 -1
- package/package.json +1 -1
- package/test/playground.test.js +15 -3
package/HANDBOOK.md
CHANGED
|
@@ -3760,7 +3760,7 @@ When a user does want a portable link, the **Copy share link** button creates on
|
|
|
3760
3760
|
- edited programs are shared with a compact compressed `?state=...` payload,
|
|
3761
3761
|
- default option values are omitted from that payload to keep links small.
|
|
3762
3762
|
|
|
3763
|
-
If a generated compact share link is still very long, the playground reveals a **Create TinyURL** option. The threshold is intentionally conservative, and the shortener handoff is explicit rather than automatic: after the user chooses that option, the browser uses a TinyURL API token stored locally in that browser to create the short link and copy it to the clipboard. If no token is provided, or if the API request fails, the playground falls back to opening TinyURL
|
|
3763
|
+
If a generated compact share link is still very long, the playground reveals a **Create TinyURL** option. The threshold is intentionally conservative, and the shortener handoff is explicit rather than automatic: after the user chooses that option, the browser uses a TinyURL API token stored locally in that browser to create the short link and copy it to the clipboard. The API request is sent as a POST with `referrerPolicy: "no-referrer"`, so an already-long playground URL is not leaked again as a large `Referer` header. If no token is provided, or if the API request fails, the playground falls back to opening TinyURL without putting the long URL in TinyURL's address bar, and it copies the compact share link so it can be pasted manually. This avoids silently sending encoded editor content to a third-party service while still making the account-backed TinyURL workflow one click after setup.
|
|
3764
3764
|
|
|
3765
3765
|
This keeps everyday use pleasant while preserving the important tutorial and issue-reporting workflow: a link can still capture the imported resource, the local editable overlay, background-knowledge mode, proof-comments mode, and HTTPS-dereferencing mode.
|
|
3766
3766
|
|
package/package.json
CHANGED
package/test/playground.test.js
CHANGED
|
@@ -797,7 +797,18 @@ async function main() {
|
|
|
797
797
|
const originalFetch = window.fetch;
|
|
798
798
|
let seen = null;
|
|
799
799
|
window.fetch = async (url, options) => {
|
|
800
|
-
|
|
800
|
+
options = options || {};
|
|
801
|
+
seen = {
|
|
802
|
+
url: String(url || ''),
|
|
803
|
+
options: {
|
|
804
|
+
method: options.method,
|
|
805
|
+
headers: options.headers,
|
|
806
|
+
body: options.body,
|
|
807
|
+
cache: options.cache,
|
|
808
|
+
referrerPolicy: options.referrerPolicy,
|
|
809
|
+
hasSignal: !!options.signal,
|
|
810
|
+
},
|
|
811
|
+
};
|
|
801
812
|
return {
|
|
802
813
|
ok: true,
|
|
803
814
|
status: 200,
|
|
@@ -973,8 +984,8 @@ ${JSON.stringify(last, null, 2)}`);
|
|
|
973
984
|
const longShare = await makeShareUrlDiagnosticsInPage();
|
|
974
985
|
assert.ok(longShare.length > longShare.threshold, `Expected test share URL to exceed threshold (${longShare.length} <= ${longShare.threshold})`);
|
|
975
986
|
assert.equal(longShare.needsShortener, true, 'Expected oversized share URL to request a shortener option');
|
|
976
|
-
assert.
|
|
977
|
-
assert.
|
|
987
|
+
assert.equal(longShare.shortenerUrl, 'https://tinyurl.com/app', 'Expected TinyURL app fallback handoff to avoid embedding the huge URL');
|
|
988
|
+
assert.equal(longShare.shortenerUrl.includes(encodeURIComponent(longShare.url).slice(0, 40)), false, 'Expected shortener fallback URL not to carry the generated share URL');
|
|
978
989
|
const tinyUrlCreated = await createTinyUrlWithStubInPage(longShare.url, 'test-token-123', {
|
|
979
990
|
data: { tiny_url: 'https://tinyurl.com/eyeling-test' },
|
|
980
991
|
});
|
|
@@ -982,6 +993,7 @@ ${JSON.stringify(last, null, 2)}`);
|
|
|
982
993
|
assert.equal(tinyUrlCreated.seen.url, 'https://api.tinyurl.com/create', 'Expected TinyURL API create endpoint');
|
|
983
994
|
assert.equal(tinyUrlCreated.seen.options.method, 'POST', 'Expected TinyURL API POST request');
|
|
984
995
|
assert.equal(tinyUrlCreated.seen.options.headers.Authorization, 'Bearer test-token-123', 'Expected bearer token authorization');
|
|
996
|
+
assert.equal(tinyUrlCreated.seen.options.referrerPolicy, 'no-referrer', 'Expected TinyURL API request not to send a long Referer');
|
|
985
997
|
assert.match(String(tinyUrlCreated.seen.options.body || ''), /"url":/, 'Expected TinyURL API body to include the long URL');
|
|
986
998
|
endTest();
|
|
987
999
|
|