Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Feature Request] Option to disable local backend (filesystem) when developing locally #173

Closed
dallyh opened this issue Jun 26, 2024 · 2 comments
Assignees
Labels
enhancement New feature or request

Comments

@dallyh
Copy link

dallyh commented Jun 26, 2024

Hello, I would like to simply disable the local backend when testing live previews of a site, and also to test automatic deployments etc while running the live site preview. I've searched through the source code, and this is currently possible but with workarounds, because local backend is getting detected by the localhost URL:

// Local editing needs a secure context, either `http://localhost` or `http://*.localhost`
// https://developer.mozilla.org/en-US/docs/Web/Security/Secure_Contexts
const isLocal = !!window.location.hostname.match(/^(?:.+\.)?localhost$/);
// Netlify/Decap CMS uses `proxy` as the backend name when running the local proxy server and
// leaves it in local storage. Sveltia CMS uses `local` instead.
const _backendName =
_user?.backendName?.replace('proxy', 'local') ??
(isLocal ? 'local' : get(siteConfig)?.backend?.name);

Thanks!

PS. I hope I've pointed to the correct code :)

@dallyh dallyh changed the title [Feature Reqquest] Option to disable local backend (filesystem) when developing locally [Feature Request] Option to disable local backend (filesystem) when developing locally Jun 26, 2024
@kyoshino
Copy link
Member

kyoshino commented Jun 26, 2024

You mean, you’d like to use a remote backend from the local instance? There is a manual workaround for it:

  1. Open the browser’s DevTools
  2. Open the Application tab (in Chrome) or Storage tab (in Firefox)
  3. Create a new local storage item: key: sveltia-cms.user, value: {"backendName":"github"}

This allows you to sign in to GitHub. If it doesn’t work,

  1. Sign in to the remote instance
  2. Open the browser’s DevTools
  3. Copy the sveltia-cms.user local storage value with an API token
  4. Go back to the local instance
  5. Open the browser’s DevTools
  6. Create a new local storage item: key: sveltia-cms.user, value: (copied value)

Well, so I think Sveltia CMS should provide 2 options on the sign in page, Local or GitHub, so you don’t have to do this manually 🙂

You can disable automatic deployments with the backend config.

@kyoshino kyoshino self-assigned this Jun 26, 2024
@kyoshino kyoshino added the enhancement New feature or request label Jun 26, 2024
@kyoshino
Copy link
Member

kyoshino commented Jul 3, 2024

The fix shipped with v0.35.0 🚢

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants