diff --git a/.github/workflows/update.yml b/.github/workflows/update.yml index b8465279..6a5db247 100644 --- a/.github/workflows/update.yml +++ b/.github/workflows/update.yml @@ -24,6 +24,7 @@ jobs: - name: Build run: | + rm _apps/* ruby ./generate-flatpak.rb - name: Commit diff --git a/README.md b/README.md index 2b678720..ecac33dd 100644 --- a/README.md +++ b/README.md @@ -47,9 +47,10 @@ bundle install ### Updating Apps -The list of apps is generated with a simple Ruby script. To rebuild the app list, run: +The list of apps is generated with a simple Ruby script. To rebuild the app list, delete the existing files so any removals (e.g. end-of-life apps) are reflected, then run the script: ```shell +rm _apps/* ruby generate-flatpak.rb ``` diff --git a/_layouts/app.html b/_layouts/app.html index 3c1933e7..de241e6f 100644 --- a/_layouts/app.html +++ b/_layouts/app.html @@ -5,17 +5,10 @@
{{ page.title }} icon + srcset="https://flatpak.elementary.io/repo/appstream/x86_64/icons/64x64/{{ page.app_id }}.png" + src="https://raw.githubusercontent.com/elementary/icons/main/apps/64/application-default-icon.svg" + alt="{{ page.title }} icon" + />

{{ page.title }}

{{ page.developer }}

diff --git a/generate-flatpak.rb b/generate-flatpak.rb index 7a42a57d..f4e54007 100644 --- a/generate-flatpak.rb +++ b/generate-flatpak.rb @@ -5,14 +5,9 @@ require 'nokogiri' require 'cgi' -########### -# FLATPAK # -########### - -# HTTPS doesn't work -componentsDataGz = URI.open('http://flatpak.elementary.io/repo/appstream/x86_64/appstream.xml.gz') +componentsDataGz = URI.open('https://flatpak.elementary.io/repo/appstream/x86_64/appstream.xml.gz') xmlData = Zlib::GzipReader.new( componentsDataGz ).read -componentsData = Nokogiri::XML(xmlData) +componentsData = Nokogiri::XML(xmlData,&:noblanks) template = '--- app_id: ((id)) @@ -25,8 +20,6 @@ dist: flatpak screenshots: ((screenshots)) -icons: -((icons)) color: primary: "((color_primary))" primary-text: "((color_text))" @@ -38,11 +31,30 @@ ((description))' -puts 'about to iterate thru components...' -componentsData.css("components component").each do | component | - next if component.get_attribute("type") != "desktop" +componentsData.css("components component").each do |component| + next unless (component.get_attribute("type") == "desktop" || component.get_attribute("type") == "desktop-application") + +component.xpath('name[@xml:lang]').each do |name| + name.remove + end + + component.xpath('summary[@xml:lang]').each do |summary| + summary.remove + end + + component.xpath('description[@xml:lang]').each do |description| + description.remove + end + + component.xpath('keyword[@xml:lang]').each do |keyword| + keyword.remove + end + + component.xpath('caption[@xml:lang]').each do |caption| + caption.remove + end - puts "Generating #{component.at_css('name').content}" + puts "\nGenerating #{component.at_css('name').content}" appFile = template.dup @@ -118,33 +130,10 @@ image = component.at_css('image') if not image.nil? screenshots += ' - ' + image.content + "\n" - end # TODO: multiple screenshots - # releaseHash = "" - # unless doc['Screenshots'].nil? - # doc['Screenshots'].each do |screenshot| - # screenshots += " - " + URI::encode("#{mediaBase}/#{screenshot['source-image']['url']}") + "\n" - # releaseHash = screenshot['source-image']['url'].split("/")[0..3].join("/") if releaseHash.empty? - # end - # end appFile.sub!('((screenshots))', screenshots.rstrip) - icons = "" - icon_prefix = "https://flatpak.elementary.io/repo/appstream/x86_64/icons/" - - icon64 = component.at_css('icon[width="64"]') - if not icon64.nil? - icons += ' "64": ' + icon_prefix + '64x64/' + icon64.content + "\n" - end - - icon128 = component.at_css('icon[width="128"]') - if not icon128.nil? - icons += ' "128": ' + icon_prefix + '128x128/' + icon128.content + "\n" - end - - appFile.sub!('((icons))', icons.rstrip) - releases = "" # TODO: Releases # unless doc['Releases'].nil? @@ -169,3 +158,4 @@ file.write(appFile) end end + diff --git a/index.html b/index.html index 9f95b144..03e92c76 100644 --- a/index.html +++ b/index.html @@ -16,18 +16,11 @@

Made for elementary OS

{% for app in flatpak_apps %} {% assign id = app.id | remove: '/' %} - {{app.title}} icon + {{ app.title }} icon {{ app.title }} {{ app.summary }}