Merge pull request #141 from YunoHost/check-the-ssowat-conf

Check ssowat conf instead of turbo parsing manifest.json or manifest.toml
This commit is contained in:
Alexandre Aubin 2023-03-03 11:28:12 +01:00 committed by GitHub
commit d00a1ce9ea
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -186,17 +186,12 @@ _VALIDATE_THAT_APP_CAN_BE_ACCESSED () {
log_small_title "Validating that the app $app_id_to_check can/can't be accessed with its URL..."
# Force the app to public only if we're checking the public-like installs AND there's no is_public arg
# Force the app to public only if we're checking the public-like installs AND visitors are allowed to access the app
# For example, that's the case for agendav which is always installed as
# private by default For "regular" apps (with a is_public arg) they are
# installed as public, and we precisely want to check they are publicly
# accessible *without* tweaking main permission...
if [[ -e $package_path/manifest.json ]]
then
local has_public_arg=$([[ -n "$(jq -r '.arguments.install[] | select(.name=="is_public")' $package_path/manifest.json)" ]] && echo true || echo false)
else
local has_public_arg=$(grep -q '\[install.init_main_permission\]' $package_path/manifest.toml && echo true || echo false)
fi
local has_public_arg=$(LXC_EXEC "cat /etc/ssowat/conf.json" | jq .permissions.\""$app_id_to_check.main"\".public)
if [ "$install_type" != 'private' ] && [[ $has_public_arg == "false" ]]
then