aboutsummaryrefslogtreecommitdiff
path: root/ignis
diff options
context:
space:
mode:
authorBobby <[email protected]>2023-05-12 19:48:14 -0400
committerBobby <[email protected]>2023-05-12 19:48:14 -0400
commit72cb0effcaf9e6caaaa09627a0741fa3b6c05212 (patch)
tree53a980587574183ca42bd8b8d0599e0f6d235a70 /ignis
parentc803bb4861f06298baae38b6954d0b50c8c9ee28 (diff)
downloadthatcomputerscientist-72cb0effcaf9e6caaaa09627a0741fa3b6c05212.tar.xz
thatcomputerscientist-72cb0effcaf9e6caaaa09627a0741fa3b6c05212.zip
Welcome section update. Chat box added. Screenshot reflects chatting as well
Diffstat (limited to 'ignis')
-rw-r--r--ignis/views.py16
1 files changed, 14 insertions, 2 deletions
diff --git a/ignis/views.py b/ignis/views.py
index bb52c9f8..da39301d 100644
--- a/ignis/views.py
+++ b/ignis/views.py
@@ -9,7 +9,7 @@ import requests
from django.core.files.base import ContentFile
from captcha.image import ImageCaptcha
from users.tokens import CaptchaTokenGenerator
-
+from django.conf import settings
from django.http import HttpResponse
from django.views.decorators.cache import never_cache
from PIL import Image
@@ -182,11 +182,23 @@ def get_screenshot(request):
driver = webdriver.Firefox(options=options)
driver.set_window_size(1280, 1440)
- url = 'https://www.thatcomputerscientist.com'
+ url = 'https://www.thatcomputerscientist.com' if not settings.DEBUG else 'https://preview.thatcomputerscientist.com'
+ print(settings.DEBUG)
# Wait until the page is loaded
driver.get(url)
time.sleep(5)
+
+ # write 3 chat messages in #chatbox-input
+ chatbox = driver.find_element('id', 'chatbox-input')
+ chatbox.send_keys('Hello!')
+ chatbox.send_keys(u'\ue007')
+
+ chatbox.send_keys('Welcome to my website!')
+ chatbox.send_keys(u'\ue007')
+
+ chatbox.send_keys('You are currently viewing a a dynamically generated screenshot of my website!')
+ chatbox.send_keys(u'\ue007')
screenshot = driver.get_screenshot_as_png()
screenshot = Image.open(BytesIO(screenshot))