Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/main' into feature/onyx-connecti…
Browse files Browse the repository at this point in the history
…on-manager
  • Loading branch information
fabioh8010 committed Aug 23, 2024
2 parents 0a02a09 + 259a9b7 commit 4e3a516
Show file tree
Hide file tree
Showing 112 changed files with 5,282 additions and 624 deletions.
31 changes: 4 additions & 27 deletions .github/scripts/createHelpRedirects.sh
Original file line number Diff line number Diff line change
Expand Up @@ -27,32 +27,6 @@ function checkCloudflareResult {
declare -a ITEMS_TO_ADD

while read -r line; do
# Split each line of the file into a source and destination so we can sanity check
# and compare against the current list.
read -r -a LINE_PARTS < <(echo "$line" | tr ',' ' ')
SOURCE_URL=${LINE_PARTS[0]}
DEST_URL=${LINE_PARTS[1]}

# Make sure the format of the line is as execpted.
if [[ "${#LINE_PARTS[@]}" -gt 2 ]]; then
error "Found a line with more than one comma: $line"
exit 1
fi

# Basic sanity checking to make sure that the source and destination are in expected
# subdomains.
if ! [[ $SOURCE_URL =~ ^https://(community|help)\.expensify\.com ]]; then
error "Found source URL that is not a communityDot or helpDot URL: $SOURCE_URL"
exit 1
fi

if ! [[ $DEST_URL =~ ^https://(help|use|integrations)\.expensify\.com|^https://www\.expensify\.org ]]; then
error "Found destination URL that is not a supported URL: $DEST_URL"
exit 1
fi

info "Source: $SOURCE_URL and destination: $DEST_URL appear to be formatted correctly."

ITEMS_TO_ADD+=("$line")

# This line skips the first line in the csv because the first line is a header row.
Expand Down Expand Up @@ -83,6 +57,9 @@ done | jq -n '. |= [inputs]')

info "Adding redirects for $PUT_JSON"

# Dump $PUT_JSON into a file otherwise the curl request below will fail with too many arguments
echo "$PUT_JSON" > redirects.json

# We use PUT here instead of POST so that we replace the entire list in place. This has many benefits:
# 1. We don't have to check if items are already in the list, allowing this script to run faster
# 2. We can support deleting redirects this way by simply removing them from the list
Expand All @@ -93,7 +70,7 @@ info "Adding redirects for $PUT_JSON"
PUT_RESULT=$(curl -s --request PUT --url "https://api.cloudflare.com/client/v4/accounts/$ZONE_ID/rules/lists/$LIST_ID/items" \
--header 'Content-Type: application/json' \
--header "Authorization: Bearer $CLOUDFLARE_LIST_TOKEN" \
--data "$PUT_JSON")
--data-binary @redirects.json)

checkCloudflareResult "$PUT_RESULT"
OPERATION_ID=$(echo "$PUT_RESULT" | jq -r .result.operation_id)
Expand Down
42 changes: 42 additions & 0 deletions .github/scripts/verifyRedirect.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,10 @@
# HelpDot - Verifies that redirects.csv does not have any duplicates
# Duplicate sourceURLs break redirection on cloudflare pages

source scripts/shellUtils.sh

declare -r REDIRECTS_FILE="docs/redirects.csv"
declare -a ITEMS_TO_ADD

declare -r RED='\033[0;31m'
declare -r GREEN='\033[0;32m'
Expand All @@ -22,5 +25,44 @@ if [[ DETECT_CYCLE_EXIT_CODE -eq 1 ]]; then
exit 1
fi

while read -r line; do
# Split each line of the file into a source and destination so we can sanity check
# and compare against the current list.
read -r -a LINE_PARTS < <(echo "$line" | tr ',' ' ')
SOURCE_URL=${LINE_PARTS[0]}
DEST_URL=${LINE_PARTS[1]}

# Make sure the format of the line is as expected.
if [[ "${#LINE_PARTS[@]}" -gt 2 ]]; then
error "Found a line with more than one comma: $line"
exit 1
fi

# Basic sanity checking to make sure that the source and destination are in expected
# subdomains.
if ! [[ $SOURCE_URL =~ ^https://(community|help)\.expensify\.com ]] || [[ $SOURCE_URL =~ \# ]]; then
error "Found source URL that is not a communityDot or helpDot URL, or contains a '#': $SOURCE_URL"
exit 1
fi

if ! [[ $DEST_URL =~ ^https://(help|use|integrations)\.expensify\.com|^https://www\.expensify\.org ]]; then
error "Found destination URL that is not a supported URL: $DEST_URL"
exit 1
fi

info "Source: $SOURCE_URL and destination: $DEST_URL appear to be formatted correctly."

ITEMS_TO_ADD+=("$line")

# This line skips the first line in the csv because the first line is a header row.
done <<< "$(tail +2 $REDIRECTS_FILE)"

# Sanity check that we should actually be running this and we aren't about to delete
# every single redirect.
if [[ "${#ITEMS_TO_ADD[@]}" -lt 1 ]]; then
error "No items found to add, why are we running?"
exit 1
fi

echo -e "${GREEN}The redirects.csv is valid!${NC}"
exit 0
4 changes: 2 additions & 2 deletions android/app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -108,8 +108,8 @@ android {
minSdkVersion rootProject.ext.minSdkVersion
targetSdkVersion rootProject.ext.targetSdkVersion
multiDexEnabled rootProject.ext.multiDexEnabled
versionCode 1009002300
versionName "9.0.23-0"
versionCode 1009002400
versionName "9.0.24-0"
// Supported language variants must be declared here to avoid from being removed during the compilation.
// This also helps us to not include unnecessary language variants in the APK.
resConfigs "en", "es"
Expand Down
3 changes: 3 additions & 0 deletions assets/images/feed.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
10 changes: 10 additions & 0 deletions assets/images/simple-illustrations/simple-illustration__rules.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading

0 comments on commit 4e3a516

Please sign in to comment.