Git Product home page Git Product logo

mirror-web's Introduction

TUNA 镜像站主页

注意:如果使用本项目搭建开源镜像站,必须

  • 移除所有与清华大学和 TUNA 相关的内容,包括且不限于站名、logo 和各种文档中出现的所有相关文本和图形;
  • 在网站首页恰当标注项目来源(tuna/mirror-web);
  • 遵循 GPLv2 协议开放修改后的源代码;

配置修改

除具体页面内容外,可修改的配置还包括:

  • _config.yml:Jekyll 配置文件,包括站点名称、描述、链接等;请不要轻易改动构建配置。
  • _data/options.yml:Jekyll 数据文件,主要包括各个镜像的简要描述和部分特殊镜像的配置。请仿照已有的配置进行修改。
  • geninfo/genisolist.ini:生成直接下载链接的配置文件。具体内容修改请提交到 mirrorz-org/genisolist

编译方式

本站使用 Jekyll 编写,并使用了 Vue、TypeScript、Vite 等前端框架开发。

由于本站部分文档使用 submodule 方式嵌入仓库,clone 后构建前请运行 git submodule update --init

本地开发

为正常运行,一些动态数据文件需要从镜像站下载:

wget https://mirrors.tuna.tsinghua.edu.cn/static/tunasync.json -O static/tunasync.json
mkdir -p static/status
wget https://mirrors.tuna.tsinghua.edu.cn/static/status/isoinfo.json -O static/status/isoinfo.json

编译前,先安装 Ruby (>= 3.0) 和 Node.js (>= 18),然后执行:

bundle install --deployment
npm install
bundle exec jekyll build # 编译到 `_site/` 目录,或者
bundle exec jekyll serve --livereload # 实时预览

在编译时可选的环境变量:

  • JEKYLL_ENV=production:编译生产版本(启用代码压缩),可能需要较长时间。
  • VISUALIZER=true:生成 Rollup 编译体积分析文件到 _stats.html

Docker 部署

仓库中的 Dockerfile.build 也可用于编译,推荐在生产环境部署时使用。

可用以下命令构建(如依赖无变化,镜像无需重复构建):

docker build -t tunathu/mirror-web -f Dockerfile.build .
docker pull tunathu/mirror-web # 或者直接拉取

构建时,仅需将本地目录挂载到容器中:

docker run --rm -v /path/to/mirror-web:/data tunathu/mirror-web

即可在 /path/to/mirror-web/_site 中得到编译结果。

编译流程

本项目使用 Jekyll 作为唯一入口完成全部的构建流程。其具体流程是:

  1. Jekyll 读取 _config.yml 和全部需要渲染的页面,并读取 _data 中的数据文件;
  2. Jekyll 调用 vite 的 Jekyll 插件,将所有的前端代码编译到 _site/assets 目录:
  3. 插件将需要传递给 vite 的数据编码为 JSON,并写入临时文件;
  4. 插件执行 vite 命令,根据 _vite.config.mjs 中的配置编译前端代码;
    1. _vite.config.mjs 读取临时文件,向 vite 流程中注册虚拟导入文件;
    2. vite 中注册的 vite-plugin-ruby 插件导入其配置文件;
    3. vite 加载 _src/entrypoints 中的代码,并生成依赖树;
    4. vite 中注册的 vite-plugin-legacy 插件增加一份输出版本,并增加 legacy 标志;
    5. vite 完成各代码的编译:
      • 对于 Vue 组件,调用 Vue 的 SFC 编译器完成编译;
        • 对于其中模板(<template>)使用 Liquid 语法的组件,调用 Liquid 编译器完成编译;
      • 对于 TypeScript 文件,调用 TypeScript 编译器完成编译;
    6. vite 完成代码各输出版本的后处理:
      • 对于 legacy 标志的输出版本,vite-plugin-legacy 使用 babel 转译,并记录所需的 polyfill;
      • 对于正常的输出版本,正常编译;
    7. vite 产生编译结果:
      1. vite-plugin-legacy 新建一个 vite 流水线,并将所需的 polyfill 作为入口,并将编译结果插入到 legacy 版本的输出中;
      2. 对上述 vite-plugin-legacy 产生的 polyfill 代码,再次使用 babel 转译;
      3. 新建一个 vite 流水线,并将 _src/entrypoints-njs 中的代码作为入口,编译结果插入到正常版本的输出中;
        • 其中,使用 babel 转译生成的 njs 代码,确保其可以在 NGINX 的 njs 模块中运行;
      4. vite-plugin-ruby 对所有输出的文件,生成一个 manifest 文件,用于 Jekyll 插件读取;
    8. vite 输出编译结果到 .jekyll-cache/vite-dist 下;
  5. 插件将 vite 的输出文件注册到 Jekyll 的静态文件列表中;
  6. 插件读入 vite 产生的 manifest 文件,备用;
  7. Jekyll 完成所有的页面渲染:
    • 对于静态文件,直接拷贝到 _site 目录;
    • 对于需要渲染的 html 文件,使用 Liquid 渲染引擎渲染;
      • 其中,需要调用 Jekyll 的 vite 插件注册的 Liquid 指令,生成前端代码的引用,后者根据已经加载的 manifest 文件,生成正确的引用指令。

fancy-index 部署

本项目使用 NGINX 的 fancy-index 模块美化镜像站的文件列表展示。具体配置方法如下:

  1. 确保 nginx 安装了 ngx_http_fancyindex_modulengx_http_js_module,并确保后者的版本不低于 0.7.9;

  2. nginx.conf 对应的 server 配置块中添加如下配置:

    js_path /path/to/build_output/static/njs;
    
    # 以下设定不能修改,以便与 mirror-web 的前端代码配合
    fancyindex_time_format "%d %b %Y %H:%M:%S +0000";
    fancyindex_show_path on;
    fancyindex_header /fancy-index/before;
    fancyindex_footer /fancy-index/after;
    
    # 以下设定为推荐设置,fancyindex 的其它设定亦可按需修改
    fancyindex_exact_size off;
    fancyindex_name_length 256;
    
    location /fancy-index {
      internal;
      root /path/to/build_output;
      subrequest_output_buffer_size 100k;
      js_import fancyIndexRender from fancy_index.njs;
    
      location = /fancy-index/before {
        js_content fancyIndexRender.fancyIndexBeforeRender;
      }
      location = /fancy-index/after {
        js_content fancyIndexRender.fancyIndexAfterRender;
      }
    }
  3. 然后在需要开启目录浏览的 location 配置块中添加:

    fancyindex on;

genisolist 部署

本项目使用 mirrorz-org/genisolist 生成供前端渲染的 JSON 文件,请查看该项目的文档进行部署和修改。

如果增加了新的配置,不要忘记在 geninfo/genisolist.ini 中增加新的 !include 指令。

贡献文档

目前文档分为两部分维护,一部分是通用文档(help/_posts/mirrorz-help-ng-transpiled 目录),从 mirrorz-org/mirrorz-docs 生成,在 TUNA 本地化维护在 tuna/mirrorz-help-ng ,最终以 submodule 方式引入本仓库。如果您的改动是镜像站通用的,可以向前者贡献内容;如果是 TUNA 特有的,可以向后者 PR 。

另一部分维护在本仓库内(help/_posts/ 目录),需要向本仓库进行 PR 。mirror-web 会逐渐迁移到使用通用文档。

基本步骤

  1. Fork 本项目并 clone
  2. 创建分支 git checkout -b foo-doc
  3. help/_post 中建立文档文件,文件名格式为 年-月-日-名称.md
  4. 用 Markdown 语法编写文档
  5. 提交并推送代码
  6. 发送 Pull Request

写作规范

  1. 对于相对不知名的镜像项目,首先用一两句话介绍该项目
  2. 写明使用方法, 使用 Github Flavored Markdown 格式
  3. 中英文字符间应留一个空格

特殊用法

表单选择

该功能实现在 mirrorz-org/mirrorz-help 中,需要让相应文档迁移到使用通用文档以该功能。

即将推出(TODO):快速配置、拷贝命令、线路选择……

mirror-web's People

Contributors

alick avatar bigeagle avatar cherinyy avatar circuitcoder avatar dotkrnl avatar dramforever avatar fqj1994 avatar gaoyichuan avatar github-actions[bot] avatar happyaron avatar harry-chen avatar heroxbd avatar huiyiqun avatar jiegec avatar johnnychen94 avatar ksplite avatar latticeladder avatar makeding avatar scateu avatar shankerwangmiao avatar sherkeyxd avatar taotieren avatar techciel avatar wzwtt avatar xavieryao avatar xgdgsc avatar xiaq avatar xuehaipan avatar z4yx avatar zenithalhourlyrate avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

mirror-web's Issues

anaconda添加了清华大学的镜像源,但安装时经常显示网络错误

我每次安装都会出现类似下面的代码,显示CondaHTTPError,每次要尝试好几十遍,好花好久的时间才能安装好第三方库。。。能帮我找找原因么?我记得以前安装时很快的。谢谢了

C:\Users\Administrator>conda install -c conda-forge basemap-data-hires
Fetching package metadata ..........

CondaHTTPError: HTTP None None
for url

An HTTP error occurred when trying to retrieve this URL.
ConnectTimeout(MaxRetryError("HTTPSConnectionPool(host='repo.continuum.io', port
=443): Max retries exceeded with url: /pkgs/free/win-64/repodata.json.bz2 (Cause
d by ConnectTimeoutError(<requests.packages.urllib3.connection.VerifiedHTTPSConn
ection object at 0x00000000051A5C88>, 'Connection to repo.continuum.io timed out
. (connect timeout=6.1)'))",),)

[Anaconda/Important enhancement] 请注明Anaconda的Python版本

Reproduce:

1. https://mirrors.tuna.tsinghua.edu.cn
2. 获取下载链接
3. 应用软件
4. Anaconda
5. 给出的下载链接并没有标注出明确的Python版本

比如我就是没注意这个问题,想要Py3版本的Anaconda然后迷迷糊糊下载了Anaconda2。

请在给出的链接中注明这是Anaconda2还是Anaconda3,Thanks.

MikTeX 镜像

现在的 CTAN 镜像似乎不支持 MikTeX,在官网 https://miktex.org/pkg/repositories 并不能看到有**的镜像站,于是每次就被跳转到**,然后又访问不了。

但该有的文件 tuna 上其实都有,只是不知道为什么不能拿来用(设置 mpm --repository=https://mirrors.tuna.tsinghua.edu.cn/CTAN/systems/win32/miktex/tm/packages/ 会报错)。是不是应该问下 MikTeX 他们那边?

web i18n/l10n

要不要考虑至少中英文版本啊。现在的网站是中英文混搭的。

更新后IE11下正常,IE8下出现{{mirs}}等标签

我之前部署的是8.10日的版本,不支持IE的那种,各位升级github上的源码后,我用8.21的版本进行升级

升级的过程中,我只更新了原/mirror-web目录中,新增、替换的文件(用beyond compare详细对比过文件内容),目前,我自己的环境里,IE11下打开正常,IE8下打开,会出现“浏览器不能正常显示。。。”提示,然后可以点击“代用页面”链接继续浏览

但是这时出现的页面中,页面主体部分,“镜像列表”几个字下面,会出现{{mirs}}标签,列表区域会出现{{name}},{{if is new}},{{/if}},{{if help_url}},{{/if}},而不是出现对应该镜像的具体信息

请问这个是什么原因?是我升级的过程中哪个步骤的问题?

jekyll build 报错

[root@d32291cb1436 data]# jekyll build
Configuration file: /data/_config.yml
Source: /data
Destination: /data/_site
Incremental build: disabled. Enable with --incremental
Generating...
Conversion error: Jekyll::Converters::Babel encountered an error while converting 'static/js/help.es6':
"\xEF" on US-ASCII
jekyll 3.8.5 | Error: "\xEF" on US-ASCII

镜像资源文件浏览页面布局问题

首先感谢各位提供mirror-web这么好的管理页面资源!
还有个问题要请教,我自己架设的mirror-web,在镜像资源文件浏览页面,看到的是类似这样的内容:

Index of /centos/
Name Last modified
Parent Directory 2019/08/22 15:52 -
2.1/ 2009/09/09 13:18 -
2/ 2009/09/09 13:18 -
3.1/ 2011/03/03 07:44 -
3.3/ 2011/03/03 07:44 -

页面过于简陋,没有任何修饰,而且一些长一点的文件名也显示不完整

请问如何做到类似:
https://mirrors.tuna.tsinghua.edu.cn/ubuntu-releases/16.04/
那样的效果,每个资源浏览页面,均基于相同的模板和布局,且对页面内容进行一定的字体及颜色的修饰?

再次感谢!

Liquid Warning: Liquid syntax error (line 7):

使用docker build提示下面的错误。

[root@kvm mirror-web]# docker run -it -v /data/mirror-web/:/data builden
Configuration file: /data/_config.yml
       Deprecation: The 'gems' configuration option has been renamed to 'plugins'. Please update your config file accordingly.
            Source: /data
       Destination: /data/_site
 Incremental build: disabled. Enable with --incremental
      Generating...
    Liquid Warning: Liquid syntax error (line 7): Expected dotdot but found pipe in "{{(site.categories["help"] | sort: 'mirrorid') }}" in /_layouts/help.html
    Liquid Warning: Liquid syntax error (line 7): Expected dotdot but found pipe in "{{(site.categories["help"] | sort: 'mirrorid') }}" in /_layouts/help.html
    Liquid Warning: Liquid syntax error (line 7): Expected dotdot but found pipe in "{{(site.categories["help"] | sort: 'mirrorid') }}" in /_layouts/help.html
    Liquid Warning: Liquid syntax error (line 7): Expected dotdot but found pipe in "{{(site.categories["help"] | sort: 'mirrorid') }}" in /_layouts/help.html
    Liquid Warning: Liquid syntax error (line 7): Expected dotdot but found pipe in "{{(site.categories["help"] | sort: 'mirrorid') }}" in /_layouts/help.html
    Liquid Warning: Liquid syntax error (line 7): Expected dotdot but found pipe in "{{(site.categories["help"] | sort: 'mirrorid') }}" in /_layouts/help.html
    Liquid Warning: Liquid syntax error (line 7): Expected dotdot but found pipe in "{{(site.categories["help"] | sort: 'mirrorid') }}" in /_layouts/help.html
    Liquid Warning: Liquid syntax error (line 7): Expected dotdot but found pipe in "{{(site.categories["help"] | sort: 'mirrorid') }}" in /_layouts/help.html
    Liquid Warning: Liquid syntax error (line 7): Expected dotdot but found pipe in "{{(site.categories["help"] | sort: 'mirrorid') }}" in /_layouts/help.html
    Liquid Warning: Liquid syntax error (line 7): Expected dotdot but found pipe in "{{(site.categories["help"] | sort: 'mirrorid') }}" in /_layouts/help.html
    Liquid Warning: Liquid syntax error (line 7): Expected dotdot but found pipe in "{{(site.categories["help"] | sort: 'mirrorid') }}" in /_layouts/help.html
    Liquid Warning: Liquid syntax error (line 7): Expected dotdot but found pipe in "{{(site.categories["help"] | sort: 'mirrorid') }}" in /_layouts/help.html
    Liquid Warning: Liquid syntax error (line 7): Expected dotdot but found pipe in "{{(site.categories["help"] | sort: 'mirrorid') }}" in /_layouts/help.html

emmm.....装不上了 in Debian

拉Master分支,Debian系统的,按照md的教程里,到Jekyll install那一步的时候

WARN: Unresolved specs during Gem::Specification.reset: ffi (< 2, >= 0.5.0) WARN: Clearing out unresolved specs. Please report a bug if this causes problems. /usr/lib/ruby/vendor_ruby/bundler/runtime.rb:34:in `block in setup': You have already activated jekyll-watch 2.0.0, but your Gemfile requires jekyll-watch 1.5.1. Prepending `bundle exec` to your command may solve this. (Gem::LoadError) from /usr/lib/ruby/vendor_ruby/bundler/runtime.rb:19:in `setup' from /usr/lib/ruby/vendor_ruby/bundler.rb:121:in `setup' from /var/lib/gems/2.1.0/gems/jekyll-3.7.2/lib/jekyll/plugin_manager.rb:50:in `require_from_bundler' from /var/lib/gems/2.1.0/gems/jekyll-3.7.2/exe/jekyll:11:in `<top (required)>' from /usr/local/bin/jekyll:23:in `load' from /usr/local/bin/jekyll:23:in `<main>'
我理解大概意思应该是Jekyll-watch的版本过高的了,然后先uninstall了,然后又-v 1.5.1安装了一下
接着又出现
/usr/local/lib/site_ruby/2.1.0/rubygems/dependency.rb:315:in `to_specs': Could not find 'jekyll-watch' (~> 2.0) - did find: [jekyll-watch-1.5.1,jekyll-watch-1.0.0] (Gem::LoadError) Checked in 'GEM_PATH=/root/.gem/ruby/2.1.0:/var/lib/gems/2.1.0:/usr/share/rubygems-integration/2.1.0:/usr/share/rubygems-integration/2.1:/usr/share/rubygems-integration/all', execute `gem env` for more information from /usr/local/lib/site_ruby/2.1.0/rubygems/specification.rb:1311:in `block in activate_dependencies' from /usr/local/lib/site_ruby/2.1.0/rubygems/specification.rb:1300:in `each' from /usr/local/lib/site_ruby/2.1.0/rubygems/specification.rb:1300:in `activate_dependencies' from /usr/local/lib/site_ruby/2.1.0/rubygems/specification.rb:1282:in `activate' from /usr/local/lib/site_ruby/2.1.0/rubygems/core_ext/kernel_gem.rb:67:in `block in gem' from /usr/local/lib/site_ruby/2.1.0/rubygems/core_ext/kernel_gem.rb:66:in `synchronize' from /usr/local/lib/site_ruby/2.1.0/rubygems/core_ext/kernel_gem.rb:66:in `gem' from /usr/local/bin/jekyll:22:in `<main>'
小白求解
这些大佬们了
以前没用过Ruby

关于 docker-ce 镜像使用帮助的一个补充

关于 docker 安装,tuna 帮助 中 Debian/Ubuntu 安装说明为

对于 amd64 架构的计算机,添加软件仓库: sudo add-apt-repository blahblah

docker 官方文档说明为

x86_64 / amd64 sudo add-apt-repository blahblah

实测似乎 x86 平台也需要先添加 repository 才可以 sudo apt-get install docker-ce

似乎应该把说明中的对于 amd64 架构改为对于 x86_64/amd64 ?

给开源项目增加描述

Hi 各位,

现在 mirror-web 已经可以在鼠标放上去的时候为每个项目显示简介了。

当前进度:

  • AOSP - mysql
  • neurodebian - remi
  • repo-ck - virtualbox

需要一些同学来给项目加上简介,方法如下:

  1. fork if necessary

  2. clone 项目

git clone https://github.com/tuna/mirror-web.git
  1. 修改 _config.yml
descriptions:
  AOSP: 'Android Open Source Project'
  AUR: 'To be filled'
  1. commit 并发起 pull request, if necessary

2016-11-13 3 10 16

请求增加IPV6 环境支持

首先 学习TUNA的无私奉献
希望你们能支持IPV6
那么更新下载速度会对大家有质的提升吧

IE浏览器支持

当前版本Web前段界面不支持IE浏览器,打开页面后镜像列表内容看不到。似乎是vue兼容性问题?

能否麻烦各位帮忙修正一下,让其能良好支持IE,类似中科大的那个镜像一样

建议IE8及其后续版本都能支持,毕竟国内(特别是一些事业单位)用IE的用户还是挺多的

非常感谢!

请取消华文黑体的使用

目前 macOS 跟 iOS 的系统字体已经换成了苹方。

毫无疑问,华文黑体已经过时了。希望可以去掉 font-family 中的 Heiti SC

Hackage和Stackage的帮助说明和stack 2.1.1不兼容

前两天stack 2.1.1发布了,配置文件有了很大的变动,导致之前在stack 1.x~/.stack/config.yaml的Hackage和Stackage的tuna镜像设置部分失效了。

具体来说:

  1. Sackage的设置, urls只剩下latest-snapshot有效了。不太确定其他两项是不是还能再使用镜像服务器。
Unrecognized fields in urls: lts-build-plans, nightly-build-plans
  1. Hackage的设置,namehttp都被忽略了,而download-prefix则需要变更为http://mirrors.tuna.tsinghua.edu.cn/hackage/的样子。
  2. Hackage的package-indices设置,要求添加haskell-security的声明了,具体参见stack文档里的例子
  3. 第一次获取package indices如果直接用tuna镜像的话,会碰到如下错误
Downloading root
Could not deserialize <repo>/root.json: Malformed: (line 1, column 1):
unexpected "<"
expecting white space or JSON value

猜测是hackage security的api要求。不太确定是不是直接同步几个json文件就解决问题了。

Environment

请问能否增加预装软件版本标注,如使用centos系统需要提前预装哪些软件以及对应的版本?

增加 CD

如题,跑一个用于接收 github hook 的 server,类似 https://github.com/developmentseed/jekyll-hook,其主要特点是:

  • 每次接收到 hook 的时候,自动 clone 之,
  • clone 完毕后,自动检查 HEAD 提交的 gpg 签名
  • 当且仅当签名有效,并且由指定的人签署时,方可部署

镜像站主页上过滤检索

USTC Mirrors 的页面可以通过过滤,用户反馈这一功能可能会使得使用更加便捷。
March 27, 2017 6:44 PM

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.