Skip to content
This repository has been archived by the owner on Apr 13, 2024. It is now read-only.

Set the Puter SDK URL in the config #82

Merged
merged 1 commit into from
Apr 12, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion assets/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
<link rel="stylesheet" href="xterm.css">
<link rel="stylesheet" href="normalize.css">
<link rel="stylesheet" href="style.css">
<script src="https://puter.com/puter.js/v2"></script>
<script src="__SDK_URL__"></script>
<script src="config.js"></script>
<script src="bundle.js"></script>
<script>
Expand Down
3 changes: 2 additions & 1 deletion config/dev.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,5 +18,6 @@
*/
globalThis.__CONFIG__ = {
"origin": "https://puter.local:8080",
"shell.href": "https://puter.local:8081"
"shell.href": "https://puter.local:8081",
"sdk_url": "http://puter.localhost:4100/sdk/puter.js",
};
3 changes: 2 additions & 1 deletion config/release.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,5 +18,6 @@
*/
globalThis.__CONFIG__ = {
origin: location.origin,
'shell.href': location.origin + '/puter-shell/'
'shell.href': location.origin + '/puter-shell/',
sdk_url: 'https://puter.com/puter.js/v2',
};
9 changes: 8 additions & 1 deletion rollup.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ import commonjs from '@rollup/plugin-commonjs';
import copy from 'rollup-plugin-copy';

const configFile = process.env.CONFIG_FILE ?? 'config/dev.js';
await import(`./${configFile}`);

export default {
input: "src/main_puter.js",
Expand All @@ -33,7 +34,13 @@ export default {
commonjs(),
copy({
targets: [
{ src: 'assets/index.html', dest: 'dist' },
{
src: 'assets/index.html',
dest: 'dist',
transform: (contents, name) => {
return contents.toString().replace('__SDK_URL__', globalThis.__CONFIG__.sdk_url);
}
},
{ src: 'assets/shell.html', dest: 'dist' },
{ src: 'assets/normalize.css', dest: 'dist' },
{ src: 'assets/style.css', dest: 'dist' },
Expand Down