av commited on
Commit
1c4e2cf
·
1 Parent(s): 44003f9

switch to docker sdk to fix CSP blocking script execution

Browse files

static spaces serve with content-security-policy: default-src 'none'; sandbox
which blocks all inline script execution. Docker with nginx gives full control.

Files changed (4) hide show
  1. Dockerfile +4 -0
  2. README.md +1 -3
  3. nginx.conf +8 -0
  4. style.css +0 -28
Dockerfile ADDED
@@ -0,0 +1,4 @@
 
 
 
 
 
1
+ FROM nginx:alpine
2
+ COPY nginx.conf /etc/nginx/conf.d/default.conf
3
+ COPY index.html /usr/share/nginx/html/index.html
4
+ EXPOSE 7860
README.md CHANGED
@@ -3,8 +3,6 @@ title: Prompt Injection Detector
3
  emoji: 👁
4
  colorFrom: blue
5
  colorTo: indigo
6
- sdk: static
7
  pinned: false
8
  ---
9
-
10
- Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
 
3
  emoji: 👁
4
  colorFrom: blue
5
  colorTo: indigo
6
+ sdk: docker
7
  pinned: false
8
  ---
 
 
nginx.conf ADDED
@@ -0,0 +1,8 @@
 
 
 
 
 
 
 
 
 
1
+ server {
2
+ listen 7860;
3
+ root /usr/share/nginx/html;
4
+ index index.html;
5
+ location / {
6
+ try_files $uri /index.html;
7
+ }
8
+ }
style.css DELETED
@@ -1,28 +0,0 @@
1
- body {
2
- padding: 2rem;
3
- font-family: -apple-system, BlinkMacSystemFont, "Arial", sans-serif;
4
- }
5
-
6
- h1 {
7
- font-size: 16px;
8
- margin-top: 0;
9
- }
10
-
11
- p {
12
- color: rgb(107, 114, 128);
13
- font-size: 15px;
14
- margin-bottom: 10px;
15
- margin-top: 5px;
16
- }
17
-
18
- .card {
19
- max-width: 620px;
20
- margin: 0 auto;
21
- padding: 16px;
22
- border: 1px solid lightgray;
23
- border-radius: 16px;
24
- }
25
-
26
- .card p:last-child {
27
- margin-bottom: 0;
28
- }