diff --git a/.idea/.gitignore b/.idea/.gitignore
deleted file mode 100644
index e69de29..0000000
diff --git a/.idea/encodings.xml b/.idea/encodings.xml
deleted file mode 100644
index 15a15b2..0000000
--- a/.idea/encodings.xml
+++ /dev/null
@@ -1,4 +0,0 @@
-
-
-
-
\ No newline at end of file
diff --git a/.idea/inspectionProfiles/Project_Default.xml b/.idea/inspectionProfiles/Project_Default.xml
new file mode 100644
index 0000000..f281ec3
--- /dev/null
+++ b/.idea/inspectionProfiles/Project_Default.xml
@@ -0,0 +1,12 @@
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/workspace.xml b/.idea/workspace.xml
index e5cfbe8..c9062a0 100644
--- a/.idea/workspace.xml
+++ b/.idea/workspace.xml
@@ -2,97 +2,26 @@
-
-
-
+
+
+
+
+
+
+
+
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
@@ -101,6 +30,7 @@
+
@@ -172,19 +102,7 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
+
@@ -215,8 +133,8 @@
-
-
+
+
@@ -235,7 +153,7 @@
-
+
diff --git a/APP/requirements.txt b/APP/requirements.txt
new file mode 100644
index 0000000..9022d7d
--- /dev/null
+++ b/APP/requirements.txt
@@ -0,0 +1,8 @@
+pymongo==3.11.0
+requests==2.24.0
+SQLAlchemy==1.3.22
+Flask==1.1.2
+Flask_Cors==3.0.9
+APP==0.0.1
+beautifulsoup4==4.9.3
+Pillow==8.1.0
diff --git a/APP/server.py b/APP/server.py
index 01c43cb..d38418d 100644
--- a/APP/server.py
+++ b/APP/server.py
@@ -20,5 +20,5 @@ app.register_blueprint(bp_auth)
app.register_blueprint(bp_start)
app.register_blueprint(bp_block)
app.register_blueprint(bp_collection)
-#init_db()
+init_db()
app.run(debug=True)
diff --git a/APP/view/block.py b/APP/view/block.py
index cedb2a4..efb944b 100644
--- a/APP/view/block.py
+++ b/APP/view/block.py
@@ -3,9 +3,10 @@ from bson import json_util
import uuid
import os
import io
-from PIL import Image
from APP.view.database import db_session
from APP.view.model import Block, CollectionBlock
+import requests
+from bs4 import BeautifulSoup
bp_block = Blueprint("block", __name__, url_prefix="/block")
@@ -174,19 +175,18 @@ def edit():
def get_web_name():
url = request.form.get('url')
ret = {'msg': 'succuss'}
- """
+ html = requests.get(url)
+ html.encoding = 'utf-8'
+ soup = BeautifulSoup(html.text, "html.parser")
+ title = soup.find('title').text
+ """
ret['name'] = url对应的网站的title,没有就返回url
- """
+ """
- return json_util.dumps(ret)
+ if title != None:
+ ret['name'] = title
+ else:
+ ret['name'] = url
-@bp_block.route("/get_pic", methods=["POST"])
-def get_pic():
- img = bytes(request.form.get('pic'), encoding = "utf8")
+ return json_util.dumps(ret)
- byte_stream = io.BytesIO(img)
- im2 = Image.open(byte_stream)
- ret = {'msg': 'succuss'}
- im2.save(request.form.get('pic')[20:]+".gif", "GIF")
- ret['url'] = request.form.get('pic')[20:]+".gif"
- return ret
\ No newline at end of file
diff --git a/APP/view/database.py b/APP/view/database.py
index 3d02a1a..2677490 100644
--- a/APP/view/database.py
+++ b/APP/view/database.py
@@ -16,4 +16,3 @@ def init_db():
Base.metadata.drop_all(bind=engine)
Base.metadata.create_all(bind=engine)
-#init_db()