Skip to content

Commit e7be457

Browse files
committed
docs: redirect the retired perms pages, add the missing playground examples
Both were left as follow-ups on the previous commit. Thirteen `puter.perms` method pages went when the surface collapsed onto `request(resource, details)`, and `requestAppData` moved to `/Perms/appData`. All fourteen had shipped, so an external link or a bookmark landed on nothing. The build already generates meta-refresh redirects from a map; they are entries in it now. Pages that only ever existed on the branch that removed them are deliberately absent — nobody can hold a link to a URL that was never published. Six documented APIs annotated a code block with a playground id but had no example file behind it, so the build warned on every one and the Try-it link resolved to nothing: `fs.share`, `fs.unshare`, `fs.listShared`, `fs.getShares`, `ai.txt2speech` with Speechify, and `ui.showFeedbackDialog`. The files are the documented blocks themselves, extracted rather than rewritten, so the example and the page it appears on cannot drift. Each is indexed in `examples.js` beside its siblings. The build now runs clean: 12 warnings to none.
1 parent 9bf49b7 commit e7be457

8 files changed

Lines changed: 148 additions & 0 deletions

File tree

src/docs/src/examples.js

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -193,6 +193,12 @@ const examples = [
193193
slug: 'ai-txt2speech-elevenlabs',
194194
source: '/playground/examples/ai-txt2speech-elevenlabs.html',
195195
},
196+
{
197+
title: 'Text to Speech with Speechify',
198+
description: 'Generate speech with Speechify voices using Puter.js AI API. Run and experiment with this TTS example in the playground.',
199+
slug: 'ai-txt2speech-speechify',
200+
source: '/playground/examples/ai-txt2speech-speechify.html',
201+
},
196202
{
197203
title: 'Text to Speech with Gemini',
198204
description: 'Generate speech with Gemini voices using Puter.js AI API. Run and experiment with this TTS example in the playground.',
@@ -378,6 +384,30 @@ const examples = [
378384
slug: 'fs-delete-directory',
379385
source: '/playground/examples/fs-delete-directory.html',
380386
},
387+
{
388+
title: 'Share a file',
389+
description: 'Share a file with another user using Puter.js filesystem API. Run and experiment with this sharing example in the playground.',
390+
slug: 'fs-share',
391+
source: '/playground/examples/fs-share.html',
392+
},
393+
{
394+
title: 'Stop sharing a file',
395+
description: 'Revoke a share with Puter.js filesystem API. Run and modify this example instantly in your browser.',
396+
slug: 'fs-unshare',
397+
source: '/playground/examples/fs-unshare.html',
398+
},
399+
{
400+
title: 'List what is shared with you',
401+
description: 'List items other people have shared with you using Puter.js filesystem API. Run and experiment with this example in the playground.',
402+
slug: 'fs-listShared',
403+
source: '/playground/examples/fs-listShared.html',
404+
},
405+
{
406+
title: 'See who a file is shared with',
407+
description: 'List the shares on one of your own files with Puter.js filesystem API. Run and modify this example in your browser.',
408+
slug: 'fs-getShares',
409+
source: '/playground/examples/fs-getShares.html',
410+
},
381411
],
382412
},
383413
{
@@ -713,6 +743,12 @@ const examples = [
713743
slug: 'ui-set-menubar',
714744
source: '/playground/examples/ui-set-menubar.html',
715745
},
746+
{
747+
title: 'Feedback dialog',
748+
description: 'Collect feedback with the built-in dialog from the Puter.js UI API. Run and experiment with this example directly in the playground.',
749+
slug: 'ui-show-feedback-dialog',
750+
source: '/playground/examples/ui-show-feedback-dialog.html',
751+
},
716752
],
717753
},
718754
{
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
<html>
2+
<body>
3+
<script src="https://js.puter.com/v2/"></script>
4+
<button id="play">Use Speechify voice</button>
5+
<script>
6+
document.getElementById('play').addEventListener('click', async ()=>{
7+
const audio = await puter.ai.txt2speech(
8+
"Hello! This sample uses the Speechify Geffen voice.",
9+
{
10+
provider: "speechify",
11+
model: "simba-3.2",
12+
voice: "geffen_32"
13+
}
14+
);
15+
audio.play();
16+
});
17+
</script>
18+
</body>
19+
</html>
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
<html>
2+
<body>
3+
<script src="https://js.puter.com/v2/"></script>
4+
<script>
5+
(async () => {
6+
await puter.fs.write('report.txt', 'Quarterly numbers');
7+
await puter.fs.share('report.txt', 'friend@example.com', 'read');
8+
9+
const shares = await puter.fs.getShares('report.txt');
10+
for (const share of shares) {
11+
puter.print(`${share.holder}: ${share.mode} (from ${share.issuer})<br>`);
12+
}
13+
})()
14+
</script>
15+
</body>
16+
</html>
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
<html>
2+
<body>
3+
<script src="https://js.puter.com/v2/"></script>
4+
<script>
5+
(async () => {
6+
const page = await puter.fs.listShared({ includeTotal: true });
7+
puter.print(`About ${page.total} item(s) shared with you<br>`);
8+
for (const share of page.items) {
9+
puter.print(`${share.path}${share.mode} from ${share.issuer}<br>`);
10+
}
11+
})()
12+
</script>
13+
</body>
14+
</html>
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
<html>
2+
<body>
3+
<script src="https://js.puter.com/v2/"></script>
4+
<script>
5+
(async () => {
6+
// (1) create a file
7+
await puter.fs.write('report.txt', 'Quarterly numbers');
8+
9+
// (2) share it, read-only
10+
const shares = await puter.fs.share('report.txt', 'friend@example.com');
11+
puter.print(`Shared with ${shares[0].holder} as ${shares[0].mode}<br>`);
12+
})()
13+
</script>
14+
</body>
15+
</html>
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
<html>
2+
<body>
3+
<script src="https://js.puter.com/v2/"></script>
4+
<script>
5+
(async () => {
6+
await puter.fs.write('report.txt', 'Quarterly numbers');
7+
await puter.fs.share('report.txt', 'friend@example.com');
8+
9+
const result = await puter.fs.unshare('report.txt', 'friend@example.com');
10+
puter.print(`Removed ${result.revoked} share(s)<br>`);
11+
})()
12+
</script>
13+
</body>
14+
</html>
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
<html>
2+
<body>
3+
<button id="feedback">Send us feedback</button>
4+
<script src="https://js.puter.com/v2/"></script>
5+
<script>
6+
document.getElementById('feedback').addEventListener('click', async () => {
7+
const sent = await puter.ui.showFeedbackDialog();
8+
if (sent) {
9+
puter.print('Thanks for your feedback!');
10+
}
11+
});
12+
</script>
13+
</body>
14+
</html>

src/docs/src/redirects.js

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,25 @@
11
const redirects = {
22
'/Introduction': '/',
3+
4+
// `puter.perms` collapsed one-method-per-task into `request(resource,
5+
// details)`, so these pages went. Every one of them shipped, which is the
6+
// reason for the redirect: an external link or a bookmark would otherwise
7+
// land on nothing. Pages that only ever existed on the branch that removed
8+
// them are deliberately absent — nobody could have a link to those.
9+
'/Perms/requestAppData': '/Perms/appData',
10+
'/Perms/requestEmail': '/Perms/request',
11+
'/Perms/requestManageApps': '/Perms/request',
12+
'/Perms/requestManageSubdomains': '/Perms/request',
13+
'/Perms/requestReadApps': '/Perms/request',
14+
'/Perms/requestReadDesktop': '/Perms/request',
15+
'/Perms/requestReadDocuments': '/Perms/request',
16+
'/Perms/requestReadPictures': '/Perms/request',
17+
'/Perms/requestReadSubdomains': '/Perms/request',
18+
'/Perms/requestReadVideos': '/Perms/request',
19+
'/Perms/requestWriteDesktop': '/Perms/request',
20+
'/Perms/requestWriteDocuments': '/Perms/request',
21+
'/Perms/requestWritePictures': '/Perms/request',
22+
'/Perms/requestWriteVideos': '/Perms/request',
323
};
424

525
module.exports = redirects;

0 commit comments

Comments
 (0)