mirror of
https://github.com/different-ai/openwork
synced 2026-04-25 17:15:34 +02:00
fix: restore migrated share skill links (#1335)
* fix(docs): restore migrated share skill links Republish the example skill bundles on share.openworklabs.com so the docs point at live imports again, and align share bundle examples with the current publisher host. * fix(server): use canonical shared bundle data urls Rebuild trusted share fetch URLs to the share service's canonical /b/:id/data endpoint and cover the path with the live provider-config-helper bundle URL.
This commit is contained in:
@@ -3,35 +3,33 @@ import { describe, expect, test } from "bun:test";
|
||||
import { ApiError } from "./errors.js";
|
||||
import { normalizeSharedBundleFetchUrl, resolveTrustedSharedBundleFetchUrl } from "./share-bundles.js";
|
||||
|
||||
const VALID_SKILL_BUNDLE_ID = "01KNBQDQAK41VZSZDF5G9MW4MW";
|
||||
const VALID_SKILL_SHARE_URL = `https://share.openworklabs.com/b/${VALID_SKILL_BUNDLE_ID}`;
|
||||
const VALID_SKILL_DATA_URL = `${VALID_SKILL_SHARE_URL}/data`;
|
||||
|
||||
describe("normalizeSharedBundleFetchUrl", () => {
|
||||
test("rewrites human share pages to the canonical data endpoint", () => {
|
||||
const normalized = normalizeSharedBundleFetchUrl(
|
||||
new URL("https://share.openwork.software/b/01ARZ3NDEKTSV4RRFFQ69G5FAV?format=json"),
|
||||
);
|
||||
const normalized = normalizeSharedBundleFetchUrl(new URL(`${VALID_SKILL_SHARE_URL}?format=json`));
|
||||
|
||||
expect(normalized.toString()).toBe("https://share.openwork.software/b/01ARZ3NDEKTSV4RRFFQ69G5FAV/data");
|
||||
expect(normalized.toString()).toBe(VALID_SKILL_DATA_URL);
|
||||
});
|
||||
|
||||
test("keeps existing data endpoints and strips redundant format", () => {
|
||||
const normalized = normalizeSharedBundleFetchUrl(
|
||||
new URL("https://share.openwork.software/b/01ARZ3NDEKTSV4RRFFQ69G5FAV/data?format=json&download=1"),
|
||||
);
|
||||
const normalized = normalizeSharedBundleFetchUrl(new URL(`${VALID_SKILL_DATA_URL}?format=json&download=1`));
|
||||
|
||||
expect(normalized.toString()).toBe(
|
||||
"https://share.openwork.software/b/01ARZ3NDEKTSV4RRFFQ69G5FAV/data?download=1",
|
||||
);
|
||||
expect(normalized.toString()).toBe(`${VALID_SKILL_DATA_URL}?download=1`);
|
||||
});
|
||||
});
|
||||
|
||||
describe("resolveTrustedSharedBundleFetchUrl", () => {
|
||||
test("rebuilds fetch URLs from the configured publisher origin", () => {
|
||||
const resolved = resolveTrustedSharedBundleFetchUrl("https://share.openworklabs.com/b/01ARZ3NDEKTSV4RRFFQ69G5FAV?download=1");
|
||||
const resolved = resolveTrustedSharedBundleFetchUrl(`${VALID_SKILL_SHARE_URL}?download=1`);
|
||||
|
||||
expect(resolved.toString()).toBe("https://share.openworklabs.com/b/01ARZ3NDEKTSV4RRFFQ69G5FAV/data?format=json");
|
||||
expect(resolved.toString()).toBe(VALID_SKILL_DATA_URL);
|
||||
});
|
||||
|
||||
test("rejects bundle URLs that use another origin", () => {
|
||||
expect(() => resolveTrustedSharedBundleFetchUrl("https://evil.example/b/01ARZ3NDEKTSV4RRFFQ69G5FAV")).toThrow(
|
||||
expect(() => resolveTrustedSharedBundleFetchUrl(`https://evil.example/b/${VALID_SKILL_BUNDLE_ID}`)).toThrow(
|
||||
new ApiError(
|
||||
400,
|
||||
"untrusted_bundle_url",
|
||||
|
||||
@@ -67,7 +67,6 @@ export function resolveTrustedSharedBundleFetchUrl(bundleUrl: unknown): URL {
|
||||
const bundleId = extractBundleId(inputUrl);
|
||||
trustedBaseUrl.pathname = `/b/${bundleId}/data`;
|
||||
trustedBaseUrl.search = "";
|
||||
trustedBaseUrl.searchParams.set("format", "json");
|
||||
return trustedBaseUrl;
|
||||
}
|
||||
|
||||
|
||||
@@ -31,7 +31,7 @@ export function LandingCloudWorkersCard(props: Props) {
|
||||
<path d="M7 11V7a5 5 0 0 1 10 0v4" />
|
||||
</svg>
|
||||
<span className="truncate text-[11px] text-gray-400">
|
||||
share.openwork.software/b/01KMK...
|
||||
share.openworklabs.com/b/01KNB...
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -27,6 +27,6 @@ Inside `/path-to-your-workspace/.config/opencode/opencode.json`:
|
||||
}
|
||||
```
|
||||
|
||||
We've also built a [custom skill](https://share.openwork.software/b/01KKZHV7CX178KH4FB5XGCM4XW) that you can import in Openwork following [this guide](/importing-a-skill).
|
||||
We've also built a [custom skill](https://share.openworklabs.com/b/01KNBQDQAK41VZSZDF5G9MW4MW) that you can import in Openwork following [this guide](/importing-a-skill).
|
||||
|
||||
The following tutorial covers how to [import a custom provider using the skill](https://x.com/getopenwork/status/2034129039317995908?s=20).
|
||||
|
||||
@@ -15,7 +15,7 @@ We recommend (1) and (3) because they match the built-in OpenWork flows most clo
|
||||
|
||||
## Importing an existing skill with a share URL
|
||||
|
||||
When you have an OpenWork [share URL](https://share.openwork.software/b/01KKPSGYSGDRRWNTAACAMZY3PF), click `Open in OpenWork`.
|
||||
When you have an OpenWork [share URL](https://share.openworklabs.com/b/01KNBQDPGSS39J4AG3MN9FVZ73), click `Open in OpenWork`.
|
||||
|
||||
<Frame>
|
||||

|
||||
|
||||
@@ -23,7 +23,7 @@ You can share a `SKILL.md` by clicking under `Your_Workspace` \> `Skills`
|
||||

|
||||
</Frame>
|
||||
|
||||
Then, on `Create Link` which will create a custom page for the skill at `share.openwork.software/b/:skill_id`
|
||||
Then, on `Create Link` which will create a custom page for the skill at `share.openworklabs.com/b/:skill_id`
|
||||
|
||||
<Frame>
|
||||

|
||||
@@ -33,4 +33,4 @@ This creates a url that you can share with other people so they can `copy the sk
|
||||
|
||||
<Frame>
|
||||

|
||||
</Frame>
|
||||
</Frame>
|
||||
|
||||
Reference in New Issue
Block a user