mbonea-ewallet godwin
commited on
Commit
·
8450c71
1
Parent(s):
15cbc52
cruds are ready
Browse filesThis view is limited to 50 files because it contains too many changes.
See raw diff
- .gitignore +0 -130
- .pre-commit-config.yaml +0 -31
- App/Analytics/AnalyticsRoutes.py +10 -0
- App/Analytics/Model.py +21 -0
- App/Analytics/Schemas.py +15 -0
- App/Authentication.py +7 -0
- App/CommentLikes/CommentLikesRoutes.py +11 -0
- App/CommentLikes/Model.py +18 -0
- App/CommentLikes/Schemas.py +15 -0
- App/Comments/CommentRoutes.py +53 -0
- App/Comments/Model.py +21 -0
- App/Comments/Schemas.py +24 -0
- App/Comments/__pycache__/CommentRoutes.cpython-38.pyc +0 -0
- App/Comments/__pycache__/Model.cpython-38.pyc +0 -0
- App/Comments/__pycache__/Schemas.cpython-38.pyc +0 -0
- App/Post/Model.py +19 -0
- App/Post/PostRoutes.py +24 -0
- App/Post/Schemas.py +19 -0
- App/Post/__pycache__/Model.cpython-38.pyc +0 -0
- App/Post/__pycache__/PostRoutes.cpython-38.pyc +0 -0
- App/Post/__pycache__/Schemas.cpython-38.pyc +0 -0
- App/PostLikes/Model.py +20 -0
- App/PostLikes/PostLikesRoutes.py +41 -0
- App/PostLikes/Schemas.py +16 -0
- App/PostLikes/__pycache__/Model.cpython-38.pyc +0 -0
- App/PostLikes/__pycache__/PostLikesRoutes.cpython-38.pyc +0 -0
- App/PostLikes/__pycache__/Schemas.cpython-38.pyc +0 -0
- App/Settings.py +3 -0
- App/Users/Model.py +28 -0
- App/Users/Schemas.py +15 -0
- App/Users/UserRoutes.py +27 -0
- App/Users/__pycache__/Model.cpython-38.pyc +0 -0
- App/Users/__pycache__/Schemas.cpython-38.pyc +0 -0
- App/Users/__pycache__/UserRoutes.cpython-38.pyc +0 -0
- App/__init__.py +0 -0
- App/__pycache__/__init__.cpython-38.pyc +0 -0
- App/__pycache__/app.cpython-38.pyc +0 -0
- App/__pycache__/modelInit.cpython-38.pyc +0 -0
- App/__pycache__/utils.cpython-38.pyc +0 -0
- App/app.py +36 -0
- App/modelInit.py +9 -0
- App/utils.py +14 -0
- LICENSE +0 -24
- README.md +0 -156
- __pycache__/app.cpython-38.pyc +0 -0
- data.txt +1 -0
- example.env +0 -1
- requirements.txt +16 -4
- setup.cfg +0 -3
- setup.py +0 -35
.gitignore
DELETED
@@ -1,130 +0,0 @@
|
|
1 |
-
# Byte-compiled / optimized / DLL files
|
2 |
-
__pycache__/
|
3 |
-
*.py[cod]
|
4 |
-
*$py.class
|
5 |
-
|
6 |
-
# C extensions
|
7 |
-
*.so
|
8 |
-
|
9 |
-
# Distribution / packaging
|
10 |
-
.Python
|
11 |
-
build/
|
12 |
-
develop-eggs/
|
13 |
-
dist/
|
14 |
-
downloads/
|
15 |
-
eggs/
|
16 |
-
.eggs/
|
17 |
-
lib/
|
18 |
-
lib64/
|
19 |
-
parts/
|
20 |
-
sdist/
|
21 |
-
var/
|
22 |
-
wheels/
|
23 |
-
pip-wheel-metadata/
|
24 |
-
share/python-wheels/
|
25 |
-
*.egg-info/
|
26 |
-
.installed.cfg
|
27 |
-
*.egg
|
28 |
-
MANIFEST
|
29 |
-
|
30 |
-
# PyInstaller
|
31 |
-
# Usually these files are written by a python script from a template
|
32 |
-
# before PyInstaller builds the exe, so as to inject date/other infos into it.
|
33 |
-
*.manifest
|
34 |
-
*.spec
|
35 |
-
|
36 |
-
# Installer logs
|
37 |
-
pip-log.txt
|
38 |
-
pip-delete-this-directory.txt
|
39 |
-
|
40 |
-
# Unit test / coverage reports
|
41 |
-
htmlcov/
|
42 |
-
.tox/
|
43 |
-
.nox/
|
44 |
-
.coverage
|
45 |
-
.coverage.*
|
46 |
-
.cache
|
47 |
-
nosetests.xml
|
48 |
-
coverage.xml
|
49 |
-
*.cover
|
50 |
-
*.py,cover
|
51 |
-
.hypothesis/
|
52 |
-
.pytest_cache/
|
53 |
-
|
54 |
-
# Translations
|
55 |
-
*.mo
|
56 |
-
*.pot
|
57 |
-
|
58 |
-
# Django stuff:
|
59 |
-
*.log
|
60 |
-
local_settings.py
|
61 |
-
db.sqlite3
|
62 |
-
db.sqlite3-journal
|
63 |
-
|
64 |
-
# Flask stuff:
|
65 |
-
instance/
|
66 |
-
.webassets-cache
|
67 |
-
|
68 |
-
# Scrapy stuff:
|
69 |
-
.scrapy
|
70 |
-
|
71 |
-
# Sphinx documentation
|
72 |
-
docs/_build/
|
73 |
-
|
74 |
-
# PyBuilder
|
75 |
-
target/
|
76 |
-
|
77 |
-
# Jupyter Notebook
|
78 |
-
.ipynb_checkpoints
|
79 |
-
|
80 |
-
# IPython
|
81 |
-
profile_default/
|
82 |
-
ipython_config.py
|
83 |
-
|
84 |
-
# pyenv
|
85 |
-
.python-version
|
86 |
-
|
87 |
-
# pipenv
|
88 |
-
# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
|
89 |
-
# However, in case of collaboration, if having platform-specific dependencies or dependencies
|
90 |
-
# having no cross-platform support, pipenv may install dependencies that don't work, or not
|
91 |
-
# install all needed dependencies.
|
92 |
-
#Pipfile.lock
|
93 |
-
|
94 |
-
# PEP 582; used by e.g. github.com/David-OConnor/pyflow
|
95 |
-
__pypackages__/
|
96 |
-
|
97 |
-
# Celery stuff
|
98 |
-
celerybeat-schedule
|
99 |
-
celerybeat.pid
|
100 |
-
|
101 |
-
# SageMath parsed files
|
102 |
-
*.sage.py
|
103 |
-
|
104 |
-
# Environments
|
105 |
-
.env
|
106 |
-
.venv
|
107 |
-
env/
|
108 |
-
venv/
|
109 |
-
ENV/
|
110 |
-
env.bak/
|
111 |
-
venv.bak/
|
112 |
-
|
113 |
-
# Spyder project settings
|
114 |
-
.spyderproject
|
115 |
-
.spyproject
|
116 |
-
|
117 |
-
# Rope project settings
|
118 |
-
.ropeproject
|
119 |
-
|
120 |
-
# mkdocs documentation
|
121 |
-
/site
|
122 |
-
|
123 |
-
# mypy
|
124 |
-
.mypy_cache/
|
125 |
-
.dmypy.json
|
126 |
-
dmypy.json
|
127 |
-
|
128 |
-
# Pyre type checker
|
129 |
-
.pyre/
|
130 |
-
cookies.json
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
.pre-commit-config.yaml
DELETED
@@ -1,31 +0,0 @@
|
|
1 |
-
repos:
|
2 |
-
- repo: https://github.com/asottile/reorder_python_imports
|
3 |
-
rev: v3.9.0
|
4 |
-
hooks:
|
5 |
-
- id: reorder-python-imports
|
6 |
-
args: [--py37-plus]
|
7 |
-
- repo: https://github.com/asottile/add-trailing-comma
|
8 |
-
rev: v2.3.0
|
9 |
-
hooks:
|
10 |
-
- id: add-trailing-comma
|
11 |
-
args: [--py36-plus]
|
12 |
-
- repo: https://github.com/asottile/pyupgrade
|
13 |
-
rev: v3.3.1
|
14 |
-
hooks:
|
15 |
-
- id: pyupgrade
|
16 |
-
args: [--py37-plus]
|
17 |
-
|
18 |
-
- repo: https://github.com/pre-commit/pre-commit-hooks
|
19 |
-
rev: v4.4.0
|
20 |
-
hooks:
|
21 |
-
- id: trailing-whitespace
|
22 |
-
- id: end-of-file-fixer
|
23 |
-
- id: check-yaml
|
24 |
-
- id: debug-statements
|
25 |
-
- id: double-quote-string-fixer
|
26 |
-
- id: name-tests-test
|
27 |
-
- id: requirements-txt-fixer
|
28 |
-
- repo: https://github.com/psf/black
|
29 |
-
rev: 22.10.0
|
30 |
-
hooks:
|
31 |
-
- id: black
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
App/Analytics/AnalyticsRoutes.py
ADDED
@@ -0,0 +1,10 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
from fastapi import APIRouter, status
|
2 |
+
from .Schemas import BaseRequest, editRequest
|
3 |
+
from .Model import Comments
|
4 |
+
from App.Users.Model import User
|
5 |
+
from App.Post.Model import Post
|
6 |
+
|
7 |
+
analytics_router = APIRouter(tags=["Analytics"])
|
8 |
+
|
9 |
+
|
10 |
+
|
App/Analytics/Model.py
ADDED
@@ -0,0 +1,21 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import asyncio
|
2 |
+
import orm
|
3 |
+
import psycopg2
|
4 |
+
import datetime
|
5 |
+
import pydantic
|
6 |
+
from App.modelInit import database, models
|
7 |
+
from App.Users.Model import User
|
8 |
+
|
9 |
+
|
10 |
+
class Analytics(orm.Model):
|
11 |
+
tablename = "Analytics"
|
12 |
+
registry = models
|
13 |
+
fields = {
|
14 |
+
"id": orm.Integer(primary_key=True),
|
15 |
+
"user": orm.ForeignKey(User, on_delete=orm.CASCADE,allow_null=True), # Optional for unknown users.
|
16 |
+
"post": orm.ForeignKey(User, on_delete=orm.CASCADE),
|
17 |
+
"ip": orm.String(max_length=100),
|
18 |
+
"device": orm.String(max_length=100),
|
19 |
+
"country": orm.String(max_length=100),
|
20 |
+
"createdAt": orm.DateTime(index=True, default=datetime.datetime.now),
|
21 |
+
}
|
App/Analytics/Schemas.py
ADDED
@@ -0,0 +1,15 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
from typing import List, Optional
|
2 |
+
from pydantic import EmailStr, BaseModel
|
3 |
+
from datetime import date, datetime, time, timedelta
|
4 |
+
|
5 |
+
|
6 |
+
class BaseRequest(BaseModel):
|
7 |
+
user: Optional[int]
|
8 |
+
id: Optional[int]
|
9 |
+
content: Optional[str]
|
10 |
+
|
11 |
+
|
12 |
+
class editRequest(BaseRequest):
|
13 |
+
updatedAt: datetime = datetime.now()
|
14 |
+
|
15 |
+
|
App/Authentication.py
ADDED
@@ -0,0 +1,7 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
from fastapi import APIRouter, status
|
2 |
+
from fastapi.security import OAuth2PasswordBearer,OAuth2PasswordRequestForm
|
3 |
+
|
4 |
+
|
5 |
+
|
6 |
+
|
7 |
+
|
App/CommentLikes/CommentLikesRoutes.py
ADDED
@@ -0,0 +1,11 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
from fastapi import APIRouter, status
|
2 |
+
from .Schemas import BaseRequest, editRequest
|
3 |
+
from .Model import Comments
|
4 |
+
from App.Users.Model import User
|
5 |
+
from App.Post.Model import Post
|
6 |
+
|
7 |
+
commentLikes_router = APIRouter(tags=["CommentLikes"])
|
8 |
+
|
9 |
+
@commentLikes_router.get('/likes/comments/add')
|
10 |
+
async def add_commentLike():
|
11 |
+
pass
|
App/CommentLikes/Model.py
ADDED
@@ -0,0 +1,18 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import asyncio
|
2 |
+
import orm
|
3 |
+
import psycopg2
|
4 |
+
import datetime
|
5 |
+
import pydantic
|
6 |
+
from App.modelInit import database, models
|
7 |
+
from App.Users.Model import User
|
8 |
+
from App.Post.Model import Post
|
9 |
+
|
10 |
+
class CommentLike(orm.Model):
|
11 |
+
tablename = "commentlikes"
|
12 |
+
registry = models
|
13 |
+
fields = {
|
14 |
+
"id": orm.Integer(primary_key=True),
|
15 |
+
"user": orm.ForeignKey(User, on_delete=orm.CASCADE),
|
16 |
+
"post": orm.ForeignKey(Post, on_delete=orm.CASCADE),
|
17 |
+
"createdAt": orm.DateTime(index=True, default=datetime.datetime.now),
|
18 |
+
}
|
App/CommentLikes/Schemas.py
ADDED
@@ -0,0 +1,15 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
from typing import List, Optional
|
2 |
+
from pydantic import EmailStr, BaseModel
|
3 |
+
from datetime import date, datetime, time, timedelta
|
4 |
+
|
5 |
+
|
6 |
+
class addLike (BaseModel):
|
7 |
+
postId:int
|
8 |
+
userId:int
|
9 |
+
|
10 |
+
class deleteLike (BaseModel):
|
11 |
+
id:int
|
12 |
+
postId:int
|
13 |
+
userId:int
|
14 |
+
|
15 |
+
|
App/Comments/CommentRoutes.py
ADDED
@@ -0,0 +1,53 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
from fastapi import APIRouter, status
|
2 |
+
from .Schemas import createComment,editComment,deleteComment,allComments
|
3 |
+
from .Model import Comment
|
4 |
+
from App.Users.Model import User
|
5 |
+
from App.Post.Model import Post
|
6 |
+
from App.utils import get_user_and_post
|
7 |
+
import asyncio
|
8 |
+
postLike_router = APIRouter(tags=["PostLikes"])
|
9 |
+
|
10 |
+
|
11 |
+
|
12 |
+
|
13 |
+
comment_router = APIRouter(tags=["Comments"])
|
14 |
+
|
15 |
+
|
16 |
+
@comment_router.post("/comment/create")
|
17 |
+
async def create_comment(comment: createComment):
|
18 |
+
user,_post = await get_user_and_post(comment)
|
19 |
+
db_data = await Comment.objects.create(user=user, content=comment.content,post=_post)
|
20 |
+
return {"code": 200, "message": "success", "payload": data.__dict__}
|
21 |
+
|
22 |
+
|
23 |
+
@comment_router.post("/comment/edit")
|
24 |
+
async def edit_comment(comment: editComment):
|
25 |
+
# user,_post = await get_user_and_post(comment)
|
26 |
+
db_comment = await Comment.objects.filter(id=comment.id).first()
|
27 |
+
if not db_comment:
|
28 |
+
return {"code": 400, "message": "Comment does not exist", "payload": None}
|
29 |
+
if db_comment.user.id != comment.userId:
|
30 |
+
return {
|
31 |
+
"code": 400,
|
32 |
+
"message": "This comment belongs to a different user",
|
33 |
+
"payload": None,
|
34 |
+
}
|
35 |
+
db_data = await db_comment.update(content=comment.content)
|
36 |
+
return {"code": 200, "message": "success", "payload": None}
|
37 |
+
|
38 |
+
|
39 |
+
@comment_router.post("/comment/all")
|
40 |
+
async def all_comments(comment: allComments):
|
41 |
+
|
42 |
+
user = await User.objects.filter(id=comment.userId).first()
|
43 |
+
if not user:
|
44 |
+
return {"code": 400, "message": "User does not exist", "payload": None}
|
45 |
+
db_comment = await Comment.objects.filter(user=user).all()
|
46 |
+
|
47 |
+
if not db_comment:
|
48 |
+
return {"code": 400, "message": "Comment does not exist", "payload": None}
|
49 |
+
return {
|
50 |
+
"code": 200,
|
51 |
+
"message": "success",
|
52 |
+
"payload": [i.__dict__ for i in db_comment],
|
53 |
+
}
|
App/Comments/Model.py
ADDED
@@ -0,0 +1,21 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import asyncio
|
2 |
+
import orm
|
3 |
+
import psycopg2
|
4 |
+
import datetime
|
5 |
+
import pydantic
|
6 |
+
from App.modelInit import database, models
|
7 |
+
from App.Users.Model import User
|
8 |
+
|
9 |
+
|
10 |
+
class Comment(orm.Model):
|
11 |
+
tablename = "comments"
|
12 |
+
registry = models
|
13 |
+
fields = {
|
14 |
+
"id": orm.Integer(primary_key=True),
|
15 |
+
"user": orm.ForeignKey(User, on_delete=orm.CASCADE),
|
16 |
+
"post": orm.ForeignKey(User, on_delete=orm.CASCADE),
|
17 |
+
"content": orm.String(max_length=100),
|
18 |
+
"likes": orm.Integer(index=True, default=0),
|
19 |
+
"createdAt": orm.DateTime(index=True, default=datetime.datetime.now),
|
20 |
+
"updatedAt": orm.DateTime(index=True, default=datetime.datetime.now),
|
21 |
+
}
|
App/Comments/Schemas.py
ADDED
@@ -0,0 +1,24 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
from typing import List, Optional
|
2 |
+
from pydantic import EmailStr, BaseModel
|
3 |
+
from datetime import date, datetime, time, timedelta
|
4 |
+
|
5 |
+
|
6 |
+
class createComment(BaseModel):
|
7 |
+
userId: int
|
8 |
+
content: str
|
9 |
+
postId:int
|
10 |
+
|
11 |
+
|
12 |
+
class editComment(BaseModel):
|
13 |
+
id:int
|
14 |
+
userId: int
|
15 |
+
content: str
|
16 |
+
postId:int
|
17 |
+
|
18 |
+
class deleteComment(BaseModel):
|
19 |
+
id:int
|
20 |
+
userId: int
|
21 |
+
postId:int
|
22 |
+
|
23 |
+
class allComments(BaseModel):
|
24 |
+
userId: int
|
App/Comments/__pycache__/CommentRoutes.cpython-38.pyc
ADDED
Binary file (1.88 kB). View file
|
|
App/Comments/__pycache__/Model.cpython-38.pyc
ADDED
Binary file (860 Bytes). View file
|
|
App/Comments/__pycache__/Schemas.cpython-38.pyc
ADDED
Binary file (1.1 kB). View file
|
|
App/Post/Model.py
ADDED
@@ -0,0 +1,19 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import asyncio
|
2 |
+
import orm
|
3 |
+
import psycopg2
|
4 |
+
import datetime
|
5 |
+
import pydantic
|
6 |
+
from App.modelInit import database, models
|
7 |
+
from App.Users.Model import User
|
8 |
+
|
9 |
+
|
10 |
+
class Post(orm.Model):
|
11 |
+
tablename = "posts"
|
12 |
+
registry = models
|
13 |
+
fields = {
|
14 |
+
"id": orm.Integer(primary_key=True),
|
15 |
+
"pageId": orm.Integer(index=True,default=0),
|
16 |
+
"content": orm.JSON(),
|
17 |
+
"recommendations": orm.JSON(allow_null=True),
|
18 |
+
"createdAt": orm.DateTime(index=True, default=datetime.datetime.now),
|
19 |
+
}
|
App/Post/PostRoutes.py
ADDED
@@ -0,0 +1,24 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
from fastapi import APIRouter, status
|
2 |
+
from .Schemas import createPost,editPost,getPost
|
3 |
+
from .Model import Post
|
4 |
+
|
5 |
+
post_router = APIRouter(tags=["Posts"])
|
6 |
+
|
7 |
+
|
8 |
+
@post_router.post("/post/create")
|
9 |
+
async def create_post(post: createPost):
|
10 |
+
data=await Post.objects.create(**post.dict())
|
11 |
+
return {"code": 200, "message": "success", "payload": data.__dict__}
|
12 |
+
|
13 |
+
@post_router.post("/post/update")
|
14 |
+
async def create_post(post: editPost):
|
15 |
+
temp=await Post.objects.get(id= post.id)
|
16 |
+
data=await temp.update(recommendations=post.recommendations,content=post.content)
|
17 |
+
# data=await Post.objects.update(**post.dict())
|
18 |
+
return {"code": 200, "message": "success", "payload": temp.__dict__}
|
19 |
+
|
20 |
+
|
21 |
+
@post_router.post("/post/get")
|
22 |
+
async def create_post(post: getPost):
|
23 |
+
data=await Post.objects.get(id=post.id)
|
24 |
+
return {"code": 200, "message": "success", "payload": data.__dict__}
|
App/Post/Schemas.py
ADDED
@@ -0,0 +1,19 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
from typing import List, Optional
|
2 |
+
from pydantic import EmailStr, BaseModel
|
3 |
+
from datetime import date, datetime, time, timedelta
|
4 |
+
|
5 |
+
|
6 |
+
class editPost(BaseModel):
|
7 |
+
id: Optional[int]
|
8 |
+
content:Optional[dict]
|
9 |
+
recommendations:Optional[dict]
|
10 |
+
|
11 |
+
|
12 |
+
class createPost(BaseModel):
|
13 |
+
content:Optional[dict]
|
14 |
+
recommendations:Optional[dict]
|
15 |
+
|
16 |
+
class getPost(BaseModel):
|
17 |
+
id: Optional[int]
|
18 |
+
|
19 |
+
|
App/Post/__pycache__/Model.cpython-38.pyc
ADDED
Binary file (757 Bytes). View file
|
|
App/Post/__pycache__/PostRoutes.cpython-38.pyc
ADDED
Binary file (1.1 kB). View file
|
|
App/Post/__pycache__/Schemas.cpython-38.pyc
ADDED
Binary file (947 Bytes). View file
|
|
App/PostLikes/Model.py
ADDED
@@ -0,0 +1,20 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import asyncio
|
2 |
+
import orm
|
3 |
+
import psycopg2
|
4 |
+
import datetime
|
5 |
+
import pydantic
|
6 |
+
from App.modelInit import database, models
|
7 |
+
from App.Users.Model import User
|
8 |
+
from App.Post.Model import Post
|
9 |
+
|
10 |
+
|
11 |
+
class PostLike(orm.Model):
|
12 |
+
tablename = "postlikes"
|
13 |
+
registry = models
|
14 |
+
fields = {
|
15 |
+
"id": orm.Integer(primary_key=True),
|
16 |
+
"user": orm.ForeignKey(User, on_delete=orm.CASCADE),
|
17 |
+
"post": orm.ForeignKey(Post, on_delete=orm.CASCADE),
|
18 |
+
"createdAt": orm.DateTime(index=True, default=datetime.datetime.now)
|
19 |
+
}
|
20 |
+
|
App/PostLikes/PostLikesRoutes.py
ADDED
@@ -0,0 +1,41 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
from fastapi import APIRouter, Depends
|
2 |
+
from .Schemas import addLike,deleteLike
|
3 |
+
from .Model import PostLike
|
4 |
+
from App.Users.Model import User
|
5 |
+
from App.Post.Model import Post
|
6 |
+
from App.utils import get_user_and_post
|
7 |
+
import asyncio
|
8 |
+
postLike_router = APIRouter(tags=["PostLikes"])
|
9 |
+
|
10 |
+
|
11 |
+
|
12 |
+
|
13 |
+
@postLike_router.post("/postLike/add")
|
14 |
+
async def add_postLike(post: addLike):
|
15 |
+
user,_post=await get_user_and_post(post) #validate if both the post and user exist
|
16 |
+
previos =await PostLike.objects.filter(user=user).filter(post=_post).first()
|
17 |
+
if previos:
|
18 |
+
return {"code": 400, "message": "you already liked it", "payload": None}
|
19 |
+
|
20 |
+
data=await PostLike.objects.create(post=_post,user=user)
|
21 |
+
return {"code": 200, "message": "success", "payload": data.__dict__}
|
22 |
+
|
23 |
+
@postLike_router.post("/postLike/delete")
|
24 |
+
async def create_post(post: deleteLike):
|
25 |
+
user,_post=await get_user_and_post(post)
|
26 |
+
data=await PostLike.objects.filter(id=post.id).first()
|
27 |
+
if not data:
|
28 |
+
return {"code": 400, "message": "Does not exist", "payload": None}
|
29 |
+
if user.id == data.user.id and _post.id == data.post.id:
|
30 |
+
await data.delete()
|
31 |
+
return {"code": 200, "message": "success", "payload": None}
|
32 |
+
|
33 |
+
|
34 |
+
@postLike_router.post("/postLike/get")
|
35 |
+
async def create_post(post: deleteLike):
|
36 |
+
user,_post=await get_user_and_post(post)
|
37 |
+
data=await PostLike.objects.filter(id=post.id).first()
|
38 |
+
if not data:
|
39 |
+
return {"code": 400, "message": "Does not exist", "payload": None}
|
40 |
+
if user.id == data.user.id and _post.id == data.post.user.id:
|
41 |
+
return {"code": 200, "message": "success", "payload": data.__dict__}
|
App/PostLikes/Schemas.py
ADDED
@@ -0,0 +1,16 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
from typing import List, Optional
|
2 |
+
from pydantic import EmailStr, BaseModel
|
3 |
+
from datetime import date, datetime, time, timedelta
|
4 |
+
|
5 |
+
|
6 |
+
class addLike (BaseModel):
|
7 |
+
postId:int
|
8 |
+
userId:int
|
9 |
+
|
10 |
+
class deleteLike (BaseModel):
|
11 |
+
id:int
|
12 |
+
postId:int
|
13 |
+
userId:int
|
14 |
+
|
15 |
+
|
16 |
+
|
App/PostLikes/__pycache__/Model.cpython-38.pyc
ADDED
Binary file (808 Bytes). View file
|
|
App/PostLikes/__pycache__/PostLikesRoutes.cpython-38.pyc
ADDED
Binary file (1.59 kB). View file
|
|
App/PostLikes/__pycache__/Schemas.cpython-38.pyc
ADDED
Binary file (714 Bytes). View file
|
|
App/Settings.py
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
class Settings:
|
2 |
+
ALGORITHM = "HS256"
|
3 |
+
HASH="86c5ceb27e1bf441130299c0209e5f35b88089f62c06b2b09d65772274f12057"
|
App/Users/Model.py
ADDED
@@ -0,0 +1,28 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import asyncio
|
2 |
+
import orm
|
3 |
+
import psycopg2
|
4 |
+
import datetime
|
5 |
+
import pydantic
|
6 |
+
from passlib.context import CryptContext
|
7 |
+
from App.modelInit import database, models
|
8 |
+
|
9 |
+
pwd_context = CryptContext(schemes=["bcrypt"], deprecated="auto")
|
10 |
+
|
11 |
+
|
12 |
+
class User(orm.Model):
|
13 |
+
tablename = "users"
|
14 |
+
registry = models
|
15 |
+
fields = {
|
16 |
+
"id": orm.Integer(primary_key=True),
|
17 |
+
"name": orm.String(max_length=100, index=True),
|
18 |
+
"email": orm.String(max_length=100, index=True, unique=True),
|
19 |
+
"password": orm.String(max_length=100, index=True),
|
20 |
+
"phoneNumber": orm.String(max_length=100, index=True, allow_null=True),
|
21 |
+
"account_type": orm.Integer(index=True, default=1),
|
22 |
+
"createdAt": orm.DateTime(index=True, default=datetime.datetime.now),
|
23 |
+
"updatedAt": orm.DateTime(index=True, default=datetime.datetime.now),
|
24 |
+
"lastLogin": orm.DateTime(index=True, default=datetime.datetime.now),
|
25 |
+
}
|
26 |
+
|
27 |
+
def verify_password(self, plain_password):
|
28 |
+
return pwd_context.verify(plain_password, self.password)
|
App/Users/Schemas.py
ADDED
@@ -0,0 +1,15 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
from typing import List, Optional
|
2 |
+
from pydantic import EmailStr, BaseModel
|
3 |
+
from passlib.context import CryptContext
|
4 |
+
|
5 |
+
pwd_context = CryptContext(schemes=["bcrypt"], deprecated="auto")
|
6 |
+
|
7 |
+
|
8 |
+
class BaseRequest(BaseModel):
|
9 |
+
email: EmailStr
|
10 |
+
name: str
|
11 |
+
password: str
|
12 |
+
phoneNumber: Optional[str]
|
13 |
+
|
14 |
+
def hash_password(self):
|
15 |
+
self.password = pwd_context.hash(self.password)
|
App/Users/UserRoutes.py
ADDED
@@ -0,0 +1,27 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
from fastapi import APIRouter, status
|
2 |
+
from .Schemas import BaseRequest
|
3 |
+
from .Model import User
|
4 |
+
from sqlalchemy import and_
|
5 |
+
from fastapi.security import OAuth2PasswordBearer,OAuth2PasswordRequestForm
|
6 |
+
|
7 |
+
oauth_scheme=OAuth2PasswordBearer(tokenUrl='/user/login')
|
8 |
+
user_router = APIRouter(tags=["User"])
|
9 |
+
|
10 |
+
|
11 |
+
@user_router.post("/user/register")
|
12 |
+
async def register_user(user: BaseRequest):
|
13 |
+
data = await User.objects.filter(email=user.email).first()
|
14 |
+
if data != None:
|
15 |
+
return {"code": 400, "message": "user exists", "payload": None}
|
16 |
+
else:
|
17 |
+
user.hash_password()
|
18 |
+
sample = await User.objects.create(**user.dict())
|
19 |
+
return {"code": 200, "message": "success", "payload": None}
|
20 |
+
|
21 |
+
|
22 |
+
@user_router.post("/user/login")
|
23 |
+
async def register_user(user: BaseRequest):
|
24 |
+
db_user = await User.objects.filter(email=user.email).first()
|
25 |
+
if db_user.verify_password(user.password):
|
26 |
+
return {"code": 200, "message": "success", "payload": db_user.__dict__}
|
27 |
+
return {"code": 401, "message": "Invalid Credentials", "payload": None}
|
App/Users/__pycache__/Model.cpython-38.pyc
ADDED
Binary file (1.17 kB). View file
|
|
App/Users/__pycache__/Schemas.cpython-38.pyc
ADDED
Binary file (795 Bytes). View file
|
|
App/Users/__pycache__/UserRoutes.cpython-38.pyc
ADDED
Binary file (1.18 kB). View file
|
|
App/__init__.py
ADDED
File without changes
|
App/__pycache__/__init__.cpython-38.pyc
ADDED
Binary file (125 Bytes). View file
|
|
App/__pycache__/app.cpython-38.pyc
ADDED
Binary file (1.05 kB). View file
|
|
App/__pycache__/modelInit.cpython-38.pyc
ADDED
Binary file (359 Bytes). View file
|
|
App/__pycache__/utils.cpython-38.pyc
ADDED
Binary file (596 Bytes). View file
|
|
App/app.py
ADDED
@@ -0,0 +1,36 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
from fastapi import FastAPI
|
2 |
+
from .Users.UserRoutes import user_router
|
3 |
+
from .Post.PostRoutes import post_router
|
4 |
+
from .PostLikes.PostLikesRoutes import postLike_router
|
5 |
+
from .Comments.CommentRoutes import comment_router
|
6 |
+
from .modelInit import models, database
|
7 |
+
|
8 |
+
app = FastAPI()
|
9 |
+
|
10 |
+
|
11 |
+
@app.on_event("startup")
|
12 |
+
async def startup_event():
|
13 |
+
await models.create_all()
|
14 |
+
if not database.is_connected:
|
15 |
+
await database.connect()
|
16 |
+
print("connected!")
|
17 |
+
|
18 |
+
|
19 |
+
@app.get("/")
|
20 |
+
async def landing_page():
|
21 |
+
return {"code": 200, "message": "still running"}
|
22 |
+
|
23 |
+
|
24 |
+
app.include_router(user_router)
|
25 |
+
app.include_router(comment_router)
|
26 |
+
app.include_router(post_router)
|
27 |
+
app.include_router(postLike_router)
|
28 |
+
|
29 |
+
|
30 |
+
async def main():
|
31 |
+
pass
|
32 |
+
|
33 |
+
|
34 |
+
# if __name__ == "__main__":
|
35 |
+
# main()
|
36 |
+
# uvicorn.run(app, host="0.0.0.0", port=8000)
|
App/modelInit.py
ADDED
@@ -0,0 +1,9 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import databases
|
2 |
+
import orm
|
3 |
+
import psycopg2
|
4 |
+
|
5 |
+
database = databases.Database(
|
6 |
+
"postgresql+asyncpg://postgres:[email protected]:5432/postgres"
|
7 |
+
)
|
8 |
+
# databases = databases.Database(**args)
|
9 |
+
models = orm.ModelRegistry(database=database)
|
App/utils.py
ADDED
@@ -0,0 +1,14 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
from App.Users.Model import User
|
2 |
+
from App.Post.Model import Post
|
3 |
+
import asyncio
|
4 |
+
from fastapi import HTTPException
|
5 |
+
|
6 |
+
async def get_user_and_post(content):
|
7 |
+
try:
|
8 |
+
# user = None
|
9 |
+
# post = await Post.objects.get(id=content.postId)
|
10 |
+
# print(post.id)
|
11 |
+
user,post = await asyncio.gather(*[User.objects.get(id=content.userId), Post.objects.get(id=content.postId)])
|
12 |
+
except:
|
13 |
+
raise HTTPException(status_code=400, detail="Invalid data")
|
14 |
+
return user,post
|
LICENSE
DELETED
@@ -1,24 +0,0 @@
|
|
1 |
-
This is free and unencumbered software released into the public domain.
|
2 |
-
|
3 |
-
Anyone is free to copy, modify, publish, use, compile, sell, or
|
4 |
-
distribute this software, either in source code form or as a compiled
|
5 |
-
binary, for any purpose, commercial or non-commercial, and by any
|
6 |
-
means.
|
7 |
-
|
8 |
-
In jurisdictions that recognize copyright laws, the author or authors
|
9 |
-
of this software dedicate any and all copyright interest in the
|
10 |
-
software to the public domain. We make this dedication for the benefit
|
11 |
-
of the public at large and to the detriment of our heirs and
|
12 |
-
successors. We intend this dedication to be an overt act of
|
13 |
-
relinquishment in perpetuity of all present and future rights to this
|
14 |
-
software under copyright law.
|
15 |
-
|
16 |
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
17 |
-
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
18 |
-
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
19 |
-
IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR
|
20 |
-
OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
|
21 |
-
ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
|
22 |
-
OTHER DEALINGS IN THE SOFTWARE.
|
23 |
-
|
24 |
-
For more information, please refer to <https://unlicense.org>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
README.md
DELETED
@@ -1,156 +0,0 @@
|
|
1 |
-
<div align="center">
|
2 |
-
<img src="https://socialify.git.ci/acheong08/EdgeGPT/image?font=Inter&language=1&logo=https%3A%2F%2Fupload.wikimedia.org%2Fwikipedia%2Fcommons%2F9%2F9c%2FBing_Fluent_Logo.svg&owner=1&pattern=Floating%20Cogs&theme=Auto" alt="EdgeGPT" width="640" height="320" />
|
3 |
-
|
4 |
-
# Edge GPT
|
5 |
-
|
6 |
-
*The reverse engineering the chat feature of the new version of Bing*
|
7 |
-
|
8 |
-
</div>
|
9 |
-
|
10 |
-
<p align="center">
|
11 |
-
<a href="https://github.com/acheong08/EdgeGPT">
|
12 |
-
<img alt="PyPI version" src="https://img.shields.io/pypi/v/EdgeGPT">
|
13 |
-
</a>
|
14 |
-
<img alt="Python version" src="https://img.shields.io/badge/python-3.8+-blue.svg">
|
15 |
-
</p>
|
16 |
-
|
17 |
-
---
|
18 |
-
|
19 |
-
## Table of Contents
|
20 |
-
- [Edge GPT](#edge-gpt)
|
21 |
-
- [Table of Contents](#table-of-contents)
|
22 |
-
- [Setup](#setup)
|
23 |
-
- [Install package](#install-package)
|
24 |
-
- [Requirements](#requirements)
|
25 |
-
- [Checking access (Required)](#checking-access-required)
|
26 |
-
- [Getting authentication (Required)](#getting-authentication-required)
|
27 |
-
- [Usage](#usage)
|
28 |
-
- [Quick start](#quick-start)
|
29 |
-
- [Developer demo](#developer-demo)
|
30 |
-
- [Work in progress](#work-in-progress)
|
31 |
-
- [Star History](#star-history)
|
32 |
-
- [Contributors](#contributors)
|
33 |
-
|
34 |
-
## Setup
|
35 |
-
|
36 |
-
### Install package
|
37 |
-
```bash
|
38 |
-
python3 -m pip install EdgeGPT --upgrade
|
39 |
-
```
|
40 |
-
|
41 |
-
### Requirements
|
42 |
-
- python 3.8+
|
43 |
-
- A Microsoft Account with early access to http://bing.com/chat (Required)
|
44 |
-
|
45 |
-
|
46 |
-
<details>
|
47 |
-
<summary>
|
48 |
-
|
49 |
-
### Checking access (Required)
|
50 |
-
|
51 |
-
</summary>
|
52 |
-
|
53 |
-
- Install the latest version of Microsoft Edge
|
54 |
-
- Open http://bing.com/chat
|
55 |
-
- If you see a chat feature, you are good to go
|
56 |
-
|
57 |
-
</details>
|
58 |
-
|
59 |
-
|
60 |
-
<details>
|
61 |
-
<summary>
|
62 |
-
|
63 |
-
### Getting authentication (Required)
|
64 |
-
|
65 |
-
</summary>
|
66 |
-
|
67 |
-
- Install the cookie editor extension for [Chrome](https://chrome.google.com/webstore/detail/cookie-editor/hlkenndednhfkekhgcdicdfddnkalmdm) or [Firefox](https://addons.mozilla.org/en-US/firefox/addon/cookie-editor/)
|
68 |
-
- Go to `bing.com`
|
69 |
-
- Open the extension
|
70 |
-
- Click "Export" on the bottom right (This saves your cookies to clipboard)
|
71 |
-
- Paste your cookies into a file `cookies.json`
|
72 |
-
|
73 |
-
</details>
|
74 |
-
|
75 |
-
|
76 |
-
|
77 |
-
## Usage
|
78 |
-
|
79 |
-
### Quick start
|
80 |
-
|
81 |
-
```
|
82 |
-
$ python3 -m EdgeGPT -h
|
83 |
-
|
84 |
-
EdgeGPT - A demo of reverse engineering the Bing GPT chatbot
|
85 |
-
Repo: github.com/acheong08/EdgeGPT
|
86 |
-
By: Antonio Cheong
|
87 |
-
|
88 |
-
!help for help
|
89 |
-
|
90 |
-
Type !exit to exit
|
91 |
-
Enter twice to send message or set --enter-once to send one line message
|
92 |
-
|
93 |
-
usage: EdgeGPT.py [-h] [--enter-once] [--no-stream] [--style {creative,balanced,precise}] --cookie-file COOKIE_FILE
|
94 |
-
|
95 |
-
options:
|
96 |
-
-h, --help show this help message and exit
|
97 |
-
--enter-once
|
98 |
-
--no-stream
|
99 |
-
--style {creative,balanced,precise}
|
100 |
-
--cookie-file COOKIE_FILE
|
101 |
-
```
|
102 |
-
|
103 |
-
-----
|
104 |
-
|
105 |
-
### Developer demo
|
106 |
-
|
107 |
-
Three ways to pass in cookies:
|
108 |
-
|
109 |
-
- Environment variable: `export COOKIE_FILE=/path/to/cookies.json`.
|
110 |
-
- Specify the path to `cookies.json` in the argument `cookiePath` like this:
|
111 |
-
|
112 |
-
```python
|
113 |
-
bot = Chatbot(cookiePath='./cookie.json')
|
114 |
-
```
|
115 |
-
|
116 |
-
- Pass in the cookies directly by the argument `cookies`, like this:
|
117 |
-
|
118 |
-
```python
|
119 |
-
with open('./cookie.json', 'r') as f:
|
120 |
-
cookies = json.load(f)
|
121 |
-
bot = Chatbot(cookies=cookies)
|
122 |
-
```
|
123 |
-
|
124 |
-
|
125 |
-
Use Async for the best experience
|
126 |
-
|
127 |
-
Reference code for more advanced example of usage:
|
128 |
-
|
129 |
-
```python
|
130 |
-
import asyncio
|
131 |
-
from EdgeGPT import Chatbot, ConversationStyle
|
132 |
-
|
133 |
-
async def main():
|
134 |
-
bot = Chatbot()
|
135 |
-
print(await bot.ask(prompt="Hello world", conversation_style=ConversationStyle.creative))
|
136 |
-
await bot.close()
|
137 |
-
|
138 |
-
|
139 |
-
if __name__ == "__main__":
|
140 |
-
asyncio.run(main())
|
141 |
-
|
142 |
-
```
|
143 |
-
|
144 |
-
## Work in progress
|
145 |
-
- Error handling
|
146 |
-
|
147 |
-
## Star History
|
148 |
-
[](https://star-history.com/#acheong08/EdgeGPT&Date)
|
149 |
-
|
150 |
-
|
151 |
-
## Contributors
|
152 |
-
This project exists thanks to all the people who contribute.
|
153 |
-
|
154 |
-
<a href="https://github.com/acheong08/EdgeGPT/graphs/contributors">
|
155 |
-
<img src="https://contrib.rocks/image?repo=acheong08/EdgeGPT" />
|
156 |
-
</a>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
__pycache__/app.cpython-38.pyc
ADDED
Binary file (414 Bytes). View file
|
|
data.txt
ADDED
@@ -0,0 +1 @@
|
|
|
|
|
1 |
+
|
example.env
DELETED
@@ -1 +0,0 @@
|
|
1 |
-
export BING_U="<COOKIE_VALUE>"
|
|
|
|
requirements.txt
CHANGED
@@ -1,4 +1,16 @@
|
|
1 |
-
|
2 |
-
|
3 |
-
|
4 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
asyncpg==0.27.0
|
2 |
+
click==8.1.3
|
3 |
+
databases==0.7.0
|
4 |
+
fastapi==0.92.0
|
5 |
+
Flask==2.2.2
|
6 |
+
greenlet==2.0.2
|
7 |
+
itsdangerous==2.1.2
|
8 |
+
orm==0.3.1
|
9 |
+
psycopg2-binary==2.9.5
|
10 |
+
SQLAlchemy==1.4.46
|
11 |
+
starlette==0.25.0
|
12 |
+
typesystem==0.3.1
|
13 |
+
Werkzeug==2.2.2
|
14 |
+
passlib # for password hashing
|
15 |
+
pydantic[email]
|
16 |
+
python-multipart
|
setup.cfg
DELETED
@@ -1,3 +0,0 @@
|
|
1 |
-
[metadata]
|
2 |
-
description_file=README.md
|
3 |
-
license_files=LICENSE
|
|
|
|
|
|
|
|
setup.py
DELETED
@@ -1,35 +0,0 @@
|
|
1 |
-
from setuptools import find_packages
|
2 |
-
from setuptools import setup
|
3 |
-
|
4 |
-
setup(
|
5 |
-
name="EdgeGPT",
|
6 |
-
version="0.0.60",
|
7 |
-
license="GNU General Public License v2.0",
|
8 |
-
author="Antonio Cheong",
|
9 |
-
author_email="[email protected]",
|
10 |
-
description="Reverse engineered Edge Chat API",
|
11 |
-
packages=find_packages("src"),
|
12 |
-
package_dir={"": "src"},
|
13 |
-
url="https://github.com/acheong08/EdgeGPT",
|
14 |
-
project_urls={"Bug Report": "https://github.com/acheong08/EdgeGPT/issues/new"},
|
15 |
-
install_requires=[
|
16 |
-
"asyncio",
|
17 |
-
"httpx",
|
18 |
-
"websockets",
|
19 |
-
"rich",
|
20 |
-
"certifi",
|
21 |
-
"prompt_toolkit",
|
22 |
-
],
|
23 |
-
long_description=open("README.md", encoding="utf-8").read(),
|
24 |
-
long_description_content_type="text/markdown",
|
25 |
-
py_modules=["EdgeGPT"],
|
26 |
-
classifiers=[
|
27 |
-
"License :: OSI Approved :: GNU General Public License v2 (GPLv2)",
|
28 |
-
"Intended Audience :: Developers",
|
29 |
-
"Topic :: Software Development :: Libraries :: Python Modules",
|
30 |
-
"Programming Language :: Python :: 3.8",
|
31 |
-
"Programming Language :: Python :: 3.9",
|
32 |
-
"Programming Language :: Python :: 3.10",
|
33 |
-
"Programming Language :: Python :: 3.11",
|
34 |
-
],
|
35 |
-
)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|