Skip to content

Commit e9d1132

Browse files
Copilotkiyarose
andauthored
feat: preserve article path on independent wiki redirects, bump version to 2.2.0
Agent-Logs-Url: https://github.com/SillyLittleTech/Flean/sessions/03459e09-3dc2-45d6-bf14-d042a1a05ac8 Co-authored-by: kiyarose <75678535+kiyarose@users.noreply.github.com>
1 parent 2b27d0c commit e9d1132

6 files changed

Lines changed: 70 additions & 40 deletions

File tree

ios/Flean.xcodeproj/project.pbxproj

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -381,7 +381,7 @@
381381
isa = XCBuildConfiguration;
382382
buildSettings = {
383383
CODE_SIGN_STYLE = Automatic;
384-
CURRENT_PROJECT_VERSION = 3;
384+
CURRENT_PROJECT_VERSION = 4;
385385
DEVELOPMENT_ASSET_PATHS = extention;
386386
DEVELOPMENT_TEAM = PWL627GZ4Y;
387387
GENERATE_INFOPLIST_FILE = YES;
@@ -394,7 +394,7 @@
394394
"@executable_path/Frameworks",
395395
"@executable_path/../../Frameworks",
396396
);
397-
MARKETING_VERSION = 2.1.6;
397+
MARKETING_VERSION = 2.2.0;
398398
OTHER_LDFLAGS = (
399399
"-framework",
400400
SafariServices,
@@ -417,7 +417,7 @@
417417
isa = XCBuildConfiguration;
418418
buildSettings = {
419419
CODE_SIGN_STYLE = Automatic;
420-
CURRENT_PROJECT_VERSION = 3;
420+
CURRENT_PROJECT_VERSION = 4;
421421
DEVELOPMENT_ASSET_PATHS = extention;
422422
DEVELOPMENT_TEAM = PWL627GZ4Y;
423423
GENERATE_INFOPLIST_FILE = YES;
@@ -430,7 +430,7 @@
430430
"@executable_path/Frameworks",
431431
"@executable_path/../../Frameworks",
432432
);
433-
MARKETING_VERSION = 2.1.6;
433+
MARKETING_VERSION = 2.2.0;
434434
OTHER_LDFLAGS = (
435435
"-framework",
436436
SafariServices,
@@ -577,7 +577,7 @@
577577
ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor;
578578
CODE_SIGN_ENTITLEMENTS = Flean/Flean.entitlements;
579579
CODE_SIGN_STYLE = Automatic;
580-
CURRENT_PROJECT_VERSION = 3;
580+
CURRENT_PROJECT_VERSION = 4;
581581
DEVELOPMENT_TEAM = PWL627GZ4Y;
582582
GENERATE_INFOPLIST_FILE = YES;
583583
INFOPLIST_KEY_CFBundleDisplayName = Flean;
@@ -588,7 +588,7 @@
588588
"$(inherited)",
589589
"@executable_path/Frameworks",
590590
);
591-
MARKETING_VERSION = 2.1.6;
591+
MARKETING_VERSION = 2.2.0;
592592
OTHER_LDFLAGS = (
593593
"-framework",
594594
SafariServices,
@@ -613,7 +613,7 @@
613613
ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor;
614614
CODE_SIGN_ENTITLEMENTS = Flean/Flean.entitlements;
615615
CODE_SIGN_STYLE = Automatic;
616-
CURRENT_PROJECT_VERSION = 3;
616+
CURRENT_PROJECT_VERSION = 4;
617617
DEVELOPMENT_TEAM = PWL627GZ4Y;
618618
GENERATE_INFOPLIST_FILE = YES;
619619
INFOPLIST_KEY_CFBundleDisplayName = Flean;
@@ -624,7 +624,7 @@
624624
"$(inherited)",
625625
"@executable_path/Frameworks",
626626
);
627-
MARKETING_VERSION = 2.1.6;
627+
MARKETING_VERSION = 2.2.0;
628628
OTHER_LDFLAGS = (
629629
"-framework",
630630
SafariServices,
@@ -647,11 +647,11 @@
647647
buildSettings = {
648648
BUNDLE_LOADER = "$(TEST_HOST)";
649649
CODE_SIGN_STYLE = Automatic;
650-
CURRENT_PROJECT_VERSION = 3;
650+
CURRENT_PROJECT_VERSION = 4;
651651
DEVELOPMENT_TEAM = PWL627GZ4Y;
652652
GENERATE_INFOPLIST_FILE = YES;
653653
MACOSX_DEPLOYMENT_TARGET = 10.14;
654-
MARKETING_VERSION = 2.1.6;
654+
MARKETING_VERSION = 2.2.0;
655655
PRODUCT_BUNDLE_IDENTIFIER = slf.FleanTests;
656656
PRODUCT_NAME = "$(TARGET_NAME)";
657657
SWIFT_EMIT_LOC_STRINGS = NO;
@@ -665,11 +665,11 @@
665665
buildSettings = {
666666
BUNDLE_LOADER = "$(TEST_HOST)";
667667
CODE_SIGN_STYLE = Automatic;
668-
CURRENT_PROJECT_VERSION = 3;
668+
CURRENT_PROJECT_VERSION = 4;
669669
DEVELOPMENT_TEAM = PWL627GZ4Y;
670670
GENERATE_INFOPLIST_FILE = YES;
671671
MACOSX_DEPLOYMENT_TARGET = 10.14;
672-
MARKETING_VERSION = 2.1.6;
672+
MARKETING_VERSION = 2.2.0;
673673
PRODUCT_BUNDLE_IDENTIFIER = slf.FleanTests;
674674
PRODUCT_NAME = "$(TARGET_NAME)";
675675
SWIFT_EMIT_LOC_STRINGS = NO;
@@ -682,10 +682,10 @@
682682
isa = XCBuildConfiguration;
683683
buildSettings = {
684684
CODE_SIGN_STYLE = Automatic;
685-
CURRENT_PROJECT_VERSION = 3;
685+
CURRENT_PROJECT_VERSION = 4;
686686
DEVELOPMENT_TEAM = PWL627GZ4Y;
687687
GENERATE_INFOPLIST_FILE = YES;
688-
MARKETING_VERSION = 2.1.6;
688+
MARKETING_VERSION = 2.2.0;
689689
PRODUCT_BUNDLE_IDENTIFIER = slf.FleanUITests;
690690
PRODUCT_NAME = "$(TARGET_NAME)";
691691
SWIFT_EMIT_LOC_STRINGS = NO;
@@ -698,10 +698,10 @@
698698
isa = XCBuildConfiguration;
699699
buildSettings = {
700700
CODE_SIGN_STYLE = Automatic;
701-
CURRENT_PROJECT_VERSION = 3;
701+
CURRENT_PROJECT_VERSION = 4;
702702
DEVELOPMENT_TEAM = PWL627GZ4Y;
703703
GENERATE_INFOPLIST_FILE = YES;
704-
MARKETING_VERSION = 2.1.6;
704+
MARKETING_VERSION = 2.2.0;
705705
PRODUCT_BUNDLE_IDENTIFIER = slf.FleanUITests;
706706
PRODUCT_NAME = "$(TARGET_NAME)";
707707
SWIFT_EMIT_LOC_STRINGS = NO;

ios/extention/Resources/manifest.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
"name": "Flean Extension",
66
"description": "Redirect Fandom wiki pages to independent mirrors.",
7-
"version": "2.1.6",
7+
"version": "2.2.0",
88

99
"icons": {
1010
"48": "images/icon-48.png",

ios/extention/Resources/scripts/wiki-data-manager.js

Lines changed: 18 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -163,21 +163,36 @@ export async function findMatchingWiki (urlString) {
163163
}
164164
try { article = decodeURIComponent(article) } catch { /* keep encoded */ }
165165

166+
// If the article is empty (wiki root) or matches the origin's main page, redirect to
167+
// the destination's declared main page to honour cross-wiki naming differences.
168+
if (wiki.destination_main_page) {
169+
const normalize = t => (t || '').replace(/_/g, ' ').toLowerCase().trim()
170+
if (!article || normalize(article) === normalize(originEntry.origin_main_page || '')) {
171+
article = wiki.destination_main_page
172+
}
173+
}
174+
166175
// Build destination URL based on platform
167176
const destBase = wiki.destination_base_url
168177
.replace(/^https?:\/\//, '')
169178
.replace(/\/$/, '')
170179
const platform = (wiki.destination_platform || 'mediawiki').toLowerCase()
171180
let destPath = ''
181+
const encodedArticle = encodeURIComponent(article.replace(/ /g, '_'))
172182

173183
if (wiki.destination_content_path) {
174-
destPath = wiki.destination_content_path
175-
.replace('$1', encodeURIComponent(article.replace(/ /g, '_')))
184+
if (wiki.destination_content_path.includes('$1')) {
185+
// Template-style path: replace the $1 placeholder with the article name
186+
destPath = wiki.destination_content_path.replace('$1', encodedArticle)
187+
} else {
188+
// Prefix-style path (e.g. "/wiki/"): append the article name to the prefix
189+
destPath = wiki.destination_content_path + encodedArticle
190+
}
176191
} else if (platform === 'dokuwiki') {
177192
destPath = `/doku.php?id=${encodeURIComponent(article.replace(/ /g, '_').toLowerCase())}`
178193
} else {
179194
// Default: MediaWiki-style /wiki/ArticleName
180-
destPath = `/wiki/${encodeURIComponent(article.replace(/ /g, '_'))}`
195+
destPath = `/wiki/${encodedArticle}`
181196
}
182197

183198
const destinationUrl = `https://${destBase}${destPath}${url.search}${url.hash}`

mos/Flean Extension/Resources/manifest.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
"name": "__MSG_extension_name__",
66
"description": "__MSG_extension_description__",
7-
"version": "2.1.6",
7+
"version": "2.2.0",
88

99
"icons": {
1010
"48": "images/icon-48.png",

mos/Flean Extension/Resources/scripts/wiki-data-manager.js

Lines changed: 18 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -163,21 +163,36 @@ export async function findMatchingWiki (urlString) {
163163
}
164164
try { article = decodeURIComponent(article) } catch { /* keep encoded */ }
165165

166+
// If the article is empty (wiki root) or matches the origin's main page, redirect to
167+
// the destination's declared main page to honour cross-wiki naming differences.
168+
if (wiki.destination_main_page) {
169+
const normalize = t => (t || '').replace(/_/g, ' ').toLowerCase().trim()
170+
if (!article || normalize(article) === normalize(originEntry.origin_main_page || '')) {
171+
article = wiki.destination_main_page
172+
}
173+
}
174+
166175
// Build destination URL based on platform
167176
const destBase = wiki.destination_base_url
168177
.replace(/^https?:\/\//, '')
169178
.replace(/\/$/, '')
170179
const platform = (wiki.destination_platform || 'mediawiki').toLowerCase()
171180
let destPath = ''
181+
const encodedArticle = encodeURIComponent(article.replace(/ /g, '_'))
172182

173183
if (wiki.destination_content_path) {
174-
destPath = wiki.destination_content_path
175-
.replace('$1', encodeURIComponent(article.replace(/ /g, '_')))
184+
if (wiki.destination_content_path.includes('$1')) {
185+
// Template-style path: replace the $1 placeholder with the article name
186+
destPath = wiki.destination_content_path.replace('$1', encodedArticle)
187+
} else {
188+
// Prefix-style path (e.g. "/wiki/"): append the article name to the prefix
189+
destPath = wiki.destination_content_path + encodedArticle
190+
}
176191
} else if (platform === 'dokuwiki') {
177192
destPath = `/doku.php?id=${encodeURIComponent(article.replace(/ /g, '_').toLowerCase())}`
178193
} else {
179194
// Default: MediaWiki-style /wiki/ArticleName
180-
destPath = `/wiki/${encodeURIComponent(article.replace(/ /g, '_'))}`
195+
destPath = `/wiki/${encodedArticle}`
181196
}
182197

183198
const destinationUrl = `https://${destBase}${destPath}${url.search}${url.hash}`

mos/Flean.xcodeproj/project.pbxproj

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -379,7 +379,7 @@
379379
buildSettings = {
380380
CODE_SIGN_ENTITLEMENTS = "Flean Extension/Flean_Extension.entitlements";
381381
CODE_SIGN_STYLE = Automatic;
382-
CURRENT_PROJECT_VERSION = 3;
382+
CURRENT_PROJECT_VERSION = 4;
383383
DEVELOPMENT_TEAM = PWL627GZ4Y;
384384
ENABLE_HARDENED_RUNTIME = YES;
385385
GENERATE_INFOPLIST_FILE = YES;
@@ -392,7 +392,7 @@
392392
"@executable_path/../../../../Frameworks",
393393
);
394394
MACOSX_DEPLOYMENT_TARGET = 10.14;
395-
MARKETING_VERSION = 2.1.6;
395+
MARKETING_VERSION = 2.2.0;
396396
OTHER_LDFLAGS = (
397397
"-framework",
398398
SafariServices,
@@ -410,7 +410,7 @@
410410
buildSettings = {
411411
CODE_SIGN_ENTITLEMENTS = "Flean Extension/Flean_Extension.entitlements";
412412
CODE_SIGN_STYLE = Automatic;
413-
CURRENT_PROJECT_VERSION = 3;
413+
CURRENT_PROJECT_VERSION = 4;
414414
DEVELOPMENT_TEAM = PWL627GZ4Y;
415415
ENABLE_HARDENED_RUNTIME = YES;
416416
GENERATE_INFOPLIST_FILE = YES;
@@ -423,7 +423,7 @@
423423
"@executable_path/../../../../Frameworks",
424424
);
425425
MACOSX_DEPLOYMENT_TARGET = 10.14;
426-
MARKETING_VERSION = 2.1.6;
426+
MARKETING_VERSION = 2.2.0;
427427
OTHER_LDFLAGS = (
428428
"-framework",
429429
SafariServices,
@@ -564,7 +564,7 @@
564564
CODE_SIGN_ENTITLEMENTS = Flean/Flean.entitlements;
565565
CODE_SIGN_STYLE = Automatic;
566566
COMBINE_HIDPI_IMAGES = YES;
567-
CURRENT_PROJECT_VERSION = 3;
567+
CURRENT_PROJECT_VERSION = 4;
568568
DEVELOPMENT_TEAM = PWL627GZ4Y;
569569
ENABLE_HARDENED_RUNTIME = YES;
570570
GENERATE_INFOPLIST_FILE = YES;
@@ -577,7 +577,7 @@
577577
"@executable_path/../Frameworks",
578578
);
579579
MACOSX_DEPLOYMENT_TARGET = 10.14;
580-
MARKETING_VERSION = 2.1.6;
580+
MARKETING_VERSION = 2.2.0;
581581
OTHER_LDFLAGS = (
582582
"-framework",
583583
SafariServices,
@@ -603,7 +603,7 @@
603603
CODE_SIGN_ENTITLEMENTS = Flean/Flean.entitlements;
604604
CODE_SIGN_STYLE = Automatic;
605605
COMBINE_HIDPI_IMAGES = YES;
606-
CURRENT_PROJECT_VERSION = 3;
606+
CURRENT_PROJECT_VERSION = 4;
607607
DEVELOPMENT_TEAM = PWL627GZ4Y;
608608
ENABLE_HARDENED_RUNTIME = YES;
609609
GENERATE_INFOPLIST_FILE = YES;
@@ -616,7 +616,7 @@
616616
"@executable_path/../Frameworks",
617617
);
618618
MACOSX_DEPLOYMENT_TARGET = 10.14;
619-
MARKETING_VERSION = 2.1.6;
619+
MARKETING_VERSION = 2.2.0;
620620
OTHER_LDFLAGS = (
621621
"-framework",
622622
SafariServices,
@@ -639,11 +639,11 @@
639639
buildSettings = {
640640
BUNDLE_LOADER = "$(TEST_HOST)";
641641
CODE_SIGN_STYLE = Automatic;
642-
CURRENT_PROJECT_VERSION = 3;
642+
CURRENT_PROJECT_VERSION = 4;
643643
DEVELOPMENT_TEAM = PWL627GZ4Y;
644644
GENERATE_INFOPLIST_FILE = YES;
645645
MACOSX_DEPLOYMENT_TARGET = 10.14;
646-
MARKETING_VERSION = 2.1.6;
646+
MARKETING_VERSION = 2.2.0;
647647
PRODUCT_BUNDLE_IDENTIFIER = slf.FleanTests;
648648
PRODUCT_NAME = "$(TARGET_NAME)";
649649
SWIFT_EMIT_LOC_STRINGS = NO;
@@ -657,11 +657,11 @@
657657
buildSettings = {
658658
BUNDLE_LOADER = "$(TEST_HOST)";
659659
CODE_SIGN_STYLE = Automatic;
660-
CURRENT_PROJECT_VERSION = 3;
660+
CURRENT_PROJECT_VERSION = 4;
661661
DEVELOPMENT_TEAM = PWL627GZ4Y;
662662
GENERATE_INFOPLIST_FILE = YES;
663663
MACOSX_DEPLOYMENT_TARGET = 10.14;
664-
MARKETING_VERSION = 2.1.6;
664+
MARKETING_VERSION = 2.2.0;
665665
PRODUCT_BUNDLE_IDENTIFIER = slf.FleanTests;
666666
PRODUCT_NAME = "$(TARGET_NAME)";
667667
SWIFT_EMIT_LOC_STRINGS = NO;
@@ -674,10 +674,10 @@
674674
isa = XCBuildConfiguration;
675675
buildSettings = {
676676
CODE_SIGN_STYLE = Automatic;
677-
CURRENT_PROJECT_VERSION = 3;
677+
CURRENT_PROJECT_VERSION = 4;
678678
DEVELOPMENT_TEAM = PWL627GZ4Y;
679679
GENERATE_INFOPLIST_FILE = YES;
680-
MARKETING_VERSION = 2.1.6;
680+
MARKETING_VERSION = 2.2.0;
681681
PRODUCT_BUNDLE_IDENTIFIER = slf.FleanUITests;
682682
PRODUCT_NAME = "$(TARGET_NAME)";
683683
SWIFT_EMIT_LOC_STRINGS = NO;
@@ -690,10 +690,10 @@
690690
isa = XCBuildConfiguration;
691691
buildSettings = {
692692
CODE_SIGN_STYLE = Automatic;
693-
CURRENT_PROJECT_VERSION = 3;
693+
CURRENT_PROJECT_VERSION = 4;
694694
DEVELOPMENT_TEAM = PWL627GZ4Y;
695695
GENERATE_INFOPLIST_FILE = YES;
696-
MARKETING_VERSION = 2.1.6;
696+
MARKETING_VERSION = 2.2.0;
697697
PRODUCT_BUNDLE_IDENTIFIER = slf.FleanUITests;
698698
PRODUCT_NAME = "$(TARGET_NAME)";
699699
SWIFT_EMIT_LOC_STRINGS = NO;

0 commit comments

Comments
 (0)