aboutsummaryrefslogtreecommitdiff
path: root/subprojects/freeamo/src/main_functions
diff options
context:
space:
mode:
authorYuchen Pei <hi@ypei.me>2022-05-19 22:23:10 +1000
committerYuchen Pei <hi@ypei.me>2022-05-19 22:23:10 +1000
commit3db93bc6f7b46bc322694e6658b8f559433a03c6 (patch)
tree1273a17e11e0d9888ae57676906c68f8bb77e287 /subprojects/freeamo/src/main_functions
parent09c05e86a1096b08eb7483b970207d47d0388665 (diff)
Replacing the files with a haskell rewrite.
Diffstat (limited to 'subprojects/freeamo/src/main_functions')
-rw-r--r--subprojects/freeamo/src/main_functions283
1 files changed, 0 insertions, 283 deletions
diff --git a/subprojects/freeamo/src/main_functions b/subprojects/freeamo/src/main_functions
deleted file mode 100644
index daa779f..0000000
--- a/subprojects/freeamo/src/main_functions
+++ /dev/null
@@ -1,283 +0,0 @@
-#!/usr/bin/env bash
-# This file is part of FreeAMO
-# Copyright (C) 2018 David Hedlund
-#
-# FreeAMO is free software: you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation, either version 3 of the License, or
-# (at your option) any later version.
-#
-# FreeAMO is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program. If not, see <http://www.gnu.org/licenses/>.
-
-function latest_debranded_trisquel_version {
-
- # All debranded programs starts with "i" so all of them are in Trisquels "/i/" directory
- wget -qO- "http://archive.trisquel.info/trisquel/pool/main/i/$debranded_package/?C=N;O=D" | sed "s|\"|\\n|g; s|-|\\n|g" | grep "$debranded_package"_ | head -n 1 | sed "s|"$debranded_package"_||"
-
-}
-
-function check_files {
-
- if [ ! -f "$run_path/FreeAMO-$check_type" ]; then
-
- echo "$run_path/FreeAMO-$check_type doesn't exist.";
- echo "Exiting" && exit
-
- else
-
-
- # Make sure all links are using SSL
- if grep -q "http://addons.mozilla.org/" "$run_path/FreeAMO-$check_type"; then
-
- echo "Change http://addons.mozilla.org/ to https://addons.mozilla.org/ (https)."
- echo "Exiting" && exit
-
- fi
-
- fi
-
-}
-
-function line_status {
-
-
- if [ "$file" == "$previous_file" ]; then
-
- ((++line))
-
- else
-
- line="0"; # Should not be 1
-
- fi
-
-}
-
-# Begin locale code
-
-function do-locale {
-
- echo "####################"
-
- tmp__en_US=$(jq ".results[$entry].$locale_description" "$file" | sed "s|en-US|en_US|" | jq -r .en_US )
- tmp__en_GB=$(jq ".results[$entry].$locale_description" "$file" | sed "s|en-GB|en_GB|" | jq -r .en_GB )
- # Use the first avalible if English is not avaliable
- tmp=$(jq -r ".results[$entry] | select(.$locale_description != null) | .$locale_description[]" "$file" | head -n 1) || [[ $? == 141 ]] # Avoid `head -n 1` error `returned 141`
-
- if [ "$tmp__en_US" != "null" ]; then
-
- if [ "$locale_description" == "name" ]; then
-
- name="$tmp__en_US";
-
- elif [ "$locale_description" == "summary" ]; then
-
- summary="$tmp__en_US";
-
- elif [ "$locale_description" == "description" ]; then
-
- description="$tmp__en_US";
-
- elif [ "$locale_description" == "homepage" ]; then
-
- homepage="$tmp__en_US";
-
- elif [ "$locale_description" == "support_url" ]; then
-
- support_url="$tmp__en_US";
-
- fi
-
-
- elif [ "$tmp__en_GB" != "null" ]; then
-
- if [ "$locale_description" == "name" ]; then
-
- name="$tmp__en_GB";
-
- elif [ "$locale_description" == "summary" ]; then
-
- summary="$tmp__en_GB";
-
- elif [ "$locale_description" == "description" ]; then
-
- description="$tmp__en_GB";
-
- elif [ "$locale_description" == "homepage" ]; then
-
- homepage="$tmp__en_GB";
-
- elif [ "$locale_description" == "support_url" ]; then
-
- support_url="$tmp__en_GB";
-
- fi
-
- elif [ "$tmp" != "null" ]; then
-
- if [ "$locale_description" == "name" ]; then
-
- name="$tmp";
-
- elif [ "$locale_description" == "summary" ]; then
-
- summary="$tmp";
-
- elif [ "$locale_description" == "description" ]; then
-
- description="$tmp";
-
- elif [ "$locale_description" == "homepage" ]; then
-
- homepage="$tmp";
-
- elif [ "$locale_description" == "support_url" ]; then
-
- support_url="$tmp";
-
- fi
-
- fi
-
- # Use summary if description is not provided
- if [ "$description" == "" ]; then
-
- description="$summary"
-
- fi
-
-
-}
-
-# End locale code
-
-
-function amo_variables() {
- id="$(jq ".results[$entry].id" "$file")";
- average_daily_users="$(jq ".results[$entry].average_daily_users" "$file")";
- has_eula="$(jq ".results[$entry].has_eula" "$file")";
- slug="$(jq -r ".results[$entry].slug" "$file")";
- current_version__id=$(jq ".results[$entry].current_version.id" "$file");
-
- source "$run_path/src/main_functions"
- locale_description="name"
- do-locale
-
- if jq .results[$entry].current_version.files[0].permissions "$file" | grep -q "nativeMessaging"; then
-
- nativeMessaging__pass=false;
-
- else
-
- nativeMessaging__pass=true;
-
- fi
-
-}
-
-function amo_variables__licenses {
-
- license__amo_full_name="$(jq ".license.name" "$run_path/build/json/current_versions/$current_version__id.json" | sed "s|en-US|en_US|;" | jq -r .en_US)"
-
-}
-
-function essential_addon {
-
- if [ "$has_eula" = false ] && [ "$nativeMessaging__pass" = true ] && [ "$average_daily_users" -ge "$minimum_average_daily_users" ]; then
-
- essential_addon=true;
-
- else
-
- essential_addon=false;
-
- fi
-
-}
-
-#function hard_to_evaluate_addon {
-
-# curl "https://addons.mozilla.org/api/v3/addons/addon/nemid-nøglefilsprogram/" | jq .current_version.files[0].permissions | grep "nativeMessaging
-
-
-# API data: Add software dependencies - https://github.com/mozilla/addons-server/issues/8668
-# The API should be fixed. there are to many add-ons to keep track on if they have or not have software dependencies.
-
-# Old solution:
-
-# 1: Add this to FreeAMO-dependencies:
-#belgium-eid eid-mw
-
-# 2: Uncomment this code:
-# depends_on_external_program=false;
-# while IFS= read -r dependencies; do
-#
-# dependency_slug=$(echo $dependencies | awk '{print $1}');
-# dependency=$(echo "$dependencies" | cut -f 2);
-#
-# if [ "$dependency_slug" == "$slug" ]; then
-#
-# depends_on_external_program=true;
-#
-# fi
-#
-# done < $run_path/FreeAMO-dependencies
-
-#}
-
-function pv__progress {
-
- if [ ! "$pv__discard" = true ] && ! $debug; then
-
- (pv --progress --line-mode --size "$pv__size" --timer) > /dev/null
-
- else
-
- tee
-
- fi
-
-}
-
-
-function format_description__mixed_html_to_mediawiki {
-
- sed "
-# Remove Mozilla tracking links
-s|https://outgoing.prod.mozaws.net/v1/.\\{65\\}||g; s|%3A|:|g; s|%23|#|g
-
-# Remove reduntant backslashes. Pandoc will convert quotes regardless.
-s|\\\\\\\"|\\\"|g
-
-
-"
-
-}
-
-function format_description__after_pandoc {
-
- sed "
-
-### Fix formatting that cannot be fixed by Pandoc since it's not HTML
-
-# Fix line breaks.
-s|\\\\n|\\n|g
-
-# Remove \t
-s|\\\\t||g
-"
- # Change local links to external links
-
-}
-
-function format_description {
-
- format_description__mixed_html_to_mediawiki | pandoc -f html -t mediawiki | format_description__after_pandoc
-
-}