feat(api): 新增素材检索 API 服务(图标/海报检索 + SVG 直链 + Key 鉴权 + 中文语义检索)
This commit is contained in:
@@ -0,0 +1,34 @@
|
||||
[Unit]
|
||||
Description=画个标 Gitea Webhook 自动部署
|
||||
After=network.target
|
||||
|
||||
[Service]
|
||||
Type=simple
|
||||
User=ubuntu
|
||||
ExecStart=/usr/bin/python3 -c "
|
||||
import http.server, subprocess, json
|
||||
class H(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', '/opt/drawlogo/deploy/deploy.sh'],
|
||||
stdout=open('/opt/drawlogo/.deploy.log', 'a'),
|
||||
stderr=subprocess.STDOUT)
|
||||
except Exception as e:
|
||||
pass
|
||||
self.send_response(200)
|
||||
self.end_headers()
|
||||
self.wfile.write(b'ok')
|
||||
def log_message(self, format, *args):
|
||||
pass
|
||||
http.server.HTTPServer(('127.0.0.1', 7890), H).serve_forever()
|
||||
"
|
||||
Restart=always
|
||||
RestartSec=5
|
||||
|
||||
[Install]
|
||||
WantedBy=multi-user.target
|
||||
Reference in New Issue
Block a user