pagePark icon indicating copy to clipboard operation
pagePark copied to clipboard

Mirroring index files

Open andrewshell opened this issue 4 years ago • 7 comments

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/

andrewshell avatar Jul 07 '21 17:07 andrewshell

@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 avatar Jul 23 '21 22:07 scripting

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. :cry:

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 avatar Jul 25 '21 16:07 scripting

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..

scripting avatar Jul 25 '21 17:07 scripting

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

andrewshell avatar Jul 25 '21 17:07 andrewshell

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 avatar Jul 25 '21 21:07 scripting

@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. :-)

scripting avatar Jul 26 '21 14:07 scripting

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!!

gwthompson avatar Jul 27 '21 03:07 gwthompson