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

feat: add mapping for repos #49

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

feat: add mapping for repos #49

wants to merge 4 commits into from

Conversation

skyzh
Copy link
Member

@skyzh skyzh commented Dec 29, 2020

We'll introduce categories on our mirror frontend. To do this, we create a special page which contains JSON data, and load them on frontend.

@skyzh skyzh requested a review from htfy96 December 29, 2020 08:44
data/mapping.yml Outdated
@@ -63,6 +63,7 @@ groups:
- fedora-iot
- fedora-ostree
- fedora-secondary
- - rpmfusion
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

duplicate -?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You're right. Fixed.

@skyzh skyzh requested a review from htfy96 December 29, 2020 15:29
script:
- yq eval -j data/mapping.yml >> content/post/mirror-help/mapping.html
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why does this line write JSON into an html file (mapping.html)?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The resulting mirror-help.xml will then have a special entry metadata:mapping. Inside that is JSON data. We could parse it in frontend.

Copy link
Contributor

@htfy96 htfy96 Dec 29, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Well, this looks pretty hackish to me despite possible escaping issues:

    <item>
      <title>metadata:mapping</title>
      <link>https://sjtug.org/post/mirror-help/mapping/</link>
      <pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate>
      
      <guid>https://sjtug.org/post/mirror-help/mapping/</guid>
      <description>{
  &#34;groups&#34;: {
    &#34;rust&#34;: {
      &#34;name&#34;: &#34;Rust 语言及工具链&#34;,
      &#34;repos&#34;: [
        &#34;crates.io&#34;,
        &#34;git/crates.io-index&#34;,
        &#34;static.crates.io&#34;,
        &#34;rust-static&#34;
      ]
    },

Better to just output JSON into static/mapping.json and fetch the file from the frontend.

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

2 participants