Restore verified programmer archive with search, provenance and legacy URLs
Build and deploy / deploy (push) Successful in 1m5s

This commit is contained in:
huncode committed 2026-10-26 14:23:01 +03:00
1 parent 089b949f4d
commit 681502465a
82 files changed
+8142 -5566

No files matched your search

+7
View File
@@ -0,0 +1,7 @@
import http.server,os,json,functools
from pathlib import Path
r=Path(__file__).resolve().parents[1]
handler=functools.partial(http.server.SimpleHTTPRequestHandler,directory=str(r/'web/out'))
s=http.server.ThreadingHTTPServer(('127.0.0.1',0),handler)
(r/'.local-service.json').write_text(json.dumps(dict(pid=os.getpid(),port=s.server_port,url='http://127.0.0.1:'+str(s.server_port)),indent=2))
s.serve_forever()
+26
View File
@@ -0,0 +1,26 @@
import json,sys,urllib.request,urllib.parse,concurrent.futures
from pathlib import Path
from html.parser import HTMLParser
r=Path(__file__).resolve().parents[1]; base=sys.argv[1].rstrip('/')
articles=json.loads((r/'web/data/articles.json').read_text())
paths=['/','/about/','/tools/']+['/articles/'+urllib.parse.quote(a['slug'])+'/' for a in articles]+[urllib.parse.quote(a['legacyPath']) for a in articles]
class Links(HTMLParser):
def __init__(self):super().__init__();self.links=set()
def handle_starttag(self,t,attrs):
a=dict(attrs)
for k in ['href','src']:
v=a.get(k,'')
if v.startswith('/') and not v.startswith('//'):self.links.add(v.split('#')[0])
assets=set(); results=[]
for path in paths:
with urllib.request.urlopen(base+path,timeout=20) as response:
assert response.status==200,path
text=response.read().decode(); assert 'ProgCode' in text,path
assert 'mc.yandex.ru' not in text and 'googletagmanager' not in text,path
p=Links();p.feed(text);assets.update(p.links);results.append(dict(path=path,status=200))
for path in sorted(assets):
u=urllib.parse.quote(urllib.parse.unquote(path),safe='/:?=&%')
with urllib.request.urlopen(base+u,timeout=20) as response:assert response.status==200,path
try:urllib.request.urlopen(base+'/does-not-exist-progcode-test/',timeout=20);raise AssertionError('404 route returned success')
except urllib.error.HTTPError as e:assert e.code==404
print(json.dumps(dict(base=base,pages=len(results),internalLinksAndAssets=len(assets),missingRoute=404,results=results),ensure_ascii=False,indent=2))
+9
View File
@@ -5,6 +5,15 @@ services:
- traefik-public
deploy:
replicas: 1
update_config:
order: start-first
parallelism: 1
failure_action: rollback
monitor: 30s
rollback_config:
order: start-first
restart_policy:
condition: on-failure
labels:
- traefik.enable=true
- traefik.docker.network=${TRAEFIK_NETWORK:-traefik-public}