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

new URL format #45

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open

new URL format #45

wants to merge 3 commits into from

Conversation

milahu
Copy link

@milahu milahu commented Jul 18, 2020

old format /?url=https%3A%2F%2Fhost%2Fpath%2Ffile.jpg&jpeg=0&bw=0&l=50
new format /https/host/path/file.jpg.c50.webp
solve issue #22
new format must be supported by server (bandwidth-hero-proxy)

old format /?url=https%3A%2F%2Fhost%2Fpath%2Ffile.jpg&jpeg=0&bw=0&l=50
new format /https/host/path/file.jpg.c50.webp
solve issue ayastreb#22 
new format must be supported by server (bandwidth-hero-proxy)
@milahu
Copy link
Author

milahu commented Jul 18, 2020

todo: append ".c20.webp" after path but before query, not after query
so input "/path/file.jpg?id=1234" becomes "/path/file.jpg.c20.webp?id=1234"
on the server (bandwidth-hero-proxy), this path suffix is removed to get the original URL

@milahu
Copy link
Author

milahu commented Jul 20, 2020

here is a signed addon file for permanent install: bandwidth-hero-2.1.4-fx-c046fc1.xpi

to deploy the new proxy version to heroku, use the repository https://github.com/milahu/bandwidth-hero-proxy

@milahu
Copy link
Author

milahu commented Jul 21, 2020

version 0e4b079 of signed addon: bandwidth-hero-2.1.4-fx-0e4b079.xpi

now we can pass arbitrary parameters to the proxy server

currently, only appendPath is used, like
/appendPath=%2Ffile.jpg/https/host/path.c50.webp
so the server can reconstruct the original URL https://host/path/file.jpg
cos decodeURIComponent("%2Ffile.jpg") == "/file.jpg"

how is this useful?
some images have an URL like //host/path/ with http-301-redirection to an image file
so we would get an image filename like ".c20.webp"
version 0e4b079 removes the trailing slash so we get "path.c20.webp"
the removed trailing slash is stored in appendPath and re-attached on the proxy server
alternative: resolve the redirect on client side and use the final image URL

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

Successfully merging this pull request may close these issues.

None yet

1 participant