Skip to content

Commit

Permalink
a
Browse files Browse the repository at this point in the history
  • Loading branch information
jjaegii committed Aug 26, 2022
1 parent c4b6405 commit 3f4e1ee
Show file tree
Hide file tree
Showing 53 changed files with 1,305 additions and 521 deletions.
17 changes: 17 additions & 0 deletions .env
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
SECRET_KEY='django-insecure-fl77=+_#!xbj+6dnet8(m#(@%ybq1k=+_dw+h^s+cn8@#i5-i*'
DEBUG=True
ENGINE='django.db.backends.mysql'
DBNAME='catchcunning'
DBHOST='localhost'
DBPORT='3306'
DBUSER='du'
DBPW='aa1541'
STATIC_URL='/static/'
EMAIL_BACKEND='django.core.mail.backends.smtp.EmailBackend'
EMAIL_HOST='email-smtp.ap-northeast-2.amazonaws.com'
EMAIL_PORT=587
EMAIL_USE_TLS=True
EMAIL_HOST_USER='AKIAS5D7RJ4TB2BJ4P63'
EMAIL_HOST_PASSWORD='BDmxjvri6lwORjy0Ce7odErul2Kw78YlI9e+U/jYAOtA'
DEFAULT_FROM_EMAIL='hn06038@gmail.com'
MEDIA_URL='/media/'
Binary file modified catchcunning/__pycache__/settings.cpython-38.pyc
Binary file not shown.
69 changes: 27 additions & 42 deletions catchcunning/settings.py
Original file line number Diff line number Diff line change
@@ -1,39 +1,26 @@
"""
Django settings for Ncheat project.
Generated by 'django-admin startproject' using Django 4.0.1.
For more information on this file, see
https://docs.djangoproject.com/en/4.0/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/4.0/ref/settings/
"""

from pathlib import Path
import os
from django.core.exceptions import ImproperlyConfigured
import environ

# Build paths inside the project like this: BASE_DIR / 'subdir'.
BASE_DIR = Path(__file__).resolve().parent.parent

env = environ.Env(DEBUG=(bool, True))

environ.Env.read_env(
env_file=os.path.join(BASE_DIR, '.env')
)

# Quick-start development settings - unsuitable for production
# See https://docs.djangoproject.com/en/4.0/howto/deployment/checklist/


# SECURITY WARNING: keep the secret key used in production secret!
def get_env_variable(var_name):
try:
return os.environ[var_name]
except KeyError:
error_msg = "Set the {} environment variable".format(var_name)
raise ImproperlyConfigured(error_msg)


SECRET_KEY = get_env_variable("Django_SECRET_KEY")
SECRET_KEY = env('SECRET_KEY')
DEBUG = env('DEBUG')

# SECURITY WARNING: don't run with debug turned on in production!
DEBUG = True

ALLOWED_HOSTS = ['*', 'catchcunning.site', ]

Expand Down Expand Up @@ -93,12 +80,12 @@ def get_env_variable(var_name):

DATABASES = {
'default': {
'ENGINE': 'django.db.backends.mysql',
'NAME': 'catchcunning',
'Host': 'localhost',
'PORT': '3306',
'USER': 'du',
'PASSWORD': 'aa1541',
'ENGINE': env('ENGINE'),
'NAME': env('DBNAME'),
'Host': env('DBHOST'),
'PORT': env('DBPORT'),
'USER': env('DBUSER'),
'PASSWORD': env('DBPW'),
}
}

Expand Down Expand Up @@ -128,7 +115,7 @@ def get_env_variable(var_name):
# Static files (CSS, JavaScript, Images)
# https://docs.djangoproject.com/en/4.0/howto/static-files/

STATIC_URL = '/static/'
STATIC_URL = env('STATIC_URL')
STATICFILES_DIRS = [BASE_DIR.joinpath('static')]

# Default primary key field type
Expand Down Expand Up @@ -159,10 +146,10 @@ def get_env_variable(var_name):
ACCOUNT_SESSION_REMEMBER = False # 항상 기억할지(브라우저 종료해도)
# SEESION_COOKIE_AGE = 3600 #쿠기 유지 시간(초단위, 기본시간 2주?)
# 만료된 세션 아이디는 자동으로 삭제 안 됨 -> python manage.py clearsessions
ACCOUNT_PASSWORD_INPUT_RENDER_VALUE = True # 비번은 유지
ACCOUNT_EMAIL_VARIFICATION = "mandatory"
ACCOUNT_PASSWORD_INPUT_RENDER_VALUE = False # 비번은 유지
ACCOUNT_EMAIL_VARIFICATION = "optional"
# mandatory 무조건 인증, optional 인증 안해도 디폴트 값, none 아예 인증 필요x
ACCOUNT_CONFIEM_EMAIL_ON_GET = True
ACCOUNT_CONFIEM_EMAIL_ON_GET = False
ACCOUNT_EMAIL_CONFIRMATION_AUTHENTICATED_REDIRECT_URL = {
"account_email_confirmation_done"
} # 로그인 됐을 때
Expand All @@ -174,17 +161,15 @@ def get_env_variable(var_name):

# Email Settings

EMAIL_BACKEND = 'django.core.mail.backends.console.EmailBackend'
# EMAIL_BACKEND = "django.core.mail.backends.smtp.EmailBackend"
# EMAIL_HOST = "smtp.gmail.com"
# EMAIL_PORT = 587
# EMAIL_USE_TLS = True
# EMAIL_USE_SSL = False
# EAMIL_HOST_USER = "tgu06167@yu.ac.kr"
# EAMIL_HOST_PASSWORD = "rmijzecloiljrxpx"
# DEFAULT_FROM_EMAIL = EAMIL_HOST_USER
EMAIL_BACKEND = env('EMAIL_BACKEND')
EMAIL_HOST = env('EMAIL_HOST')
EMAIL_PORT = env('EMAIL_PORT')
EMAIL_USE_TLS = env('EMAIL_USE_TLS')
EMAIL_HOST_USER = env('EMAIL_HOST_USER')
EMAIL_HOST_PASSWORD = env('EMAIL_HOST_PASSWORD')
DEFAULT_FROM_EMAIL = env('DEFAULT_FROM_EMAIL')

# 미디어

MEDIA_URL = '/media/'
MEDIA_URL = env('MEDIA_URL')
MEDIA_ROOT = os.path.join(BASE_DIR, 'media')
690 changes: 690 additions & 0 deletions django.log

Large diffs are not rendered by default.

Binary file added media/image3434.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added media/image6485.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added media/image7162.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added media/images/capture-test.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added media/images/capture-test_5yAoqWH.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added media/images/test.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified meeting/__pycache__/urls.cpython-38.pyc
Binary file not shown.
Binary file modified meeting/__pycache__/views.cpython-38.pyc
Binary file not shown.
66 changes: 66 additions & 0 deletions meeting/kakaoAlarm.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
import json
from signal import alarm
import requests
import sys


def sendToMeMessage(text):

header = {"Authorization": 'Bearer ' + KAKAO_TOKEN}
url = "https://kapi.kakao.com/v2/api/talk/memo/default/send" #나에게 보내기 주소

post = {
"object_type": "text",
"text": text,
"link": {
"web_url": "https://developers.kakao.com",
"mobile_web_url": "https://developers.kakao.com"
},

"button_title": "바로 확인"
}
data = {"template_object": json.dumps(post)}
return requests.post(url, headers=header, data=data)

alarm = ""
for arg in sys.argv:
alarm += (str(arg))


message = alarm.replace("meeting/kakaoAlarm.py", "")


# alarm = sys.argv[1]

# if len(sys.argv) != 2:
# print("Insufficient arguments")
# sys.exit()


text = "나에게 보내는 카톡: " + message
KAKAO_TOKEN = 'hbMIfEbVMXYnvukOHRjf2uBVlPp0rQOeewUEc-GgCj1zGAAAAYLX3t4F'

print(sendToMeMessage(text).text)


# import requests
# import json

# url = 'https://kauth.kakao.com/oauth/token'
# client_id = '5150e927350491eae8a6f52e4a81c17f'
# redirect_uri = 'https://example.com/oauth'
# code = 'qeW907Pscxzck_KBY1VJUd-aZOcZxtIzjRlrGm31HZk3DIC-hvqgdPF26PPOUTffvOSH8Ao9dNkAAAGC19zKwA'

# data = {
# 'grant_type':'authorization_code',
# 'client_id':client_id,
# 'redirect_uri':redirect_uri,
# 'code': code,
# }

# response = requests.post(url, data=data)
# tokens = response.json()

# #발행된 토큰 저장
# with open("token.json","w") as kakao:
# json.dump(tokens, kakao)
62 changes: 54 additions & 8 deletions meeting/templates/meeting/lobby.html
Original file line number Diff line number Diff line change
Expand Up @@ -12,24 +12,47 @@
media="screen"
href="{% static 'meeting/styles/main.css' %}"
/>
<link href="https://fonts.googleapis.com/css2?family=Noto+Sans+KR&display=swap" rel="stylesheet"/>
<link href="https://fonts.googleapis.com/css2?family=Rubik&display=swap" rel="stylesheet">
<link
href="https://fonts.googleapis.com/css2?family=Noto+Sans+KR&display=swap"
rel="stylesheet"
/>
<link
href="https://fonts.googleapis.com/css2?family=Rubik&display=swap"
rel="stylesheet"
/>
<script
src="https://kit.fontawesome.com/64760829c9.js"
crossorigin="anonymous"
></script>
<script src="https://html2canvas.hertzen.com/dist/html2canvas.min.js"></script>
</head>

<body>
<video id="video" autoplay></video>
<button class="outside-nav" id="capture-btn" type="button">
<i class="fa-solid fa-camera"></i> 화면캡처
</button>

<section id="form-container">
<img id="logo" src="{% static 'meeting/images/chat-icon.svg' %}" />
<i class="fa-solid fa-video" id="logo"></i>
<div id="welcome-message">
<h1>이곳은 로비입니다.</h1>
<p>
시작 전 시험에 응시할 준비를 해주시기 바랍니다.<br />
준비를 마쳤다면 아래 버튼을 눌러 시험장에 입장하세요.
문제 불러오기 버튼을 눌러서 문제를 업로드합니다.<br />
준비가 끝났다면 Join Stream을 눌러 시험장에 입장하세요.
</p>
</div>
{% if user.superintendent == 0 %}
<!-- 응시자 로그인 -->

<form method="post" action="{% url 'meeting:getImageName' %}">
{% csrf_token %}
<input name="room_name" value="{{room_name}}" hidden />
<button type="submit" class="lby-btn" id="pull-questions">
문제 불러오기
</button>
</form>

<form id="form">
<div class="field-wrapper">
<div class="form-field">
Expand All @@ -52,7 +75,14 @@ <h1>이곳은 로비입니다.</h1>
</div>

<div class="form-field">
<input type="submit" value="Join Stream" class="submit-btn"/>
<button
type="submit"
class="lby-btn disabled"
id="join-btn"
disabled
>
Join Stream
</button>
</div>
</div>
</form>
Expand Down Expand Up @@ -80,6 +110,14 @@ <h1>이곳은 로비입니다.</h1>

form.addEventListener("submit", handleSubmit);
</script>
<script>
const pullQuestionsBtn = document.getElementById("pull-questions");
const joinBtn = document.getElementById("join-btn");
pullQuestionsBtn.addEventListener("click", () => {
joinBtn.removeAttribute("disabled");
joinBtn.classList.remove("disabled");
});
</script>
{% else %}
<!-- 감독관 로그인 -->
<form id="supervisorForm">
Expand All @@ -101,7 +139,9 @@ <h1>이곳은 로비입니다.</h1>
/>
</div>
<div class="form-field">
<input type="submit" value="Join Stream" class="submit-btn"/>
<button type="submit" class="lby-btn" id="join-btn">
Join Stream
</button>
</div>
</div>
</form>
Expand Down Expand Up @@ -131,6 +171,8 @@ <h1>이곳은 로비입니다.</h1>
</script>
{% endif %}
</section>

<video id="video" autoplay></video>
</body>

<script>
Expand All @@ -147,4 +189,8 @@ <h1>이곳은 로비입니다.</h1>
});
}
</script>
<script
type="text/javascript"
src="{% static 'user/js/screenCapture.js' %}"
></script>
</html>
40 changes: 30 additions & 10 deletions meeting/templates/meeting/room.html
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
<!DOCTYPE html>
{% load static %}

<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8" />
Expand All @@ -18,18 +19,32 @@
media="screen"
href="{% static 'meeting/styles/exam.css' %}"
/>
<script
src="https://kit.fontawesome.com/64760829c9.js"
crossorigin="anonymous"
></script>
<script src="https://html2canvas.hertzen.com/dist/html2canvas.min.js"></script>
</head>
<body>
<h2 id="clock"></h2>
<button id="fullscreenOff" hidden>시험 종료</button>
<button id="fullscreenOn">시험 시작</button>

<section id="room-name-wrapper">
<p>Room Name: <span id="room-name"></span></p>
</section>

<body>
<section id="video-streams"></section>

<div class="nav-bar">
<div class="nav-bar-text">
<section id="room-name-wrapper">
<p>Room Name: <span id="room-name"></span></p>
</section>
</div>
<div><h2 id="clock"></h2></div>
<div class="nav-bar-text">
<button class="inside-nav" id="capture-btn" type="button">
<i class="fa-solid fa-camera"></i> 화면캡처
</button>
<button id="fullscreenOff" hidden>시험 종료</button>
<button id="fullscreenOn">시험 시작</button>
</div>
</div>

<section id="controls-wrapper">
<div class="icon-wrapper">
<img
Expand Down Expand Up @@ -57,7 +72,7 @@ <h2 id="clock"></h2>
</section>

<div id="exampage" style="text-align: center; display: none">
<img src="" alt="" align="middle" />
<img src="/media/{{user.testPath}}" alt="" align="middle" />
</div>

<div id="fullscreen-off-warning" class="hidden modal">
Expand Down Expand Up @@ -85,11 +100,16 @@ <h2 id="clock"></h2>
<script>
const startBtn = document.getElementById("fullscreenOn");
const endBtn = document.getElementById("fullscreenOff");

startBtn.addEventListener("click", () => {
startBtn.setAttribute("hidden", "");
endBtn.removeAttribute("hidden");
});
</script>
<script
type="text/javascript"
src="{% static 'user/js/screenCapture.js' %}"
></script>
<script
type="text/javascript"
src="{% static 'meeting/assets/AgoraRTC_N-4.8.0.js' %}"
Expand Down
Loading

0 comments on commit 3f4e1ee

Please sign in to comment.