Repository navigation
Detect the OWA server version; show only its settings - #27
Merged
Merged
Conversation
The OWA Server Version switch is gone. The plugin asks the endpoint which version it runs: GET api/index.php?owa_rest_params=base/v1/sites with Authorization: Bearer owa-version-probe. 401 with a Bearer WWW-Authenticate challenge is 2.x; OWA 1.x's REST envelope without one is 1.x; anything else identifies nothing, keeps the version found before and the settings page says why. - owaVersion stays the stored option, now detected: '1', '2', or '' while none is known. Only the OWA Endpoint shows until a version is known; then only that version's fields. On 2.x the Tracking tab stays without click tracking and Domstreams, as before. - Checked when the endpoint is saved (new, or not identified yet), once a day on an administrator's admin page load, and with Check again (POST owa-wp/v1/server). - After an update, the first admin page load checks the server and replaces the chosen version; when nothing is identified the chosen version (or 1, the old default) is kept. Until then the tag is as before. - A server that was 1.x and is now 2.x flags a dismissible notice on the dashboard, Plugins and settings screens asking for an application password. The 1.x keys are kept. - Network Admin > OWA refuses an endpoint that identifies as 1.x. - The Application Password field links to OWA's documentation. - CI: OWA's v2 branch is gone; the 2.x jobs run on master, which refuses 1.x keys, so that integration job runs the owa2 group only.
…dex.php as Apache does OWA master renamed cmd=install to cmd=core-install, takes no scope= for app-password-create, and refuses an owa-config.php that uses $this, so app_passwords_require_https is stored with persistSetting() instead. The router rewrote api/index.php itself and replaced its owa_rest_params with 'index.php'; Apache's rule skips existing files.
…ich sends WWW-Authenticate
…main OWA stored The tag-settings link read values, which WebsiteId no longer received: the page crashed once the picker rendered. OWA 2.0 stores a Profile's bare host, so the e2e labels and site IDs are read with the domain as stored.
…754), which sends WWW-Authenticate" This reverts commit 1170e45.
The probe asks for base/v2/profiles. OWA 2.x's envelope ({data, error}),
or a 401 with a Bearer challenge, is 2.x; any other answer is 1.x. No
answer (network error, 408, 429, 5xx) keeps the version found at the same
endpoint before; a new endpoint that does not answer gets none.
Settings page: the endpoint comes with Check, which identifies the URL in
the field without storing it. That version's fields then show, and Save
Changes once its credentials are entered (on the saved endpoint, always).
Check no longer reloads the form, so typed values stay.
…site on 2.x, and a 2.x choice on a 1.x server
Merged
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Replaces the OWA Server Version switch with detection, so the settings page only offers what works with the server at the OWA Server Endpoint.
Detection
GET <endpoint>api/index.php?owa_rest_params=base/v2/profileswithAuthorization: Bearer owa-version-probeand no other credentials, throughwp_remote_get(the stored scheme, WordPress's TLS defaults).{data, error},errora string or null, norequestId), or 401 with aWWW-AuthenticateBearer challenge{requestId, httpResponse}envelope for a route it lacks, an empty body from older 1.x, HTML, a proxy's login)Either 2.x marker is enough, so a proxy that strips the header or replaces the body does not turn 2.x into 1.x. Endpoints that are not OWA never reach the probe: saving or checking one requires OWA's tracker at
public/base/dist/owa.tracker.js(1.14 and later).Settings page
POST owa-wp/v1/serverwithowaEndpoint,manage_options). On the saved endpoint it checks and stores, as the daily check does. A URL without OWA gets its error under the field.Application-Passwords), Observation Profile; Tracking tab without Track Clicks and Track DomstreamsWhen it checks
owa_wp_server_checked) on an admin page load by a user withmanage_options; not on AJAX, never in network mode.A version change purges the site's pages (
owa_wp_tag_changed), since the tag changes with it.Upgrades
owa_wp_plugin_version) checks the server and stores the detected version. With no answer, the version chosen before is kept (1when it was never saved, the old default). Without an endpoint the version is cleared. Front-end tags are unchanged until that load.Other changes
open-web-analytics, headerText Domainadded;wp_set_script_translationsfor the settings scripts).v2branch no longer exists, so the 2.x jobs usemaster; that integration job runs only theowa2group, since master refuses 1.x keys. The OWA install step usescmd=core-installwhen OWA has it, mints the application password withoutscope=, and storesapp_passwords_require_httpswithpersistSetting()(2.0 refuses anowa-config.phpthat uses$this).php -Srouter no longer rewritesapi/index.phpitself (Apache's rule skips existing files); it replaced the probe'sowa_rest_paramswithindex.php.OWA_WP_VERSION; Stable tag unchanged.Tests
tests/ServerTest.php: classification (2.x envelope or challenge; 1.14, empty, HTML and proxy answers as 1.x; no answer), the probe request, stored version, save and Check for fresh 1.x and 2.x, a new endpoint that does not answer, Check of an unsaved URL, daily check, update migration (still 1.x, 1.x → 2.x, 2.x on 2.x, a 2.x choice on a 1.x server, no answer, no endpoint), upgrade notice and dismissal.trackClicks,trackDomStream,trackPageView,setSiteId,setDebug), 1.x tag unchanged, no tag without a version, network refusal.owa1) and OWA master (owa2).Not covered: a browser run of a fresh 1.x setup (e2e runs against OWA master only), and a real 1.x → 2.x server upgrade.
Checked on test.photopressdev.com against the dev OWA: the update switched it to 2.x and raised the notice; with an application password and a Profile chosen, a logged-out page view was stored under that Profile.
Docs
.wordpress-orgscreenshots 1–5 are from this branch's CI run, and caption 1 mentions Check. The wiki's Setup page still shows the old label and the Save-first page.