Spaces:
Running
Running
Commit
·
9714f25
1
Parent(s):
1df6078
Add sharing
Browse files- main.py +10 -2
- templates/index.html +52 -6
main.py
CHANGED
@@ -101,6 +101,7 @@ def proxy(url):
|
|
101 |
|
102 |
@app.route('/')
|
103 |
def index():
|
|
|
104 |
if 'current_feed' in session and request.args.get('new', 'false') == 'false':
|
105 |
feed = session['current_feed']
|
106 |
url = live_urls[feed]
|
@@ -108,7 +109,13 @@ def index():
|
|
108 |
feed = random.randint(0, len(live_urls) - 1)
|
109 |
url = live_urls[feed]
|
110 |
session['current_feed'] = feed
|
111 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
112 |
ip = ''.join(url.split('//')[-1]).split(':')[0]
|
113 |
print('IP:',ip)
|
114 |
info = get_location(ip)
|
@@ -140,7 +147,8 @@ def index():
|
|
140 |
loc_link=loc_link,
|
141 |
owner=owner,
|
142 |
X=X,
|
143 |
-
Y=Y
|
|
|
144 |
|
145 |
if __name__ == '__main__':
|
146 |
app.run(host='0.0.0.0', port='7860')
|
|
|
101 |
|
102 |
@app.route('/')
|
103 |
def index():
|
104 |
+
id = 0
|
105 |
if 'current_feed' in session and request.args.get('new', 'false') == 'false':
|
106 |
feed = session['current_feed']
|
107 |
url = live_urls[feed]
|
|
|
109 |
feed = random.randint(0, len(live_urls) - 1)
|
110 |
url = live_urls[feed]
|
111 |
session['current_feed'] = feed
|
112 |
+
|
113 |
+
if request.args.get('id'):
|
114 |
+
print(request.args.get('id'))
|
115 |
+
url = live_urls[int(request.args.get('id'))]
|
116 |
+
session['current_feed'] = feed
|
117 |
+
|
118 |
+
id = feed
|
119 |
ip = ''.join(url.split('//')[-1]).split(':')[0]
|
120 |
print('IP:',ip)
|
121 |
info = get_location(ip)
|
|
|
147 |
loc_link=loc_link,
|
148 |
owner=owner,
|
149 |
X=X,
|
150 |
+
Y=Y,
|
151 |
+
id=id)
|
152 |
|
153 |
if __name__ == '__main__':
|
154 |
app.run(host='0.0.0.0', port='7860')
|
templates/index.html
CHANGED
@@ -2,7 +2,7 @@
|
|
2 |
<html>
|
3 |
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
4 |
<head>
|
5 |
-
<link rel="
|
6 |
<link rel="preload" href="{{ url_for('static', filename='eye.gif') }}" as="image">
|
7 |
<link rel="icon" type="image/png" href="https://images.squarespace-cdn.com/content/v1/64790f5777b5d772678cce83/6d71eaee-f825-4324-be9b-2def32469eac/Untitled+drawing+%2811%29.png?format=100w">
|
8 |
<title>a random unsecured camera</title>
|
@@ -104,9 +104,23 @@
|
|
104 |
color:rgb(83, 83, 83);
|
105 |
transition: 0.5s ease;
|
106 |
}
|
107 |
-
|
108 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
109 |
}
|
|
|
110 |
@media only screen and (orientation: portrait) {
|
111 |
body {
|
112 |
margin-left: auto;
|
@@ -140,8 +154,7 @@
|
|
140 |
.info {
|
141 |
width: 90%;
|
142 |
height: 65%;
|
143 |
-
|
144 |
-
|
145 |
}
|
146 |
</style>
|
147 |
</head>
|
@@ -170,6 +183,8 @@
|
|
170 |
refresh
|
171 |
</button>
|
172 |
</a>
|
|
|
|
|
173 |
</div>
|
174 |
|
175 |
<p id="info-text" style="color:rgb(83, 83, 83); font-family: 'Helvetica'; font-weight: 50;">
|
@@ -178,7 +193,7 @@
|
|
178 |
lat, lon: {{ loc }}<br>
|
179 |
time: <span id="time"></span><br><br>
|
180 |
|
181 |
-
<span
|
182 |
</p>
|
183 |
|
184 |
<!--
|
@@ -195,6 +210,8 @@
|
|
195 |
|
196 |
|
197 |
<script>
|
|
|
|
|
198 |
let loadingGif = "{{ url_for('static', filename='eye.gif') }}";
|
199 |
let currentFeed;
|
200 |
document.addEventListener("DOMContentLoaded", function() {
|
@@ -252,6 +269,7 @@
|
|
252 |
img.src = newUrl;
|
253 |
});
|
254 |
|
|
|
255 |
document.addEventListener("DOMContentLoaded", function() {
|
256 |
const timezone = "{{ timezone }}";
|
257 |
setInterval(() => {
|
@@ -268,6 +286,34 @@
|
|
268 |
}, 200);
|
269 |
});
|
270 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
271 |
|
272 |
</script>
|
273 |
</body>
|
|
|
2 |
<html>
|
3 |
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
4 |
<head>
|
5 |
+
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.2/css/all.min.css">
|
6 |
<link rel="preload" href="{{ url_for('static', filename='eye.gif') }}" as="image">
|
7 |
<link rel="icon" type="image/png" href="https://images.squarespace-cdn.com/content/v1/64790f5777b5d772678cce83/6d71eaee-f825-4324-be9b-2def32469eac/Untitled+drawing+%2811%29.png?format=100w">
|
8 |
<title>a random unsecured camera</title>
|
|
|
104 |
color:rgb(83, 83, 83);
|
105 |
transition: 0.5s ease;
|
106 |
}
|
107 |
+
.tag {
|
108 |
+
font-family: 'Helvetica';
|
109 |
+
font-weight: 50;
|
110 |
+
margin: auto;
|
111 |
+
color:yellow;
|
112 |
+
}
|
113 |
+
|
114 |
+
#share {
|
115 |
+
margin: auto;
|
116 |
+
margin-left: 10px;
|
117 |
+
color: yellow;
|
118 |
+
transition: 0.3s ease;
|
119 |
+
}
|
120 |
+
#share:hover {
|
121 |
+
opacity: 0.5;
|
122 |
}
|
123 |
+
|
124 |
@media only screen and (orientation: portrait) {
|
125 |
body {
|
126 |
margin-left: auto;
|
|
|
154 |
.info {
|
155 |
width: 90%;
|
156 |
height: 65%;
|
157 |
+
}
|
|
|
158 |
}
|
159 |
</style>
|
160 |
</head>
|
|
|
183 |
refresh
|
184 |
</button>
|
185 |
</a>
|
186 |
+
<i id="share" class="fa-solid fa-link" data-id="{{ id }}"></i>
|
187 |
+
<p id="copied" class="tag" style="visibility: hidden;">copied</p>
|
188 |
</div>
|
189 |
|
190 |
<p id="info-text" style="color:rgb(83, 83, 83); font-family: 'Helvetica'; font-weight: 50;">
|
|
|
193 |
lat, lon: {{ loc }}<br>
|
194 |
time: <span id="time"></span><br><br>
|
195 |
|
196 |
+
<span class="tag">a brayden moore website<br></span>thanks for visiting
|
197 |
</p>
|
198 |
|
199 |
<!--
|
|
|
210 |
|
211 |
|
212 |
<script>
|
213 |
+
|
214 |
+
// Handle feed load and refresh
|
215 |
let loadingGif = "{{ url_for('static', filename='eye.gif') }}";
|
216 |
let currentFeed;
|
217 |
document.addEventListener("DOMContentLoaded", function() {
|
|
|
269 |
img.src = newUrl;
|
270 |
});
|
271 |
|
272 |
+
// Time count
|
273 |
document.addEventListener("DOMContentLoaded", function() {
|
274 |
const timezone = "{{ timezone }}";
|
275 |
setInterval(() => {
|
|
|
286 |
}, 200);
|
287 |
});
|
288 |
|
289 |
+
// Copy link
|
290 |
+
document.addEventListener("DOMContentLoaded", function() {
|
291 |
+
const shareIcon = document.getElementById("share");
|
292 |
+
const copiedText = document.getElementById("copied");
|
293 |
+
|
294 |
+
shareIcon.addEventListener("click", function() {
|
295 |
+
const id = this.getAttribute("data-id");
|
296 |
+
const urlToCopy = `${window.location.origin}/?new=false&id=${id}`;
|
297 |
+
|
298 |
+
navigator.clipboard.writeText(urlToCopy).then(() => {
|
299 |
+
console.log("URL copied to clipboard");
|
300 |
+
shareIcon.className = "fa-solid fa-check";
|
301 |
+
//copiedText.style.visibility = "visible";
|
302 |
+
}).catch(err => {
|
303 |
+
console.log("Could not copy text: ", err);
|
304 |
+
});
|
305 |
+
});
|
306 |
+
});
|
307 |
+
|
308 |
+
// Connect vs search
|
309 |
+
document.addEventListener("DOMContentLoaded", function() {
|
310 |
+
const urlParams = new URLSearchParams(window.location.search);
|
311 |
+
const countryElement = document.getElementById("country");
|
312 |
+
|
313 |
+
if (urlParams.get('new') === 'false') {
|
314 |
+
countryElement.textContent = "connecting...";
|
315 |
+
}
|
316 |
+
});
|
317 |
|
318 |
</script>
|
319 |
</body>
|