-
-
Notifications
You must be signed in to change notification settings - Fork 56
/
Copy pathmodules.py
116 lines (92 loc) · 5.48 KB
/
modules.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
"""
This module contains all the necessary functions and classes to run the application.
"""
from tamga import Tamga # Importing Tamga Logger
# Importing necessary modules and libraries
import os # Operating system interfaces
import ssl # Secure Sockets Layer (SSL) and Transport Layer Security (TLS) cryptographic protocols
import socket # Socket module provides access to the BSD socket interface
import smtplib # SMTP (Simple Mail Transfer Protocol) client session object
import secrets # Generate secure random numbers for managing secrets
import sqlite3 # SQLite database library
from os import mkdir # Importing mkdir function from os module directly
from io import BytesIO # Importing BytesIO class from io module
from time import tzname # Importing tzname attribute from time module
from random import randint # Importing randint function from random module
from os.path import exists # Importing exists function from os.path module
from datetime import datetime, timedelta # Date and time handling
from requests import post as requestsPost # HTTP library for sending POST requests
from json import load # Importing load function from json module
import uuid # UUID (Universally Unique Identifier) generation
from re import sub # Importing sub function from re module
# Importing constants
from constants import *
from email.message import EmailMessage # Email handling
from passlib.hash import sha512_crypt as encryption # Password hashing library
# Importing forms
from utils.forms.LoginForm import LoginForm # Form class for user login
from utils.forms.SignUpForm import SignUpForm # Form class for user sign-up
from utils.forms.CommentForm import CommentForm # Form class for commenting
from utils.forms.CreatePostForm import (
CreatePostForm,
) # Form class for creating a new post
from utils.forms.VerifyUserForm import (
VerifyUserForm,
) # Form class for verifying user information
from utils.forms.PasswordResetForm import (
PasswordResetForm,
) # Form class for resetting a user's password
from utils.forms.ChangePasswordForm import (
ChangePasswordForm,
) # Form class for changing a user's password
from utils.forms.ChangeUserNameForm import (
ChangeUserNameForm,
) # Form class for changing a user's username
from utils.forms.ChangeProfilePictureForm import (
ChangeProfilePictureForm,
) # Form class for changing a user's profile picture
from flask import (
Flask, # Flask web application framework
flash, # Provides feedback messages to users
abort, # Stops processing and returns an HTTP error response
url_for, # Generates URLs for Flask routes
request, # Provides access to incoming request data
session, # Stores user session information
redirect, # Redirects the client to a different URL
Blueprint, # Helps organize related routes in Flask applications
send_file, # Sends a file to the client
render_template, # Renders HTML templates
send_from_directory, # Sends a file from a directory to the client
)
# Importing the 'flashMessage' function from the 'utils.flashMessage' module for displaying flash messages.
from utils.flashMessage import flashMessage # Function for displaying flash messages
# Importing functions from the 'utils.time' module for handling date and time-related operations.
from utils.time import currentDate, currentTime, currentTimeStamp, currentTimeZone
# Importing the 'Log' class from the 'utils.log' module for logging messages.
from utils.log import Log
# Importing the 'addPoints' function from the 'utils.addPoints' module for adding points to user accounts.
from utils.addPoints import addPoints
# Importing the 'changeUserRole' function from the 'utils.changeUserRole' module for changing user roles.
from utils.changeUserRole import changeUserRole
# Importing the 'getProfilePicture' function from the 'utils.getProfilePicture' module for retrieving user profile pictures.
from utils.getProfilePicture import getProfilePicture
# Importing the 'terminalASCII' function from the 'utils.terminalASCII' module for displaying ASCII art in the terminal.
from utils.terminalASCII import terminalASCII
# Importing the 'isLogin' context processor from the 'utils.contextProcessor.isLogin' module
from utils.contextProcessor.isLogin import isLogin
# Importing the 'isRegistration' context processor from the 'utils.contextProcessor.isRegistration' module
from utils.contextProcessor.isRegistration import isRegistration
# Importing the 'recaptchaBadge' context processor from the 'utils.contextProcessor.recaptchaBadge' module
from utils.contextProcessor.recaptchaBadge import recaptchaBadge
# Importing the 'injectTranslations' function from the 'utils.contextProcessor.translations' module
from utils.contextProcessor.translations import injectTranslations
# Importing the 'browserLanguage' function from the 'utils.beforeRequest.browserLanguage' module
from utils.beforeRequest.browserLanguage import browserLanguage
# Importing the 'returnUserProfilePicture' context processor from the 'utils.contextProcessor.returnUserProfilePicture' module
from utils.contextProcessor.returnUserProfilePicture import returnUserProfilePicture
# Importing the 'Delete' class from the 'utils.delete' module for handling delete operations.
from utils.delete import Delete
# Importing the urlID generator for posts
from utils.generateUrlIdFromPost import generateurlID
# Importing the 'calculateReadTime' function from the 'utils.calculateReadTime' module for calculating reading time.
from utils.calculateReadTime import calculateReadTime