fix(fedora): route through kernel.org mirror
Use the kernel.org Fedora mirror to avoid upstream bot challenges. Preserve existing /pub/fedora/linux request paths with a Fedora transformer. Closes #271
This commit is contained in:
1 parent
3eb06027eb
commit
8d8614a8ad
4 files changed
+31
-4
No files matched your search
@@ -330,7 +330,7 @@ instance, simply replace the domain and add the platform prefix:
|
||||
| Flathub | `flathub` | `https://dl.flathub.org/...` | `https://xget.xi-xu.me/flathub/...` |
|
||||
| Debian | `debian` | `https://deb.debian.org/...` | `https://xget.xi-xu.me/debian/...` |
|
||||
| Ubuntu | `ubuntu` | `https://archive.ubuntu.com/...` | `https://xget.xi-xu.me/ubuntu/...` |
|
||||
| Fedora | `fedora` | `https://dl.fedoraproject.org/...` | `https://xget.xi-xu.me/fedora/...` |
|
||||
| Fedora | `fedora` | `https://mirrors.kernel.org/fedora/...` | `https://xget.xi-xu.me/fedora/...` |
|
||||
| Rocky Linux | `rocky` | `https://download.rockylinux.org/...` | `https://xget.xi-xu.me/rocky/...` |
|
||||
| openSUSE | `opensuse` | `https://download.opensuse.org/...` | `https://xget.xi-xu.me/opensuse/...` |
|
||||
| Arch Linux | `arch` | `https://geo.mirror.pkgbuild.com/...` | `https://xget.xi-xu.me/arch/...` |
|
||||
@@ -746,10 +746,10 @@ https://archive.ubuntu.com/ubuntu/pool/main/g/git/git_2.34.1-1ubuntu1.9_amd64.de
|
||||
https://xget.xi-xu.me/ubuntu/ubuntu/pool/main/g/git/git_2.34.1-1ubuntu1.9_amd64.deb
|
||||
|
||||
# Fedora package original URL
|
||||
https://dl.fedoraproject.org/pub/fedora/linux/releases/39/Everything/x86_64/os/Packages/n/nginx-1.24.0-1.fc39.x86_64.rpm
|
||||
https://mirrors.kernel.org/fedora/releases/39/Everything/x86_64/os/Packages/n/nginx-1.24.0-1.fc39.x86_64.rpm
|
||||
|
||||
# Converted (add fedora prefix)
|
||||
https://xget.xi-xu.me/fedora/pub/fedora/linux/releases/39/Everything/x86_64/os/Packages/n/nginx-1.24.0-1.fc39.x86_64.rpm
|
||||
https://xget.xi-xu.me/fedora/releases/39/Everything/x86_64/os/Packages/n/nginx-1.24.0-1.fc39.x86_64.rpm
|
||||
|
||||
# Rocky Linux package original URL
|
||||
https://download.rockylinux.org/pub/rocky/9/BaseOS/x86_64/os/Packages/b/bash-5.1.8-6.el9.x86_64.rpm
|
||||
|
||||
@@ -57,7 +57,7 @@ export const PLATFORM_CATALOG = {
|
||||
// Linux Distributions
|
||||
debian: 'https://deb.debian.org',
|
||||
ubuntu: 'https://archive.ubuntu.com',
|
||||
fedora: 'https://dl.fedoraproject.org',
|
||||
fedora: 'https://mirrors.kernel.org/fedora',
|
||||
rocky: 'https://download.rockylinux.org',
|
||||
opensuse: 'https://download.opensuse.org',
|
||||
arch: 'https://geo.mirror.pkgbuild.com',
|
||||
|
||||
@@ -56,6 +56,15 @@ function transformCratesPath(transformedPath) {
|
||||
return `/api/v1/crates${transformedPath}`;
|
||||
}
|
||||
|
||||
/**
|
||||
* Applies Fedora mirror path normalization.
|
||||
* @param {string} transformedPath
|
||||
* @returns {string} Normalized Fedora mirror path.
|
||||
*/
|
||||
function transformFedoraPath(transformedPath) {
|
||||
return transformedPath.replace(/^\/pub\/fedora\/linux(?=\/|$)/, '') || '/';
|
||||
}
|
||||
|
||||
/**
|
||||
* Applies Jenkins update-center path normalization.
|
||||
* @param {string} transformedPath
|
||||
@@ -88,6 +97,7 @@ function transformJenkinsPath(transformedPath) {
|
||||
/** @type {{ [key: string]: (transformedPath: string) => string }} */
|
||||
const PLATFORM_PATH_TRANSFORMERS = {
|
||||
crates: transformCratesPath,
|
||||
fedora: transformFedoraPath,
|
||||
jenkins: transformJenkinsPath
|
||||
};
|
||||
|
||||
|
||||
@@ -143,6 +143,19 @@ describe('Platform Configuration', () => {
|
||||
);
|
||||
});
|
||||
|
||||
it('should transform Fedora mirror paths correctly', () => {
|
||||
expect(
|
||||
transformPath(
|
||||
'/fedora/pub/fedora/linux/releases/43/Everything/x86_64/os/repodata/repomd.xml',
|
||||
'fedora'
|
||||
)
|
||||
).toBe('/releases/43/Everything/x86_64/os/repodata/repomd.xml');
|
||||
|
||||
expect(
|
||||
transformPath('/fedora/releases/43/Everything/x86_64/os/repodata/repomd.xml', 'fedora')
|
||||
).toBe('/releases/43/Everything/x86_64/os/repodata/repomd.xml');
|
||||
});
|
||||
|
||||
it('should transform container registry paths correctly', () => {
|
||||
expect(
|
||||
transformPath('/cr/ghcr/v2/nginxinc/nginx-unprivileged/manifests/latest', 'cr-ghcr')
|
||||
@@ -204,6 +217,10 @@ describe('Platform Configuration', () => {
|
||||
expect(PLATFORMS.flathub).toBe('https://dl.flathub.org');
|
||||
});
|
||||
|
||||
it('should use a Fedora mirror that avoids upstream bot challenges', () => {
|
||||
expect(PLATFORMS.fedora).toBe('https://mirrors.kernel.org/fedora');
|
||||
});
|
||||
|
||||
it('should have correct container registry base URLs', () => {
|
||||
expect(PLATFORMS['cr-ghcr']).toBe('https://ghcr.io');
|
||||
expect(PLATFORMS['cr-gcr']).toBe('https://gcr.io');
|
||||
|
||||
Reference in new issue
Block a user