Skip to content

Commit

Permalink
use editor url for share links
Browse files Browse the repository at this point in the history
  • Loading branch information
riknoll committed Nov 7, 2024
1 parent bf35dec commit 9cafb26
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions packages/makecode-core/src/share.ts
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,10 @@ export async function shareProjectAsync(opts: ProjectOptions) {
const prj = await resolveProject(opts);
const req = await createShareLinkRequestAsync(prj);

let siteRoot = prj.editor.website;
let siteRoot = new URL(prj.editor.website).origin;
if (!siteRoot.endsWith("/")) {
siteRoot += "/";
}

const res = await host().requestAsync({
url: apiRoot + "/api/scripts",
Expand All @@ -55,9 +58,6 @@ export async function shareProjectAsync(opts: ProjectOptions) {

if (res.statusCode === 200) {
const resJSON = JSON.parse(res.text!)
if (!siteRoot.endsWith("/")) {
siteRoot += "/";
}
return siteRoot + resJSON.shortid
}

Expand Down

0 comments on commit 9cafb26

Please sign in to comment.