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

Is file saving possible or is it a desired feature? #112

Closed
Esowteric opened this issue May 31, 2016 · 33 comments
Closed

Is file saving possible or is it a desired feature? #112

Esowteric opened this issue May 31, 2016 · 33 comments
Labels

Comments

@Esowteric
Copy link

Hi, sorry if this is a naive question. My first computer was a BBC B, but I'm new to jsbeeb.

I checked out the Philosopher's Quest with Save Game disk and the InterWord ROM, and when I try to save the game or a document, I get a read-only access message.

The browser I've been using is the latest Firefox.

Is file saving possible or is it a desired feature?

Thanks a lot,
Eric T.

@mattgodbolt
Copy link
Owner

Hi!

Thanks for the message. The current default is to mount the discs read-only: this is because in general Javascript can't write them back (there's no built-in access to the file system).

jsbeeb supports in-browser discs, in a very limited fashion. With this one can have read-write discs that are local to the exact browser you're running. Obviously this isn't as good as a general save system as if you use a different browser on another computer you won't have your saves.

jsbeeb also allows you to use Google Drive to save your discs on "the cloud". This might work better in general.

Regrettably the UI for both these choices is very minimal. In order to set up a google drive disc you'll need to do some URL hackery, which is not great.

That said: I just tried to use the Google Drive approach and it's not currently working...I'll fix that and update.

Do you think storing the discs on Google Drive would work for you? If not I'll give you instructions on setting up a local disc. Are you running a local jsbeeb or using the public site?

@Esowteric
Copy link
Author

Hi Matt, I'm running jsbeeb on an Apache server on my intranet. The site is not public at the moment.
I have Dropbox, OneDrive, and a self-hosted ownCloud set up, and I have Google Drive installed but haven't used that yet. So instructions for either that or a local disc would be useful: whichever is easier for you.

Thanks for your help!
Eric T.

@Esowteric
Copy link
Author

Esowteric commented May 31, 2016

Okay, I now have Google Drive working fine. That would be the better option, I think.

@mattgodbolt
Copy link
Owner

Cool! I'm working on fixing why Google Drive isn't working quite how I expected it to...

@mattgodbolt
Copy link
Owner

(you don't need to install anything to use Google Drive: it's all done on the server in this case, FWIW)

@Esowteric
Copy link
Author

Cheers, Matt. Is it heavily coded for Google Drive or could I hack it to use my self-hosted ownCloud?

The reason I ask is that I'm trying to make all the facilities on the site self-contained, so that everything would work with local community wifi, if access to the internet was unavailable or compromised.

@mattgodbolt
Copy link
Owner

It's not at all heavily coded :) If you take a look at google-drive.js you can see how short the code is to get/put images. The main work will be putting in the support in main.js to create your loader/saver in the right places.

@mattgodbolt
Copy link
Owner

For what it's worth, the error I'm tracking appears to be a Chrome bug; so you should be able to play on with Google Drive (or your own setup). For completeness, here's a Drive howto:

  1. Create a Google Drive disc (go to "Discs" then Google Drive" and make a disc
  2. Note the giant ID of the form disc=gd%3A0123somebiglongthing - this is the disc ID
  3. Load up philosopher's quest as you normally would
  4. Hack the URL to have &disc2=gd%3A0123somebiglongthing from step 2. NB this is disc2
  5. Now you should be able to do *. and see philosopher's quest and *.1 and see your writable google drive disc

Depending on how you want to proceed, you can either *COPY all of Philo Quest onto your disc, and then reload it as disc 0, or if Philo Quest lets you, just save your save games on drive 1.

@Esowteric
Copy link
Author

Many thanks again, Matt! I'll give that a whirl.

@Esowteric
Copy link
Author

Esowteric commented May 31, 2016

Hi Matt, when I click on Disks -> From google drive and sign into google drive, I'm getting a "400 origin mismatch" response from the google server, even if I access my site from its public domain address.

If it's not too much hassle, do you have the instructions to create a local drive, please?

@mattgodbolt
Copy link
Owner

Hmm - what URL are you accessing it from? Can you share it just so I can
debug it in general?

The local image is created by putting: disc2=local:YYY where YYY is
something unique for your disc. So... something like:
http://bbc.godbolt.org/?disc=sth%3AAcornsoft%2FPhilosophersQuest.zip&disc2=local:pquest
should
do the trick!

On Tue, May 31, 2016 at 1:17 PM Eric Twose [email protected] wrote:

Hi Matt, when I sign in to google drive and click on Disks -> From google
drive, I'm getting a "400 origin mismatch" response from the google server,
even if I access my site from its public domain address.

If it's not too much hassle, do you have the instructions to create a
local drive, please?


You are receiving this because you commented.

Reply to this email directly, view it on GitHub
#112 (comment),
or mute the thread
https://github.com/notifications/unsubscribe/AAmsdaQMC8XOb4tMjh6hbcB0EwjOqC1Cks5qHHtWgaJpZM4IqtjU
.

@mattgodbolt
Copy link
Owner

(this is sorta covered in the README.md on
https://github.com/mattgodbolt/jsbeeb if that helps further!)

On Tue, May 31, 2016 at 2:31 PM Matt Godbolt [email protected] wrote:

Hmm - what URL are you accessing it from? Can you share it just so I can
debug it in general?

The local image is created by putting: disc2=local:YYY where YYY is
something unique for your disc. So... something like:
http://bbc.godbolt.org/?disc=sth%3AAcornsoft%2FPhilosophersQuest.zip&disc2=local:pquest should
do the trick!

On Tue, May 31, 2016 at 1:17 PM Eric Twose [email protected]
wrote:

Hi Matt, when I sign in to google drive and click on Disks -> From google
drive, I'm getting a "400 origin mismatch" response from the google server,
even if I access my site from its public domain address.

If it's not too much hassle, do you have the instructions to create a
local drive, please?


You are receiving this because you commented.

Reply to this email directly, view it on GitHub
#112 (comment),
or mute the thread
https://github.com/notifications/unsubscribe/AAmsdaQMC8XOb4tMjh6hbcB0EwjOqC1Cks5qHHtWgaJpZM4IqtjU
.

@Esowteric
Copy link
Author

Thanks, Matt. I'll check out the local disk for now.

I was wondering if the google API is only set up to allow access from certain domains (such as your own)?

jsbeeb is at:
http://aeon.local.mooo.com/jsbeeb/

Request Details:

proxy=oauth2relay527538013
immediate=false
scope=https://www.googleapis.com/auth/drive.file
origin=http://aeon.local.mooo.com
response_type=token
redirect_uri=postmessage
state=255368082|0.536828974
client_id=356883185894-bhim19837nroivv18p0j25gecora60r5.apps.googleusercontent.com
include_granted_scopes=true
jsh=m;/_/scs/apps-static/_/js/k=oz.gapi.en_GB.peFiNy_LqQ4.O/m=__features__/am=AQ/rt=j/d=1/rs=AGLTcCOVxBlq9Btd1wXG4-QPdbzCJ7CETQ

@Esowteric
Copy link
Author

disc2=local:mydrive creates a local disk OK; *DRIVE 1 at the BASIC prompt or in InterWord's menu lets me swap the drive; LOAD and SAVE then work in InterWord. So that's looking good.

@mattgodbolt
Copy link
Owner

Cool re: local drives. Google Drive is absolutely limited by domain: google only allow you to create access keys relevant for a domain (hadn't realised at that point you were running your own jsbeeb setup! yay :))

Sounds like local disc and/or your own bespoke storage solution is the way to go: I'd be delighted to help where I can if you get stuck!

@Esowteric
Copy link
Author

Esowteric commented May 31, 2016

Thanks again, Matt. I'll let the dust settle and come back to this.
In Philosopher's Quest, you can specify the drive and directory with
:1.$.MySaveFile

@mattgodbolt
Copy link
Owner

mattgodbolt commented May 31, 2016

FWIW "scansafe" - a site my company uses to filter for bad content, is giving an error for your aeon link:

Access Denied
The http://aeon.local.mooo.com/jsbeeb/ has been deemed by your administrator to be unsafe or unsuitable for you to access. The resource has been blocked. No further action is required.

Reason: Reputation-Viruses

Probably nothing; but thought I'd mention it :)

@Esowteric
Copy link
Author

I think that it's the free dynamic dns domain "mooo.com" that has the reputation, Matt. I've hardly had the site open, except to show folk stuff, as it is intended to be a local community wifi portal "aeon.local" with a load of self-contained apps like maps; wikipedia; webmail; forum; social media; etc; etc.

@mattgodbolt
Copy link
Owner

Ahhh righto! No worries there then: just wanted to make sure if it was your site you knew and could take appropriate action :)

@mattgodbolt
Copy link
Owner

@Esowteric Did you get a satisfactory solution using this approach?

@pau1ie
Copy link

pau1ie commented Dec 15, 2016

Sorry to hijack the issue. You said in the 31 May update that a disc can be written to, but I get

Disk read only

when I try to write to it. How do you make the disc read write?
I want to do this on http://bbcmicro.co.uk where some discs won't load the game unless they can write to the disc.

@mattgodbolt
Copy link
Owner

hi @pau1ie - as it stands the discs that load from the internet via URLs (as bbcmicro and jsbeeb's main site does when loading from the STH archive) are loaded as read-only.

My rationale is only discs that actually preserve their contents should be considered writable; else people might create saves and then reload the web page only to lose their data.

Can you give an example of a game that won't run without writing to the disc? Perhaps I can come up with either a flag to say "allow writes for this disc regardless" or at least add a warning to writing to an ephemeral disc instead (like a popup that says "hey; we wrote to the disc. It won't be saved on a reload..."

@pau1ie
Copy link

pau1ie commented Dec 16, 2016

I realise it is silly to write to the disc as changes will be lost, however, as @ahope1 mentioned in #140 there are a number of games that crash if they are on a read only disc, e.g.
http://bbcmicro.co.uk/jsbeeb/play.php?autoboot&disc=http://bbcmicro.co.uk/gameimg/discs/Disc999-PopQuizMaster.ssd
Boot the disc, select 3 to play the quiz, press enter to accept the defaults and you get a BASIC error:

Disk read only at line 176

If I could allow writing to the disc it would allow the configuration to be written and the game to be played. I would be happy to pass a flag on only those games that need it.

@mattgodbolt
Copy link
Owner

Sounds like a plan; maybe I'll do a pop up on the first disc write offering to make a local disc of the current image? Some UI work is needed for that, but the whole save thing/multiple discs etc is a great pain in the proverbials at the moment.

@ahope1
Copy link

ahope1 commented Dec 17, 2016

@mattgodbolt From the point of view of users of bbcmicro.co.uk, I think they'd want the game to "just work", so a popup asking about local discs, etc., might be a tad too "frictional", if u know what I mean. Could there be a URL param that gives us the option to silently enable write access to the main booted disc (while letting the default behaviour be as you described above)?

@mattgodbolt
Copy link
Owner

mattgodbolt commented Dec 17, 2016 via email

@ahope1
Copy link

ahope1 commented Sep 23, 2017

Any progress on this? It turns out there are quite a few games that need write-enabled discs in order to run.

@mattgodbolt
Copy link
Owner

Hi @ahope1 - sorry no progress. This is pretty embarrassing but things got busy and now 9 months have passed...thanks for reminding me. I'll have a think and see if something quick and easy can be done!

@davidgiven
Copy link

FWIW, I've got this compiler I want to demo... but it's a massive eight-stage pipeline with huge temporary files, so fairly obviously, it needs to run on a read/write disk! I don't particularly care about saving changes, so just storing the disk image temporarily in RAM is entirely good enough for me.

@mattgodbolt
Copy link
Owner

Change 5b9135f makes discs read/write by default (losing changes silently on window close)

@ahope1
Copy link

ahope1 commented Feb 10, 2018

@mattgodbolt Thanks, Matt! That's great. Any chance you could make disc-drive noises optional? That would be ideal for bbcmicro.co.uk, which currently uses an earlier version of JSBeeb which doesn't implement the noises and thus loads games "instantly"!

Currently, the game Zen (which happens to need write-access) is painfully slow to load if you use the latest version of JSBeeb:

https://bbc.godbolt.org/?autoboot&disc=https://dl.dropboxusercontent.com/s/us3zfxbufy0yutw/Disc111-ZenSTD.ssd

@scarybeasts
Copy link
Collaborator

Ok, I think we're close to being to close this issue:

I've crashed into a few quirks with the Google Drive support so I'll fix them, tag this issue, and close.

@scarybeasts
Copy link
Collaborator

Actually, re-opening issue #113 to fix some Google Drive issues and closing this issue.

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

No branches or pull requests

6 participants