You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

44 lines
921 B

  1. #!/bin/sh
  2. # This is example script for tor-hs uci config
  3. # HookScript option. Script is then called after running
  4. # hidden service.
  5. # It disables trusted domain check for nextcloud.
  6. NEXTCLOUD_CLI_SCRIPT="/srv/www/nextcloud/occ"
  7. nextcloud_cli() {
  8. sudo -u nobody php-cli "$NEXTCLOUD_CLI_SCRIPT" "$@"
  9. }
  10. nextcloud_add_domain() {
  11. onion="$1"
  12. if [ -n "$onion" ] && nextcloud_cli config:system:get trusted_domains |grep "$onion" ; then
  13. echo "Info: Trusted domains already disabled. Nothing to do." >&2
  14. else
  15. echo "Info: Disabling trusted domains." >&2
  16. nextcloud_cli config:system:set trusted_domains 1000 --value=$onion
  17. fi
  18. }
  19. print_help() {
  20. echo "Help"
  21. }
  22. # Check occ command
  23. [ -f "$NEXTCLOUD_CLI_SCRIPT" ] || {
  24. echo "Error: occ command not found!" >&2
  25. exit 1
  26. }
  27. ################################################################
  28. case "$1" in
  29. --update-onion)
  30. nextcloud_add_domain "$2"
  31. ;;
  32. *)
  33. print_help
  34. ;;
  35. esac