forked from coop-cloud/authentik
set nextcloud icon using an abra command
This commit is contained in:
31
abra.sh
31
abra.sh
@ -97,6 +97,37 @@ else:
|
||||
|
||||
}
|
||||
|
||||
set_icons(){
|
||||
for icon in $APP_ICONS; do
|
||||
app=$(echo $icon | cut -d ":" -f1)
|
||||
file_path=$(eval echo $(echo $icon | cut -d ":" -f2))
|
||||
file=$(basename $file_path)
|
||||
echo copy icon $file_path for $app
|
||||
abra app cp $APP_NAME $file_path app:/media/
|
||||
abra app cmd -T $APP_NAME app set_app_icon $app /media/$file
|
||||
done
|
||||
}
|
||||
|
||||
set_app_icon() {
|
||||
TOKEN=$(cat /run/secrets/admin_token)
|
||||
python -c """
|
||||
import requests
|
||||
import os
|
||||
my_token = '$TOKEN'
|
||||
application = '$1'
|
||||
icon_path = '$2'
|
||||
url = f'https://$DOMAIN/api/v3/core/applications/{application}/set_icon/'
|
||||
headers = {'Authorization':f'Bearer {my_token}'}
|
||||
with open(icon_path, 'rb') as img:
|
||||
name_img = os.path.basename(icon_path)
|
||||
files= {'file': (name_img,img,'image/png') }
|
||||
with requests.Session() as s:
|
||||
r = s.post(url,files=files,headers=headers)
|
||||
print(r.status_code)
|
||||
"""
|
||||
|
||||
}
|
||||
|
||||
blueprint_cleanup() {
|
||||
/manage.py shell -c """
|
||||
delete_flows = ['default-recovery-flow' , 'custom-authentication-flow' , 'invitation-enrollment-flow' , 'initial-setup']
|
||||
|
Reference in New Issue
Block a user