add purge local and remote media
This commit is contained in:
		
							parent
							
								
									8e99185335
								
							
						
					
					
						commit
						00efec62d9
					
				
							
								
								
									
										26
									
								
								purge_local_media
									
									
									
									
									
										Executable file
									
								
							
							
						
						
									
										26
									
								
								purge_local_media
									
									
									
									
									
										Executable file
									
								
							@ -0,0 +1,26 @@
 | 
			
		||||
#!/bin/bash
 | 
			
		||||
 | 
			
		||||
usage() {
 | 
			
		||||
  echo "Not enough arguments supplied."
 | 
			
		||||
  echo "Syntax: $(basename $0) {date yyyy-mm-dd}"
 | 
			
		||||
  echo
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
if [[ $# -lt 1 ]]; then
 | 
			
		||||
  usage
 | 
			
		||||
  exit 1
 | 
			
		||||
fi
 | 
			
		||||
 | 
			
		||||
. $(dirname $0)/auth
 | 
			
		||||
 | 
			
		||||
DS=$1
 | 
			
		||||
TS=$(date -d "${DS}" "+%s%3N")
 | 
			
		||||
echo "Converting ${DS} to ${TS}"
 | 
			
		||||
 | 
			
		||||
curl -s --insecure -X POST \
 | 
			
		||||
    -H "Authorization: Bearer $TOKEN" \
 | 
			
		||||
    -H "Content-Type: application/json" \
 | 
			
		||||
    -d '{}' "http://localhost:8008/_synapse/admin/v1/media/matrix.erb.pw/delete?before_ts=${TS}" \
 | 
			
		||||
    # | sed 's/,/,\n  /g; s/{/{\n  /g; s/}/\n}/g'
 | 
			
		||||
 | 
			
		||||
echo
 | 
			
		||||
							
								
								
									
										26
									
								
								purge_remote_media
									
									
									
									
									
										Executable file
									
								
							
							
						
						
									
										26
									
								
								purge_remote_media
									
									
									
									
									
										Executable file
									
								
							@ -0,0 +1,26 @@
 | 
			
		||||
#!/bin/bash
 | 
			
		||||
 | 
			
		||||
usage() {
 | 
			
		||||
  echo "Not enough arguments supplied."
 | 
			
		||||
  echo "Syntax: $(basename $0) {date yyyy-mm-dd}"
 | 
			
		||||
  echo
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
if [[ $# -lt 1 ]]; then
 | 
			
		||||
  usage
 | 
			
		||||
  exit 1
 | 
			
		||||
fi
 | 
			
		||||
 | 
			
		||||
. $(dirname $0)/auth
 | 
			
		||||
 | 
			
		||||
DS=$1
 | 
			
		||||
TS=$(date -d "${DS}" "+%s%3N")
 | 
			
		||||
echo "Converting ${DS} to ${TS}"
 | 
			
		||||
 | 
			
		||||
curl -s --insecure -X POST \
 | 
			
		||||
    -H "Authorization: Bearer $TOKEN" \
 | 
			
		||||
    -H "Content-Type: application/json" \
 | 
			
		||||
    -d '{}' "http://localhost:8008/_synapse/admin/v1/purge_media_cache?before_ts=${TS}" \
 | 
			
		||||
    # | sed 's/,/,\n  /g; s/{/{\n  /g; s/}/\n}/g'
 | 
			
		||||
 | 
			
		||||
echo
 | 
			
		||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user