feat(api): 新增素材检索 API 服务(图标/海报检索 + SVG 直链 + Key 鉴权 + 中文语义检索)
This commit is contained in:
@@ -0,0 +1,30 @@
|
||||
#!/usr/bin/env python3
|
||||
"""画个标 Gitea webhook 监听(push main 时自动部署)"""
|
||||
import http.server, subprocess, json, os, datetime
|
||||
|
||||
DEPLOY_SCRIPT = '/opt/drawlogo/deploy/deploy.sh'
|
||||
|
||||
class Handler(http.server.BaseHTTPRequestHandler):
|
||||
def do_POST(self):
|
||||
length = int(self.headers.get('Content-Length', 0))
|
||||
body = self.rfile.read(length)
|
||||
try:
|
||||
data = json.loads(body) if body else {}
|
||||
ref = data.get('ref', '')
|
||||
if ref == 'refs/heads/main':
|
||||
subprocess.Popen(
|
||||
['/bin/bash', DEPLOY_SCRIPT],
|
||||
stdout=open('/opt/drawlogo/.deploy.log', 'a'),
|
||||
stderr=subprocess.STDOUT
|
||||
)
|
||||
except Exception:
|
||||
pass
|
||||
self.send_response(200)
|
||||
self.end_headers()
|
||||
self.wfile.write(b'ok')
|
||||
|
||||
def log_message(self, format, *args):
|
||||
pass
|
||||
|
||||
if __name__ == '__main__':
|
||||
http.server.HTTPServer(('0.0.0.0', 7890), Handler).serve_forever()
|
||||
Reference in New Issue
Block a user