|
|
|
@ -2,6 +2,7 @@ from flask import Blueprint, request
|
|
|
|
|
from web_utils.get_arg import get_arg |
|
|
|
|
from web_utils.business_exception import BusinessException |
|
|
|
|
import os |
|
|
|
|
import time |
|
|
|
|
|
|
|
|
|
from data.document import Document |
|
|
|
|
|
|
|
|
@ -13,13 +14,18 @@ def build():
|
|
|
|
|
doc_name = get_arg('doc_name') |
|
|
|
|
branch = get_arg('branch', 'master') |
|
|
|
|
apikey = get_arg('apikey') |
|
|
|
|
join = get_arg('join', 'false') |
|
|
|
|
doc = Document(origin, doc_name, branch) |
|
|
|
|
|
|
|
|
|
if doc.get_api_key() != apikey: |
|
|
|
|
raise BusinessException("Invalid API key") |
|
|
|
|
|
|
|
|
|
build_task = doc.build() |
|
|
|
|
|
|
|
|
|
if join == 'true': |
|
|
|
|
build_task.join() |
|
|
|
|
else: |
|
|
|
|
time.sleep(1) |
|
|
|
|
|
|
|
|
|
return build_task.get_output_str().replace('\n', '<br/>\n') |
|
|
|
|
|
|
|
|
|