Skip to content

Commit

Permalink
Implement GDPR compliance workaround
Browse files Browse the repository at this point in the history
  • Loading branch information
sd109 committed May 1, 2024
1 parent 934d0ea commit 7d0548f
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 1 deletion.
5 changes: 4 additions & 1 deletion images/ui-base/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,7 @@ FROM python:3.11-slim
ENV GRADIO_SERVER_PORT=7680

COPY requirements.txt requirements.txt
RUN pip install --no-cache-dir -r requirements.txt
RUN pip install --no-cache-dir -r requirements.txt

COPY purge-google-fonts.sh purge-google-fonts.sh
RUN bash purge-google-fonts.sh
12 changes: 12 additions & 0 deletions images/ui-base/purge-google-fonts.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@

SOURCE_CODE_PATH=/usr/local/lib/python3.11/site-packages/gradio/

# Strip out preconnect directives from HTML <link> tags
find $SOURCE_CODE_PATH -name "*.html" -type f -exec sed -i s!'rel="preconnect"'!!g {} \;

# Replace links with something harmless but identifiable
declare -a LINKS=("https://fonts.gstatic.com" "https://fonts.googleapis.com")
REPLACEMENT="no-google-fonts-here"
for item in "${LINKS[@]}"; do
find $SOURCE_CODE_PATH -name "*.html" -type f -exec sed -i s!$item!$REPLACEMENT!g {} \;
done

0 comments on commit 7d0548f

Please sign in to comment.