change: provider base configs move into the provider classes (#143) #184
Loading…
Reference in a new issue
No description provided.
Delete branch "template-paths"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Problem
Second half of #143, taken to its end state. The provider templates were code-shaped knowledge in data clothing: per-type OpenVPN options restating filenames the provider classes already stage (
proton_ca.crt), embedding per-install per-type paths (auth-user-pass /usr/share/aqomui/ProtonVPN/ProtonVPN-auth.txt) that go wrong once an entry's name can differ from its type, and drifting from conventions update.py owns — Windscribe's template pointed atwindscribe_userpass.txtwhile copy_certs writes{entry}-auth.txt. Every historical bug in this area was a two-homes bug.Fix
Templates stop existing — as files or as text blobs. The four shipped templates shared an identical 10-line OpenVPN client boilerplate (now
update.OVPN_BASE); what actually differs per type is three facts, and each provider class now states exactly those:ovpn_options— the type's directives beyond the boilerplateovpn_auth— whether the tunnel logs in with the entry's auth fileovpn_files— option → staged filename, for exactly the files that class's ownfetch()stagescopy_certsbuilds{entry}/openvpn.conffrom them: filenames anchored to the entry's own directory quoted withovpn_quote(entry names may hold spaces),auth-user-passpointed at copy_certs's own{entry}-auth.txtconvention (retiring the Windscribe drift). No text rewriting, no shlex re-parsing, no missing-file failure mode — a provider registered without itsovpn_filesis caught by a test, not by a user's first import. The seededproto/remoteplaceholders keep the trailing spacewrite_configmatches withstartswith("proto "); OVPN_BASE is that quirk's one home, commented.The stunnel template becomes a format string in tunnel.py filled per connection (replacing the readlines/rewrite loop), with the Airvpn CAfile path now derived from
config.ROOTDIR.ovpn_quotemoves up toproviders/__init__.pyfor both import paths to share.resources/templates/retires along with its setup.py/PKGBUILD entries.Existing installs are untouched: seeding still only happens when
openvpn.confis absent. A freshly seeded config lists the same directives as before in different order (OpenVPN options are position-independent) with file paths now quoted.Verification
ruff check --select E9,F63,F7,F82 .clean; 439 tests pass (4 new)TestTemplateSeedingrunscopy_certsfor an entry namedMy Proton(type ProtonVPN) — asserts ca/tls-crypt/auth paths all land inMy Proton/, theproto/remoteplaceholders come out in write_config's expected form, and an existing openvpn.conf is never reseeded; registry-wide tests pin that every provider names its staged files (bare names, known file options) and embeds no pathsresources/templates/🤖 Generated with Claude Code
The shipped templates hardcoded per-install, per-type paths (auth-user-pass /usr/share/aqomui/ProtonVPN/ProtonVPN-auth.txt), which goes wrong once an entry's name can differ from its type: the certs land in the entry's directory while the seeded config points at the type's. Templates now carry only the filenames their type needs; copy_certs makes them absolute for the entry when it seeds openvpn.conf, the way the custom import already rewrites auth-user-pass. The auth filename comes from copy_certs's own {entry}-auth.txt convention, which also retires the stale windscribe_userpass.txt reference the Windscribe template carried. ovpn_quote and the file-option tuple move up to providers/__init__: generic OpenVPN config knowledge both import paths now share. Closes #143 Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>d37156f4a50d446c9c99change: inject entry paths at seed time, strip them from templates (#143)to change: provider base configs move into the provider classes (#143)0d446c9c994fe456ab524fe456ab52b873ec8627