feat: initial Cutdex application
Add the Flutter video editing application with project management, media import, timeline editing, preview, AI assistance, diagnostics and settings. Include shared UI and native host packages, platform runners, application tests and release tooling. Provide usage and contribution guides, the MIT license and third-party notices. Exclude local credentials, build outputs and validation data.
This commit is contained in:
commit
27e77fff39
718 files changed
+183958
No files matched your search
@@ -0,0 +1,84 @@
|
||||
#!/usr/bin/env python3
|
||||
"""Prepare two development apps and serve a signed full update on localhost."""
|
||||
import argparse
|
||||
from functools import partial
|
||||
from http.server import SimpleHTTPRequestHandler, ThreadingHTTPServer
|
||||
import os
|
||||
from pathlib import Path
|
||||
import plistlib
|
||||
import subprocess
|
||||
|
||||
from macos_updates import configure, publish
|
||||
|
||||
|
||||
class UpdateHandler(SimpleHTTPRequestHandler):
|
||||
def end_headers(self):
|
||||
self.send_header('Cache-Control', 'no-store')
|
||||
super().end_headers()
|
||||
|
||||
def list_directory(self, path):
|
||||
self.send_error(404)
|
||||
return None
|
||||
|
||||
|
||||
def prepare(source, root, tools, port):
|
||||
repository = Path(__file__).resolve().parents[2]
|
||||
root = root.resolve()
|
||||
public = root / 'public'
|
||||
keys = root / 'keys'
|
||||
if (root / 'installed').exists() or public.exists():
|
||||
raise ValueError('Use a fresh output directory to preserve existing test installs')
|
||||
subprocess.run(['swift', str(repository / 'tool/macos/sparkle_test_key.swift'), str(keys)], check=True)
|
||||
public_key = (keys / 'public.key').read_text()
|
||||
feed = f'http://localhost:{port}/appcast.xml'
|
||||
info = plistlib.loads((source / 'Contents/Info.plist').read_bytes())
|
||||
if info['CFBundleIdentifier'] != 'app.cutdex.desktop.dev':
|
||||
raise ValueError('Build with --flavor development first')
|
||||
for folder, version in [('installed', '900001'), ('candidate', '900002')]:
|
||||
app = root / folder / 'cutdex.app'
|
||||
app.parent.mkdir(parents=True)
|
||||
subprocess.run(['ditto', str(source), str(app)], check=True)
|
||||
path = app / 'Contents/Info.plist'
|
||||
bundle = plistlib.loads(path.read_bytes())
|
||||
bundle['CFBundleVersion'] = version
|
||||
path.write_bytes(plistlib.dumps(bundle))
|
||||
configure(app, feed, public_key, local=True)
|
||||
subprocess.run(['bash', str(repository / 'tool/macos/sign_macos_app.sh'), str(app)],
|
||||
env={**os.environ, 'CUTDEX_CODESIGN_IDENTITY': '-'}, check=True)
|
||||
publish(root / 'candidate/cutdex.app', public, f'http://localhost:{port}',
|
||||
tools.resolve(), keys / 'private.key', local=True)
|
||||
print(f'Open: {root / "installed/cutdex.app"}', flush=True)
|
||||
print('Settings → Check for updates: 900001 → 900002 (full ZIP)', flush=True)
|
||||
return public
|
||||
|
||||
|
||||
def main():
|
||||
parser = argparse.ArgumentParser(description=__doc__)
|
||||
parser.add_argument('--app', type=Path, help='Built development app')
|
||||
parser.add_argument('--tools', type=Path, help='Sparkle bin directory')
|
||||
parser.add_argument('--output', type=Path, default=Path('.local/update-test'))
|
||||
parser.add_argument('--port', type=int, default=8765)
|
||||
parser.add_argument('--serve-only', action='store_true')
|
||||
args = parser.parse_args()
|
||||
if args.serve_only:
|
||||
public = args.output.resolve() / 'public'
|
||||
else:
|
||||
if not args.app or not args.tools:
|
||||
parser.error('--app and --tools are required unless --serve-only')
|
||||
public = prepare(args.app, args.output, args.tools, args.port)
|
||||
if not (public / 'appcast.xml').is_file():
|
||||
parser.error('No prepared appcast.xml')
|
||||
# Only public artifacts are served. Private keys live outside this root.
|
||||
server = ThreadingHTTPServer(('127.0.0.1', args.port),
|
||||
partial(UpdateHandler, directory=str(public)))
|
||||
print(f'Serving http://localhost:{args.port}/appcast.xml', flush=True)
|
||||
try:
|
||||
server.serve_forever()
|
||||
except KeyboardInterrupt:
|
||||
pass
|
||||
finally:
|
||||
server.server_close()
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
main()
|
||||
Reference in new issue
Block a user