JM Tech Power

Guides

Link straight to a project file: raw source links and latest-release downloads

← 全部文章 邮箱 RSS Atom

A project page is made for people. Scripts, install commands and README badges need something simpler: an address that returns just the file. Every public project on JM Tech Power now has two kinds of such addresses.

1. One source file: /source/

Put /source/ and the file's path after the project's address:

https://jmtechpower.com/<owner>/<project>/source/<path>

Our own Two Armies game server installs this way, with one command:

curl -fsSL https://jmtechpower.com/jm-tech-power-official/two-armies/source/server/get.sh | sudo bash
  • You get the file from the newest commit on the default branch of the pushed repository. If nothing was pushed, it comes from the newest release that has a source ZIP — the same files the Source tab shows.
  • Add ?ref= with a branch or tag name to pick another pushed version, or ?version= with a release version to read that release's source ZIP.
  • Text comes back as plain text, so it shows in the browser. Any other file is sent as a download. Nothing is ever run as a web page.
  • A file can be up to 5 MB.

2. The newest release: /releases/latest/download/

https://jmtechpower.com/<owner>/<project>/releases/latest/download/<file>

This link always leads to that file in the project's newest release. You may leave the version out of the name: if the release 0.20.2 holds two-armies-server-0.20.2.tar.gz, then

https://jmtechpower.com/jm-tech-power-official/two-armies/releases/latest/download/two-armies-server.tar.gz

finds it, and the same link finds the next version after you publish it. Put it in your README or install script once and never change it.

When it does not work

  • Both kinds work only for public projects. A private project answers Not found, even when you are signed in: these addresses never look at who you are and never set cookies.
  • Errors are one short line of plain text, such as No file named tool.zip in release 1.2.0, so curl -f stops with an error instead of saving a web page.
  • Only the newest release is searched. If that release does not have the file, the link fails — it does not fall back to an older release.
  • A file bigger than 5 MB answers File too large; give people the release download instead.

Before you pipe a script into a shell, open its /source/ link in your browser and read it. To check a download, see how to check a SHA-256. More on projects: project guides and the Projects page. More guides at https://jmtechpower.com/articles.

评论 (0)

暂无评论,成为第一个评论者!