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 there a way to load the .ged directly from the server ? #151

Open
hayoul opened this issue Apr 7, 2023 · 5 comments
Open

Is there a way to load the .ged directly from the server ? #151

hayoul opened this issue Apr 7, 2023 · 5 comments

Comments

@hayoul
Copy link

hayoul commented Apr 7, 2023

I am trying to load the GEDECOM file directly from the backend and not sure what function loads the file and how to hardcode the function or any variable to load file itself without passing any parameters in the URL or using the load file options. Can you help?
Bonus how would that load the file once the app is loaded and bypass the intro page?

@PeWu
Copy link
Owner

PeWu commented Apr 8, 2023

I'm not sure what you're trying to achieve. To load data directly from a URL, you can construct a URL like this:
https://pewu.github.io/topola-viewer/#/view?url=https://raw.githubusercontent.com/PeWu/topola/master/demo/data/family.ged

Topola by default uses a CORS proxy to load files because most web servers have CORS turned on. To turn off this behavior and load files directly from the web server, add &handleCors=false to the URL. E.g.
https://pewu.github.io/topola-viewer/#/view?url=https://raw.githubusercontent.com/PeWu/topola/master/demo/data/family.ged&handleCors=false

You can also have a look at https://github.com/develancer/topola-webpack for a way to create a self-contained package together with a GEDCOM file.

@hayoul
Copy link
Author

hayoul commented Apr 10, 2023

The idea is to only display the tree under embedded mode at the first load (without giving the option for the user to load other tree). And privacy reasons not provide or display the loaded ged file publicly.

Hence the question to directly load it from the host itself:

The app would load a ged directly and display the tree. Skipping your intro page.

Note that I have tried the webpack repo and used your embedded sample repository but the first one didn't include a search & export option and the second is not the most efficient on modern browsers. In both case the ged is loaded from public urls...

Do you mind giving me some clues on the functions I should look at? I'd be happy to contribute once I get a final version.

(Great job by the way)

@Czajkor
Copy link

Czajkor commented Apr 20, 2023

Hi.
Anyone managed to use OneDrive/GDrive/Dropbox with handleCors=false parameter? I never succeded
Greatly appreciated

@adamgross42
Copy link
Contributor

I was looking for something similar. I think the UI you are looking for is what is rendered at a URL like https://pewu.github.io/topola-viewer/#/view?url=https%3A%2F%2Fwebtreeprint.com%2Ftp_downloader.php%3Fpath%3Dfamous_gedcoms%2Fshakespeare.ged&embedded=true without putting the URL or hash of the GEDCOM file in the viewable URL (so that other viewers can't change it and point to a different GEDCOM file).

The goal would be to override the contents of the loaded file to point to a relative path on the web server, likely around here:

const gedcom = (message as GedcomMessage).gedcom;
if (!gedcom) {
return;
}
try {
const data = await loadGedcom('', gedcom);
const software = getSoftware(data.gedcom.head);
analyticsEvent('embedded_file_loaded', {
event_label: software,
});
resolve(data);

Granted, this is still a static/client-side website, so people could find the file path/contents in the page source anyhow. But it would still be useful for distribution of a simpler landing URL.

My solution so far is a simple landing page to wrap the longer URL and prevent most people from "breaking" it:

<html>
    <iframe src="https://<mywebserver>/#/view?url=https%3A%2F%2F<mywebserver>%2Fged.ged&embedded=true&handleCors=false" style="height:100%;width:100%;border:none;"></iframe>
</html>

@chrissb77
Copy link

Hello @hayoul ,
did you manage to do what you were looking for?
I am able to have the default page on my web server. I am able to load a gedcom file manually.
But I would like to have a specific file opened by default. I also do not want visitors to load other files.

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

No branches or pull requests

5 participants