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

Mirroring index files #21

Open
andrewshell opened this issue Jul 7, 2021 · 7 comments
Open

Mirroring index files #21

andrewshell opened this issue Jul 7, 2021 · 7 comments

Comments

@andrewshell
Copy link

Following instructions here: https://github.com/scripting/pagePark#v0818-62221-by-dw

What I've done

I have an OPML file hosted: http://lo2.geekity.com/andrewshell/myOutlines/pagepark-howto-glitch.opml

In PagePark for the domain glitch-howto.shll.me I have the file config.json with the following contents:

{
  "mirrors": {
    "/index.opml": "http://lo2.geekity.com/andrewshell/myOutlines/pagepark-howto-glitch.opml"
  }
}

What Happens

If I go to http://glitch-howto.shll.me/index.opml it shows the rendered OPML file as expected.

If I go to http://glitch-howto.shll.me/ I see "The file was not found."

What I Expected

I would expect that if I went to http://glitch-howto.shll.me/ I would see the same output as http://glitch-howto.shll.me/index.opml

Alternative Attempt

If I have the file config.json with the following contents:

{
  "mirrors": {
    "/": "http://lo2.geekity.com/andrewshell/myOutlines/pagepark-howto-glitch.opml"
  }
}

When I go to http://glitch-howto.shll.me/ the OPML contents are returned as text/html but not processed.

See: http://glitch-howto-alt.shll.me/

@scripting
Copy link
Owner

@andrewshell -- thanks for this report.

I want to see if I understand this, from another point of view.

  1. You have defined an index.opml file in the mirrors structure, but pagepark isn't looking in mirrors when it's looking for an index file.
  2. So there is no way to use a mirror to specify an index file. No matter what you do it will be ignored.
  3. That is indeed the way the code is written.
  4. What you want to do makes sense.
  5. It is not a simple change to the code, it's the kind of thing I have to wait to do until I'm deep into PP, otherwise whatever I do will break other things.
  6. Other people are having the problem.

@scripting
Copy link
Owner

scripting commented Jul 25, 2021

I believe I have a solution to this problem.

I approached it fresh, I want to serve "/" from a remote location. It's an OPML file. It should render properly. Let's see what happens.

This config.json file should do it:

{
    "mirrors": {
        "/": "http://hosting.opml.org/dave/spec/states.opml"
        }
    }

And as everyone found out, it doesn't do what we wanted. 😢

On investigation, I found it serving the file as literal unrendered text, and setting its content-type to text/html.

So the simplest solution with zero chance of breakage (something you have to avoid) is to let you set the default extension for files that don't have extensions. So it would serve "/" as if it were an OPML file.

And it works. ;-)

Here's a test site:

http://defaultextensiondemo.userland.com

And here's the config.json file --

{
	"defaultExtension": "opml",
	"mirrors": {
		"/": "http://hosting.opml.org/dave/spec/states.opml"
		}
	}

The new feature is released in v0.8.21. Documented here.

@scripting
Copy link
Owner

BTW, please verify this works, or doesn't, asap -- while I still have this loaded into my brain.

The problem is when the reports come in long after I've moved on, that's when the fixes take a long time.

Thanks..

@andrewshell
Copy link
Author

I just updated PagePark and it looks like it works perfectly. http://glitch-howto-alt.shll.me/

@scripting
Copy link
Owner

scripting commented Jul 25, 2021

A couple of changes in v0.8.22 --

  1. Rewrote the docs for config.defaultExtension. What I had there didn't make any sense.
  2. You can specify an extension with or without the leading dot.

@scripting
Copy link
Owner

@andrewshell -- thanks for confirming that the v0.8.21 works. Now I can move on to the next project with confidence that I didn't blow up PagePark users. :-)

@gwthompson
Copy link

I just updated my code and it's working perfectly! I was on vacation last week in OBX and only got around to updating everything tonight! Thanks Dave!!

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

3 participants