refactor: rename the theme brand and every identifier from AKSRT to Jio
Full-project rename. `git grep -i aksrt` is now empty apart from the
DBMigrator 3.3.0 changelog note that documents the rename itself.
Code identifiers
- PHP namespace AKSRT\ -> Jio\ (composer PSR-4 + 378 declarations)
- global constants AKSRT_* -> JIO_* (VERSION/DIR/URI, PAY_TYPE_*, CAPTCHA_*)
- procedural functions, hooks, options, meta keys, table names,
cookies, query vars, ajax actions and nonces: aksrt_ -> jio_
- text domain aksrt -> jio; Theme Name -> Jio
- JS globals: aksrtData/aksrtAdminData/... -> jioData/jioAdminData/...,
window.AKSRTCaptcha & friends -> window.JioCaptcha, Aksrt* -> Jio*
- Vue components Aks*.vue -> Jio*.vue (15 files renamed + imports)
- CSS classes/data-attrs/custom properties: aksrt- -> jio-
- REST namespace aksrt/v1 -> jio/v1 (incl. payment gateway callbacks)
Storage layer
- DB tables {prefix}aksrt_* -> {prefix}jio_*; SCHEMA_VERSION 3.2.0 -> 3.3.0
so dbDelta creates the new names on install
- widget id_base aksrt_widget_* -> jio_widget_*
- uninstall.php drop list rebuilt from the actual migrator tables
(dropped 3 stale entries, added the 17 missing ones)
Removed
- hardcoded https://api.aksrt.com/version.json default update endpoint;
get_endpoint() now reads the 「更新端点」 setting and do_check() no-ops
when it is empty
Files renamed: inc/helpers/aksrt-*.php -> jio-*.php (54),
assets/admin/src/components/form/Aks*.vue -> Jio*.vue (15).
Build artifacts regenerated: assets/css/build, assets/js/runtime,
assets/admin/build.
Verified: audit-psr4-paths errors=0, audit-admin-contracts errors=0
(warnings=56, unchanged baseline), 813/813 widget-system tests,
44/44 phpunit, php -l clean across all PHP.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
This commit is contained in:
1 parent
5b16bc6e15
commit
35bb96e82f
997 files changed
+28216
-28188
No files matched your search
@@ -16,7 +16,7 @@ $GLOBALS['wp_options'] = [];
|
||||
$GLOBALS['wp_cache'] = [];
|
||||
$GLOBALS['captcha_enabled'] = true;
|
||||
|
||||
function aksrt_is_captcha_enabled_for(string $scene): bool { return $scene === 'bind' && !empty($GLOBALS['captcha_enabled']); }
|
||||
function jio_is_captcha_enabled_for(string $scene): bool { return $scene === 'bind' && !empty($GLOBALS['captcha_enabled']); }
|
||||
function __(string $text, string $domain = ''): string { return $text; }
|
||||
function sanitize_key(string $value): string { return preg_replace('/[^a-z0-9_\-]/', '', strtolower($value)) ?? ''; }
|
||||
function sanitize_text_field(string $value): string { return trim(strip_tags($value)); }
|
||||
@@ -76,7 +76,7 @@ final class HarnessWpdb {
|
||||
$GLOBALS['wpdb'] = new HarnessWpdb();
|
||||
}
|
||||
|
||||
namespace AKSRT\Settings {
|
||||
namespace Jio\Settings {
|
||||
final class Settings {
|
||||
public static function flush_settings_cache(): void {}
|
||||
public static function sync_native_site_icon(string $value): void {}
|
||||
@@ -99,51 +99,51 @@ namespace {
|
||||
if (!$condition) throw new RuntimeException($message);
|
||||
}
|
||||
|
||||
$_COOKIE['aksrt_oauth_browser'] = str_repeat('A', 43);
|
||||
$token = \AKSRT\Auth\OAuthTransactionStore::issue('direct', ['provider' => 'github'], 60, true);
|
||||
check(\AKSRT\Auth\OAuthTransactionStore::peek($token, 'direct', true) !== null, 'transaction peek failed');
|
||||
check(\AKSRT\Auth\OAuthTransactionStore::peek($token, 'other', true) === null, 'transaction kind mismatch accepted');
|
||||
$_COOKIE['aksrt_oauth_browser'] = str_repeat('B', 43);
|
||||
check(\AKSRT\Auth\OAuthTransactionStore::claim($token, 'direct', true) === null, 'wrong browser claimed transaction');
|
||||
$_COOKIE['aksrt_oauth_browser'] = str_repeat('A', 43);
|
||||
check(\AKSRT\Auth\OAuthTransactionStore::claim($token, 'direct', true) !== null, 'valid browser failed claim');
|
||||
check(\AKSRT\Auth\OAuthTransactionStore::claim($token, 'direct', true) === null, 'transaction replay accepted');
|
||||
$_COOKIE['jio_oauth_browser'] = str_repeat('A', 43);
|
||||
$token = \Jio\Auth\OAuthTransactionStore::issue('direct', ['provider' => 'github'], 60, true);
|
||||
check(\Jio\Auth\OAuthTransactionStore::peek($token, 'direct', true) !== null, 'transaction peek failed');
|
||||
check(\Jio\Auth\OAuthTransactionStore::peek($token, 'other', true) === null, 'transaction kind mismatch accepted');
|
||||
$_COOKIE['jio_oauth_browser'] = str_repeat('B', 43);
|
||||
check(\Jio\Auth\OAuthTransactionStore::claim($token, 'direct', true) === null, 'wrong browser claimed transaction');
|
||||
$_COOKIE['jio_oauth_browser'] = str_repeat('A', 43);
|
||||
check(\Jio\Auth\OAuthTransactionStore::claim($token, 'direct', true) !== null, 'valid browser failed claim');
|
||||
check(\Jio\Auth\OAuthTransactionStore::claim($token, 'direct', true) === null, 'transaction replay accepted');
|
||||
|
||||
$bindPass = \AKSRT\Auth\OAuthTransactionStore::issue('oauth_bind_pass', ['user_id' => 17, 'provider' => 'github'], 300, true);
|
||||
check(\AKSRT\Auth\OAuth::validate_bind_pass($bindPass, 'github', 17, false), 'valid bind pass peek failed');
|
||||
check(!\AKSRT\Auth\OAuth::validate_bind_pass($bindPass, 'gitee', 17, true), 'wrong bind provider consumed as valid');
|
||||
check(!\AKSRT\Auth\OAuth::validate_bind_pass($bindPass, 'github', 18, true), 'wrong bind user consumed as valid');
|
||||
check(\AKSRT\Auth\OAuth::validate_bind_pass($bindPass, 'github', 17, true), 'valid bind pass claim failed after rejected mismatches');
|
||||
check(!\AKSRT\Auth\OAuth::validate_bind_pass($bindPass, 'github', 17, true), 'bind pass replay accepted');
|
||||
$bindPass = \Jio\Auth\OAuthTransactionStore::issue('oauth_bind_pass', ['user_id' => 17, 'provider' => 'github'], 300, true);
|
||||
check(\Jio\Auth\OAuth::validate_bind_pass($bindPass, 'github', 17, false), 'valid bind pass peek failed');
|
||||
check(!\Jio\Auth\OAuth::validate_bind_pass($bindPass, 'gitee', 17, true), 'wrong bind provider consumed as valid');
|
||||
check(!\Jio\Auth\OAuth::validate_bind_pass($bindPass, 'github', 18, true), 'wrong bind user consumed as valid');
|
||||
check(\Jio\Auth\OAuth::validate_bind_pass($bindPass, 'github', 17, true), 'valid bind pass claim failed after rejected mismatches');
|
||||
check(!\Jio\Auth\OAuth::validate_bind_pass($bindPass, 'github', 17, true), 'bind pass replay accepted');
|
||||
$GLOBALS['captcha_enabled'] = false;
|
||||
check(\AKSRT\Auth\OAuth::validate_bind_pass('', 'github', 17, true), 'disabled bind captcha required a pass');
|
||||
check(\Jio\Auth\OAuth::validate_bind_pass('', 'github', 17, true), 'disabled bind captcha required a pass');
|
||||
$GLOBALS['captcha_enabled'] = true;
|
||||
|
||||
$expired = \AKSRT\Auth\OAuthTransactionStore::issue('direct', [], 30, true);
|
||||
$expired = \Jio\Auth\OAuthTransactionStore::issue('direct', [], 30, true);
|
||||
foreach ($GLOBALS['wp_options'] as $key => $row) {
|
||||
if (is_array($row) && ($row['kind'] ?? '') === 'direct') $GLOBALS['wp_options'][$key]['expires_at'] = time() - 1;
|
||||
}
|
||||
check(\AKSRT\Auth\OAuthTransactionStore::peek($expired, 'direct', true) === null, 'expired transaction accepted');
|
||||
check(\Jio\Auth\OAuthTransactionStore::peek($expired, 'direct', true) === null, 'expired transaction accepted');
|
||||
|
||||
$request = [
|
||||
'v' => '2', 'request_id' => str_repeat('C', 43), 'provider' => 'github', 'action' => 'login',
|
||||
'agent_back_url' => 'https://example.com/oauth/proxy/callback/', 'ts' => (string) time(),
|
||||
];
|
||||
$secret = 'test-secret-value';
|
||||
$requestSign = \AKSRT\Auth\OAuthProxyProtocol::sign_request($request, $secret);
|
||||
check(\AKSRT\Auth\OAuthProxyProtocol::verify_request($request, $secret, $requestSign), 'request signature failed');
|
||||
check(!\AKSRT\Auth\OAuthProxyProtocol::verify_callback($request, $secret, $requestSign), 'direction-separated HMAC failed');
|
||||
$requestSign = \Jio\Auth\OAuthProxyProtocol::sign_request($request, $secret);
|
||||
check(\Jio\Auth\OAuthProxyProtocol::verify_request($request, $secret, $requestSign), 'request signature failed');
|
||||
check(!\Jio\Auth\OAuthProxyProtocol::verify_callback($request, $secret, $requestSign), 'direction-separated HMAC failed');
|
||||
$tampered = $request; $tampered['provider'] = 'qq';
|
||||
check(!\AKSRT\Auth\OAuthProxyProtocol::verify_request($tampered, $secret, $requestSign), 'tampered request accepted');
|
||||
check(!\AKSRT\Auth\OAuthProxyProtocol::timestamp_valid((string) (time() - 1000)), 'expired timestamp accepted');
|
||||
check(!\Jio\Auth\OAuthProxyProtocol::verify_request($tampered, $secret, $requestSign), 'tampered request accepted');
|
||||
check(!\Jio\Auth\OAuthProxyProtocol::timestamp_valid((string) (time() - 1000)), 'expired timestamp accepted');
|
||||
|
||||
check(\AKSRT\Auth\OAuthUrlPolicy::public_https('http://example.com') === '', 'HTTP URL accepted');
|
||||
check(\AKSRT\Auth\OAuthUrlPolicy::public_https('https://user@example.com') === '', 'userinfo URL accepted');
|
||||
check(\AKSRT\Auth\OAuthUrlPolicy::public_https('https://127.0.0.1') === '', 'loopback URL accepted');
|
||||
check(\AKSRT\Auth\OAuthUrlPolicy::public_https('https://10.0.0.1') === '', 'private URL accepted');
|
||||
check(\AKSRT\Auth\OAuthProxyProtocol::callback_url('https://example.com/wrong') === '', 'wrong callback path accepted');
|
||||
check(\Jio\Auth\OAuthUrlPolicy::public_https('http://example.com') === '', 'HTTP URL accepted');
|
||||
check(\Jio\Auth\OAuthUrlPolicy::public_https('https://user@example.com') === '', 'userinfo URL accepted');
|
||||
check(\Jio\Auth\OAuthUrlPolicy::public_https('https://127.0.0.1') === '', 'loopback URL accepted');
|
||||
check(\Jio\Auth\OAuthUrlPolicy::public_https('https://10.0.0.1') === '', 'private URL accepted');
|
||||
check(\Jio\Auth\OAuthProxyProtocol::callback_url('https://example.com/wrong') === '', 'wrong callback path accepted');
|
||||
|
||||
$provider = \AKSRT\Admin\SchemaProvider::get_instance();
|
||||
$provider = \Jio\Admin\SchemaProvider::get_instance();
|
||||
$base = $provider->get_defaults('users', 'oauth');
|
||||
$base['oauth_s'] = true;
|
||||
$base['oauth_weixingzh_s'] = true;
|
||||
@@ -151,18 +151,18 @@ namespace {
|
||||
$base['weixingzh_appid'] = 'appid';
|
||||
$base['weixingzh_appsecret'] = 'secret';
|
||||
$base['weixingzh_token'] = '***';
|
||||
$GLOBALS['wp_options']['aksrt_settings'] = [];
|
||||
$GLOBALS['wp_options']['jio_settings'] = [];
|
||||
check(!$provider->validate('users', $base, 'oauth')['valid'], 'masked missing token treated as configured');
|
||||
$GLOBALS['wp_options']['aksrt_settings'] = ['weixingzh_token' => 'stored-token'];
|
||||
$GLOBALS['wp_options']['jio_settings'] = ['weixingzh_token' => 'stored-token'];
|
||||
check($provider->validate('users', $base, 'oauth')['valid'], 'stored token not preserved by mask validation');
|
||||
|
||||
$provider->write_settings('users', ['weixingzh_token' => '***'], 'oauth');
|
||||
check($GLOBALS['wp_options']['aksrt_settings']['weixingzh_token'] === 'stored-token', 'masked token overwrote stored secret');
|
||||
check($GLOBALS['wp_options']['jio_settings']['weixingzh_token'] === 'stored-token', 'masked token overwrote stored secret');
|
||||
$provider->write_settings('users', ['weixingzh_token' => 'replacement'], 'oauth');
|
||||
check($GLOBALS['wp_options']['aksrt_settings']['weixingzh_token'] === 'replacement', 'new token failed to replace secret');
|
||||
check($GLOBALS['wp_options']['jio_settings']['weixingzh_token'] === 'replacement', 'new token failed to replace secret');
|
||||
$provider->write_settings('users', ['__clear_secrets' => ['weixingzh_token']], 'oauth');
|
||||
check(!isset($GLOBALS['wp_options']['aksrt_settings']['weixingzh_token']), 'explicit secret clear failed');
|
||||
$GLOBALS['wp_options']['aksrt_settings']['weixingzh_token'] = 'final-token';
|
||||
check(!isset($GLOBALS['wp_options']['jio_settings']['weixingzh_token']), 'explicit secret clear failed');
|
||||
$GLOBALS['wp_options']['jio_settings']['weixingzh_token'] = 'final-token';
|
||||
$clearData = $base;
|
||||
$clearData['weixingzh_token'] = '***';
|
||||
$clearData['__clear_secrets'] = ['weixingzh_token'];
|
||||
|
||||
Reference in new issue
Block a user