feat: upload
No files matched your search
@@ -0,0 +1 @@
|
||||
/.idea/
|
||||
@@ -8,3 +8,9 @@
|
||||
|
||||
# 计数器
|
||||
灵感: https://github.com/journey-ad/Moe-counter
|
||||
|
||||

|
||||
|
||||

|
||||
|
||||
|
||||
@@ -13,6 +13,7 @@ from flask import Response
|
||||
from flask import make_response
|
||||
from flask import render_template
|
||||
from flask import send_from_directory
|
||||
from bin.b64img import re_sort_number_image
|
||||
|
||||
app = Flask(__name__)
|
||||
|
||||
@@ -59,18 +60,19 @@ def build_page(name: str) -> str:
|
||||
if len(str(count)) <= 10:
|
||||
zero_counter = 10 - len(str(count))
|
||||
final_number = '0' * zero_counter + str(count)
|
||||
sorted_image = re_sort_number_image(final_number)
|
||||
return render_template('index.html',
|
||||
owner=name,
|
||||
b64_0=f'./static/number/{final_number[0]}.svg',
|
||||
b64_1=f'./static/number/{final_number[1]}.svg',
|
||||
b64_2=f'./static/number/{final_number[2]}.svg',
|
||||
b64_3=f'./static/number/{final_number[3]}.svg',
|
||||
b64_4=f'./static/number/{final_number[4]}.svg',
|
||||
b64_5=f'./static/number/{final_number[5]}.svg',
|
||||
b64_6=f'./static/number/{final_number[6]}.svg',
|
||||
b64_7=f'./static/number/{final_number[7]}.svg',
|
||||
b64_8=f'./static/number/{final_number[8]}.svg',
|
||||
b64_9=f'./static/number/{final_number[9]}.svg'
|
||||
title=name,
|
||||
svg_img_0=f'{sorted_image[0]}',
|
||||
svg_img_1=f'{sorted_image[1]}',
|
||||
svg_img_2=f'{sorted_image[2]}',
|
||||
svg_img_3=f'{sorted_image[3]}',
|
||||
svg_img_4=f'{sorted_image[4]}',
|
||||
svg_img_5=f'{sorted_image[5]}',
|
||||
svg_img_6=f'{sorted_image[6]}',
|
||||
svg_img_7=f'{sorted_image[7]}',
|
||||
svg_img_8=f'{sorted_image[8]}',
|
||||
svg_img_9=f'{sorted_image[9]}'
|
||||
)
|
||||
|
||||
|
||||
@@ -84,40 +86,34 @@ def arg_not_be_full() -> Response:
|
||||
return response
|
||||
|
||||
|
||||
@app.route('/API', methods=['GET'])
|
||||
@app.route('/API', methods=['GET', 'POST'])
|
||||
def api_page() -> Response or str:
|
||||
"""
|
||||
API页面主函数
|
||||
:return:
|
||||
"""
|
||||
if request.method == 'GET':
|
||||
if 'owner' in request.args.keys():
|
||||
owner = request.args['owner']
|
||||
if owner != '':
|
||||
html_template = build_page(owner)
|
||||
response = make_response(html_template)
|
||||
response.headers['Content-Type'] = 'image/svg+xml; charset=utf-8'
|
||||
return response
|
||||
else:
|
||||
return arg_not_be_full()
|
||||
if 'owner' in request.args.keys():
|
||||
owner = request.args['owner']
|
||||
if owner != '':
|
||||
html_template = build_page(owner)
|
||||
response = make_response(html_template)
|
||||
response.headers['Content-Type'] = 'image/svg+xml'
|
||||
# response.headers['Content-Type'] = 'text/html'
|
||||
return response
|
||||
else:
|
||||
arg_not_be_full()
|
||||
|
||||
return arg_not_be_full()
|
||||
else:
|
||||
return 'Method Not Allowed'
|
||||
arg_not_be_full()
|
||||
|
||||
|
||||
@app.route('/', methods=['GET'])
|
||||
@app.route('/', methods=['GET', 'POST'])
|
||||
def index():
|
||||
"""
|
||||
索引页面
|
||||
:return:
|
||||
"""
|
||||
if request.method == 'GET':
|
||||
return send_from_directory('./static', 'index.html')
|
||||
else:
|
||||
return 'Method Not Allowed'
|
||||
return send_from_directory('./static', 'index.html')
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
app.run(host='0.0.0.0', port=5000)
|
||||
app.run(host='0.0.0.0', port=5000, threaded=True)
|
||||
@@ -16,7 +16,7 @@ def convert() -> None:
|
||||
# image转base64
|
||||
lst = []
|
||||
for i in range(10):
|
||||
with open(f'../../static/number/{i}.png', 'rb') as f:
|
||||
with open(f'../../static/theme/t2/{i}.svg', 'rb') as f:
|
||||
base64_data = base64.b64encode(f.read())
|
||||
base64_code = 'data:image/jpeg;base64,' + base64_data.decode('utf-8')
|
||||
lst.append(base64_code)
|
||||
|
||||
@@ -8,7 +8,27 @@
|
||||
import requests
|
||||
import random
|
||||
|
||||
name_str = random.sample(range(1, 100), 30)
|
||||
for i in name_str:
|
||||
resp = requests.get(f'http://127.0.0.1:8000/API?owner={i}')
|
||||
print(resp.content)
|
||||
|
||||
def request_test() -> None:
|
||||
"""
|
||||
请求测试
|
||||
:return:
|
||||
"""
|
||||
name_str = random.sample(range(1, 100), 30)
|
||||
for i in name_str:
|
||||
resp = requests.get(f'http://127.0.0.1:8000/API?owner={i}')
|
||||
print(resp.content)
|
||||
|
||||
|
||||
def download_test() -> None:
|
||||
"""
|
||||
下载测试
|
||||
:return:
|
||||
"""
|
||||
|
||||
resp = requests.get('https://count.getloli.com/get/@Moe-counter.github')
|
||||
with open('download_test.html', 'wb') as fp:
|
||||
fp.write(resp.content)
|
||||
|
||||
|
||||
download_test()
|
||||
@@ -1 +0,0 @@
|
||||
{"MarkusJoe": 212, "MarkusJo": 0}
|
||||
@@ -1 +0,0 @@
|
||||
<?xml version="1.0" standalone="no"?><!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"><svg t="1643888476467" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="2031" xmlns:xlink="http://www.w3.org/1999/xlink" width="200" height="200"><defs><style type="text/css"></style></defs><path d="M496.8622 884.1441c-182.4317-2.7197-273.6323-141.568-273.6323-416.5755 2.7197-274.9757 92.5604-416.5601 269.5516-424.7357 176.9595 5.4559 266.8155 147.0403 269.5352 424.7357C759.5981 739.8564 671.102 878.7036 496.8622 884.1441zM488.6866 116.352c-111.6324 8.1756-168.8003 125.2475-171.52 351.2156 0 234.1601 58.5277 349.8721 175.616 347.1524 117.0555 2.7197 175.5996-112.9923 175.5996-347.1524C668.3822 230.7041 608.4782 113.6323 488.6866 116.352z" p-id="2032"></path></svg>
|
||||
|
Before Width: | Height: | Size: 850 B |
@@ -1 +0,0 @@
|
||||
<?xml version="1.0" standalone="no"?><!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"><svg t="1643888489972" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="7099" xmlns:xlink="http://www.w3.org/1999/xlink" width="200" height="200"><defs><style type="text/css"></style></defs><path d="M517.2777 214.3683c-59.904 54.4645-132.0479 98.0163-216.448 130.688l0-85.76c125.2321-57.1843 205.5516-129.3281 240.9595-216.4644l61.247488 0 0 829.056-85.76 0L517.276688 214.368256z" p-id="7100"></path></svg>
|
||||
|
Before Width: | Height: | Size: 585 B |
@@ -1 +0,0 @@
|
||||
<?xml version="1.0" standalone="no"?><!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"><svg t="1643888495431" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="7234" xmlns:xlink="http://www.w3.org/1999/xlink" width="200" height="200"><defs><style type="text/css"></style></defs><path d="M210.9747 863.7276l0-53.103616c51.7284-108.8963 137.4884-206.9115 257.2964-294.0477 122.5114-89.8396 182.4154-171.52 179.6956-245.0401-2.7197-98.0163-58.5441-148.3837-167.4394-151.1035-84.4165 5.4559-141.5844 58.5441-171.5364 159.2801l-81.6804-40.8484C273.5985 105.4556 363.4545 40.1121 496.8622 42.8319c152.4634 5.4559 234.1437 77.6161 245.0391 216.4644 8.1603 106.1765-59.904 208.2724-204.2081 306.2876-111.6314 81.6957-185.1351 157.9203-220.5276 228.7043l428.81536 0 0 69.439488L210.97472 863.727688z" p-id="7235"></path></svg>
|
||||
|
Before Width: | Height: | Size: 907 B |
@@ -1 +0,0 @@
|
||||
<?xml version="1.0" standalone="no"?><!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"><svg t="1643888498376" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="7369" xmlns:xlink="http://www.w3.org/1999/xlink" width="200" height="200"><defs><style type="text/css"></style></defs><path d="M758.2382 647.2643c-8.1756 149.76-98.0316 228.7043-269.5516 236.8799-152.4797 0-245.0401-72.1439-277.7119-216.448l93.9356-24.5125c16.3359 111.6324 74.88 167.4404 175.616 167.4404 122.5114 0 183.7752-57.1679 183.7752-171.52-8.1756-98.0163-70.8004-149.7436-187.8559-155.1995-38.1276 0-62.6401 0-73.5201 0l0-73.503744c10.88 0 24.4961 0 40.8484 0 117.0555-2.7197 178.3194-54.4481 183.7752-155.1995-5.4559-87.1199-51.7437-132.0479-138.8636-134.7676-92.5757 2.7197-148.3837 54.4645-167.4404 155.1995l-89.8396-28.5921C264.0783 113.6323 348.4785 45.568 484.607 42.8319c155.1831 5.4559 235.5036 76.2399 240.9595 212.3684-2.7197 89.856-49.0076 151.1199-138.8636 183.7916C695.5981 471.6636 752.7823 541.0877 758.2382 647.2643z" p-id="7370"></path></svg>
|
||||
|
Before Width: | Height: | Size: 1.1 KiB |
@@ -1 +0,0 @@
|
||||
<?xml version="1.0" standalone="no"?><!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"><svg t="1643888501095" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="7504" xmlns:xlink="http://www.w3.org/1999/xlink" width="200" height="200"><defs><style type="text/css"></style></defs><path d="M762.3178 671.7757 647.965696 671.7757l0 200.112128-81.680384 0L566.285312 671.775744 190.558208 671.775744l0-49.007616L582.6222 42.8319l65.343488 0 0 555.423744 114.352128 0L762.317816 671.775744zM288.5745 598.2556l277.711872 0L566.286372 177.615872c0 2.7197-2.7197 8.1756-8.1603 16.3359-2.7361 8.1603-5.4559 14.976-8.1756 20.4165C506.3823 271.5525 419.2625 399.5044 288.5745 598.2556z" p-id="7505"></path></svg>
|
||||
|
Before Width: | Height: | Size: 790 B |
@@ -1 +0,0 @@
|
||||
<?xml version="1.0" standalone="no"?><!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"><svg t="1643888506201" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="7639" xmlns:xlink="http://www.w3.org/1999/xlink" width="200" height="200"><defs><style type="text/css"></style></defs><path d="M509.1185 328.7204C667.0223 336.896 751.4225 426.7356 762.3178 598.2556c-5.4395 185.1515-93.9356 280.448-265.4556 285.8885-155.1995 0-247.7599-73.5037-277.7119-220.544l89.8396-24.4961c16.3359 114.3521 76.2399 172.8963 179.6956 175.616 117.0719-5.4395 178.3357-74.88 183.7916-208.2877-5.4559-125.2475-65.3599-190.592-179.6956-196.0325-84.4165 2.7197-144.3041 32.6717-179.6956 89.8396l-61.2639-12.2399L300.8307 59.1677l420.655104 0 0 81.680384-351.232 0-24.4961 249.1361C394.751 349.1523 449.2145 328.7204 509.1185 328.7204z" p-id="7640"></path></svg>
|
||||
|
Before Width: | Height: | Size: 926 B |
@@ -1 +0,0 @@
|
||||
<?xml version="1.0" standalone="no"?><!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"><svg t="1643888509036" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="7774" xmlns:xlink="http://www.w3.org/1999/xlink" width="200" height="200"><defs><style type="text/css"></style></defs><path d="M745.982 226.6235l-81.6804 28.5757c-21.7917-95.2801-73.5201-141.568-155.1831-138.8483-136.1439 2.7197-204.2081 115.712-204.2081 338.9757 43.5517-73.5037 114.3521-111.6324 212.3674-114.3521 152.4644 8.1603 234.1437 96.6564 245.0401 265.4556-10.8964 171.5364-96.6564 264.0957-257.2954 277.7119-193.3117 0-289.9517-132.0479-289.9517-396.1436 2.7197-296.7675 102.0959-445.1676 298.1274-445.1676C632.9897 48.2877 710.5905 109.5516 745.982 226.6235zM308.991 561.5043c2.7197 166.0805 68.0643 251.8559 196.0325 257.2964 103.4557-5.4395 157.9192-73.5201 163.3597-204.2081-2.7197-130.688-57.1843-197.3924-163.3597-200.1121C398.847 419.9363 333.5025 468.9439 308.991 561.5043z" p-id="7775"></path></svg>
|
||||
|
Before Width: | Height: | Size: 1.0 KiB |
@@ -1 +0,0 @@
|
||||
<?xml version="1.0" standalone="no"?><!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"><svg t="1643888511930" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="7909" xmlns:xlink="http://www.w3.org/1999/xlink" width="200" height="200"><defs><style type="text/css"></style></defs><path d="M439.679 871.8879l-98.016256 0C382.4947 624.128 484.607 380.4477 647.9657 140.8481L227.310592 140.8481 227.310592 59.167744l530.927616 0 0 57.184256C581.2623 361.3921 475.0705 613.2316 439.679 871.8879z" p-id="7910"></path></svg>
|
||||
|
Before Width: | Height: | Size: 606 B |
@@ -1 +0,0 @@
|
||||
<?xml version="1.0" standalone="no"?><!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"><svg t="1643888514352" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="8044" xmlns:xlink="http://www.w3.org/1999/xlink" width="200" height="200"><defs><style type="text/css"></style></defs><path d="M382.5101 447.1521c-81.6957-38.1123-125.2475-99.3597-130.688-183.7763 10.88-138.8483 92.5604-212.3684 245.0401-220.544 147.0075 10.8964 227.328 84.4165 240.9595 220.544-5.4559 87.1363-46.3043 148.3837-122.5277 183.7763 100.736 38.1276 153.8243 111.6477 159.2801 220.544-8.1756 138.8636-100.7524 211.0075-277.7119 216.448-179.712-5.4395-272.2724-80.3041-277.7119-224.6236C227.3106 553.344 281.7741 482.5436 382.5101 447.1521zM492.7826 479.8239c-108.9116 5.4559-168.8156 65.3599-179.6956 179.6956 10.88 98.0163 72.1439 151.1199 183.7763 159.2801 111.616-8.1603 172.8799-58.5277 183.7752-151.1035C672.4618 547.9035 609.8381 485.2797 492.7826 479.8239zM496.8622 116.352c-89.856 5.4395-138.8636 51.7284-147.0239 138.8483 2.7197 100.7524 51.7284 153.8396 147.0239 159.2801 89.8396-2.7197 137.4874-53.0883 142.9432-151.1035C631.6298 173.5363 583.9821 124.5276 496.8622 116.352z" p-id="8045"></path></svg>
|
||||
|
Before Width: | Height: | Size: 1.2 KiB |
@@ -1 +0,0 @@
|
||||
<?xml version="1.0" standalone="no"?><!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"><svg t="1643888516937" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="8179" xmlns:xlink="http://www.w3.org/1999/xlink" width="200" height="200"><defs><style type="text/css"></style></defs><path d="M239.5668 708.5281 325.3268 679.936c19.0556 95.2955 69.4241 141.5844 151.1199 138.8636 127.9519-5.4395 193.2954-118.4317 196.0315-338.9757-40.8484 78.9596-108.9116 118.4317-204.2071 118.4317-152.4797-13.5997-235.52-103.4557-249.1197-269.5363 10.88-176.9595 99.3761-272.256 265.4556-285.8885 190.592-2.7197 284.5112 132.0643 281.7915 404.3203 0 288.6083-99.3761 434.2723-298.1274 436.992C348.4621 878.7036 272.2386 820.1759 239.5668 708.5281zM672.4782 373.6484c0-171.52-65.3435-255.9365-196.0315-253.2157-103.4721 8.1756-159.2955 74.88-167.4557 200.1121 5.4395 125.2475 61.2639 191.9683 167.4557 200.1285C582.6222 520.6723 647.9657 471.6636 672.4782 373.6484z" p-id="8180"></path></svg>
|
||||
|
Before Width: | Height: | Size: 1.0 KiB |
@@ -1,16 +1,16 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<svg width="450" height="100" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
|
||||
<title>{{ owner }}</title>
|
||||
<svg width="450" height="50" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
|
||||
<title>{{ title }}</title>
|
||||
<g>
|
||||
<image x="0" y="0" width="45" height="100" xlink:href="{{ b64_0 }}"></image>
|
||||
<image x="45" y="0" width="45" height="100" xlink:href="{{ b64_1 }}"></image>
|
||||
<image x="90" y="0" width="45" height="100" xlink:href="{{ b64_2 }}"></image>
|
||||
<image x="135" y="0" width="45" height="100" xlink:href="{{ b64_3 }}"></image>
|
||||
<image x="180" y="0" width="45" height="100" xlink:href="{{ b64_4 }}"></image>
|
||||
<image x="225" y="0" width="45" height="100" xlink:href="{{ b64_5 }}"></image>
|
||||
<image x="270" y="0" width="45" height="100" xlink:href="{{ b64_6 }}"></image>
|
||||
<image x="315" y="0" width="45" height="100" xlink:href="{{ b64_7 }}"></image>
|
||||
<image x="360" y="0" width="45" height="100" xlink:href="{{ b64_8 }}"></image>
|
||||
<image x="405" y="0" width="45" height="100" xlink:href="{{ b64_9 }}"></image>
|
||||
<image x="0" y="0" width="45" height="50" xlink:href="{{ svg_img_0 }}"></image>
|
||||
<image x="45" y="0" width="45" height="50" xlink:href="{{ svg_img_1 }}"></image>
|
||||
<image x="90" y="0" width="45" height="50" xlink:href="{{ svg_img_2 }}"></image>
|
||||
<image x="135" y="0" width="45" height="50" xlink:href="{{ svg_img_3 }}"></image>
|
||||
<image x="180" y="0" width="45" height="50" xlink:href="{{ svg_img_4 }}"></image>
|
||||
<image x="225" y="0" width="45" height="50" xlink:href="{{ svg_img_5 }}"></image>
|
||||
<image x="270" y="0" width="45" height="50" xlink:href="{{ svg_img_6 }}"></image>
|
||||
<image x="315" y="0" width="45" height="50" xlink:href="{{ svg_img_7 }}"></image>
|
||||
<image x="360" y="0" width="45" height="50" xlink:href="{{ svg_img_8 }}"></image>
|
||||
<image x="405" y="0" width="45" height="50" xlink:href="{{ svg_img_9 }}"></image>
|
||||
</g>
|
||||
</svg>
|
||||
|
Before Width: | Height: | Size: 1.1 KiB After Width: | Height: | Size: 1.1 KiB |