Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .github/codeql/codeql-config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
name: "Flean Swift CodeQL"

paths:
- ios
- mos
4 changes: 2 additions & 2 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

version: 2
updates:
- package-ecosystem: "" # See documentation for possible values
directory: "/" # Location of package manifests
- package-ecosystem: "github-actions"
directory: "/"
schedule:
interval: "weekly"
77 changes: 77 additions & 0 deletions .github/workflows/codeql.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
name: CodeQL (Swift)

on:
push:
branches:
- main
paths:
- '**.swift'
- 'ios/**'
- 'mos/**'
- '.github/workflows/codeql.yml'
- '.github/codeql/**'
pull_request:
branches:
- main
paths:
- '**.swift'
- 'ios/**'
- 'mos/**'
- '.github/workflows/codeql.yml'
- '.github/codeql/**'
schedule:
- cron: '0 8 * * 1'
workflow_dispatch:

permissions:
contents: read
security-events: write

jobs:
analyze:
name: Analyze
runs-on: macos-latest

steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Initialize CodeQL
uses: github/codeql-action/init@v3
with:
languages: swift
config-file: ./.github/codeql/codeql-config.yml

# The projects do not contain shared schemes, so build with explicit targets.
- name: Build iOS app for analysis
run: |
cd ios
xcodebuild build \
-project Flean.xcodeproj \
-target Flean \
-configuration Debug \
-sdk iphonesimulator \
-skipPackagePluginValidation \
CODE_SIGNING_ALLOWED=NO \
CODE_SIGNING_REQUIRED=NO \
CODE_SIGN_IDENTITY=""

- name: Build macOS app for analysis
run: |
cd mos
xcodebuild build \
-project Flean.xcodeproj \
-target Flean \
-configuration Debug \
-sdk macosx \
-skipPackagePluginValidation \
CODE_SIGNING_ALLOWED=NO \
CODE_SIGNING_REQUIRED=NO \
CODE_SIGN_IDENTITY=""

- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v3
with:
category: '/language:swift'
32 changes: 16 additions & 16 deletions ios/Flean.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -381,7 +381,7 @@
isa = XCBuildConfiguration;
buildSettings = {
CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 3;
CURRENT_PROJECT_VERSION = 4;
DEVELOPMENT_ASSET_PATHS = extention;
DEVELOPMENT_TEAM = PWL627GZ4Y;
GENERATE_INFOPLIST_FILE = YES;
Expand All @@ -394,7 +394,7 @@
"@executable_path/Frameworks",
"@executable_path/../../Frameworks",
);
MARKETING_VERSION = 2.1.6;
MARKETING_VERSION = 2.2.0;
OTHER_LDFLAGS = (
"-framework",
SafariServices,
Expand All @@ -417,7 +417,7 @@
isa = XCBuildConfiguration;
buildSettings = {
CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 3;
CURRENT_PROJECT_VERSION = 4;
DEVELOPMENT_ASSET_PATHS = extention;
DEVELOPMENT_TEAM = PWL627GZ4Y;
GENERATE_INFOPLIST_FILE = YES;
Expand All @@ -430,7 +430,7 @@
"@executable_path/Frameworks",
"@executable_path/../../Frameworks",
);
MARKETING_VERSION = 2.1.6;
MARKETING_VERSION = 2.2.0;
OTHER_LDFLAGS = (
"-framework",
SafariServices,
Expand Down Expand Up @@ -577,7 +577,7 @@
ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor;
CODE_SIGN_ENTITLEMENTS = Flean/Flean.entitlements;
CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 3;
CURRENT_PROJECT_VERSION = 4;
DEVELOPMENT_TEAM = PWL627GZ4Y;
GENERATE_INFOPLIST_FILE = YES;
INFOPLIST_KEY_CFBundleDisplayName = Flean;
Expand All @@ -588,7 +588,7 @@
"$(inherited)",
"@executable_path/Frameworks",
);
MARKETING_VERSION = 2.1.6;
MARKETING_VERSION = 2.2.0;
OTHER_LDFLAGS = (
"-framework",
SafariServices,
Expand All @@ -613,7 +613,7 @@
ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor;
CODE_SIGN_ENTITLEMENTS = Flean/Flean.entitlements;
CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 3;
CURRENT_PROJECT_VERSION = 4;
DEVELOPMENT_TEAM = PWL627GZ4Y;
GENERATE_INFOPLIST_FILE = YES;
INFOPLIST_KEY_CFBundleDisplayName = Flean;
Expand All @@ -624,7 +624,7 @@
"$(inherited)",
"@executable_path/Frameworks",
);
MARKETING_VERSION = 2.1.6;
MARKETING_VERSION = 2.2.0;
OTHER_LDFLAGS = (
"-framework",
SafariServices,
Expand All @@ -647,11 +647,11 @@
buildSettings = {
BUNDLE_LOADER = "$(TEST_HOST)";
CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 3;
CURRENT_PROJECT_VERSION = 4;
DEVELOPMENT_TEAM = PWL627GZ4Y;
GENERATE_INFOPLIST_FILE = YES;
MACOSX_DEPLOYMENT_TARGET = 10.14;
MARKETING_VERSION = 2.1.6;
MARKETING_VERSION = 2.2.0;
PRODUCT_BUNDLE_IDENTIFIER = slf.FleanTests;
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_EMIT_LOC_STRINGS = NO;
Expand All @@ -665,11 +665,11 @@
buildSettings = {
BUNDLE_LOADER = "$(TEST_HOST)";
CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 3;
CURRENT_PROJECT_VERSION = 4;
DEVELOPMENT_TEAM = PWL627GZ4Y;
GENERATE_INFOPLIST_FILE = YES;
MACOSX_DEPLOYMENT_TARGET = 10.14;
MARKETING_VERSION = 2.1.6;
MARKETING_VERSION = 2.2.0;
PRODUCT_BUNDLE_IDENTIFIER = slf.FleanTests;
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_EMIT_LOC_STRINGS = NO;
Expand All @@ -682,10 +682,10 @@
isa = XCBuildConfiguration;
buildSettings = {
CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 3;
CURRENT_PROJECT_VERSION = 4;
DEVELOPMENT_TEAM = PWL627GZ4Y;
GENERATE_INFOPLIST_FILE = YES;
MARKETING_VERSION = 2.1.6;
MARKETING_VERSION = 2.2.0;
PRODUCT_BUNDLE_IDENTIFIER = slf.FleanUITests;
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_EMIT_LOC_STRINGS = NO;
Expand All @@ -698,10 +698,10 @@
isa = XCBuildConfiguration;
buildSettings = {
CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 3;
CURRENT_PROJECT_VERSION = 4;
DEVELOPMENT_TEAM = PWL627GZ4Y;
GENERATE_INFOPLIST_FILE = YES;
MARKETING_VERSION = 2.1.6;
MARKETING_VERSION = 2.2.0;
PRODUCT_BUNDLE_IDENTIFIER = slf.FleanUITests;
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_EMIT_LOC_STRINGS = NO;
Expand Down
2 changes: 1 addition & 1 deletion ios/extention/Resources/manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

"name": "Flean Extension",
"description": "Redirect Fandom wiki pages to independent mirrors.",
"version": "2.1.6",
"version": "2.2.0",

"icons": {
"48": "images/icon-48.png",
Expand Down
21 changes: 18 additions & 3 deletions ios/extention/Resources/scripts/wiki-data-manager.js
Original file line number Diff line number Diff line change
Expand Up @@ -163,21 +163,36 @@ export async function findMatchingWiki (urlString) {
}
try { article = decodeURIComponent(article) } catch { /* keep encoded */ }

// If the article is empty (wiki root) or matches the origin's main page, redirect to
// the destination's declared main page to honour cross-wiki naming differences.
if (wiki.destination_main_page) {
const normalize = title => (title || '').replace(/_/g, ' ').toLowerCase().trim()
if (!article || normalize(article) === normalize(originEntry.origin_main_page || '')) {
article = wiki.destination_main_page
}
}

// Build destination URL based on platform
const destBase = wiki.destination_base_url
.replace(/^https?:\/\//, '')
.replace(/\/$/, '')
const platform = (wiki.destination_platform || 'mediawiki').toLowerCase()
let destPath = ''
const encodedArticle = encodeURIComponent(article.replace(/ /g, '_'))

if (wiki.destination_content_path) {
destPath = wiki.destination_content_path
.replace('$1', encodeURIComponent(article.replace(/ /g, '_')))
if (wiki.destination_content_path.includes('$1')) {
// Template-style path: replace the $1 placeholder with the article name
destPath = wiki.destination_content_path.replace('$1', encodedArticle)
} else {
// Prefix-style path (e.g. "/wiki/"): append the article name to the prefix
destPath = wiki.destination_content_path + encodedArticle
}
} else if (platform === 'dokuwiki') {
destPath = `/doku.php?id=${encodeURIComponent(article.replace(/ /g, '_').toLowerCase())}`
} else {
// Default: MediaWiki-style /wiki/ArticleName
destPath = `/wiki/${encodeURIComponent(article.replace(/ /g, '_'))}`
destPath = `/wiki/${encodedArticle}`
}

const destinationUrl = `https://${destBase}${destPath}${url.search}${url.hash}`
Expand Down
2 changes: 1 addition & 1 deletion mos/Flean Extension/Resources/manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

"name": "__MSG_extension_name__",
"description": "__MSG_extension_description__",
"version": "2.1.6",
"version": "2.2.0",

"icons": {
"48": "images/icon-48.png",
Expand Down
21 changes: 18 additions & 3 deletions mos/Flean Extension/Resources/scripts/wiki-data-manager.js
Original file line number Diff line number Diff line change
Expand Up @@ -163,21 +163,36 @@ export async function findMatchingWiki (urlString) {
}
try { article = decodeURIComponent(article) } catch { /* keep encoded */ }

// If the article is empty (wiki root) or matches the origin's main page, redirect to
// the destination's declared main page to honour cross-wiki naming differences.
if (wiki.destination_main_page) {
const normalize = title => (title || '').replace(/_/g, ' ').toLowerCase().trim()
if (!article || normalize(article) === normalize(originEntry.origin_main_page || '')) {
article = wiki.destination_main_page
}
}

// Build destination URL based on platform
const destBase = wiki.destination_base_url
.replace(/^https?:\/\//, '')
.replace(/\/$/, '')
const platform = (wiki.destination_platform || 'mediawiki').toLowerCase()
let destPath = ''
const encodedArticle = encodeURIComponent(article.replace(/ /g, '_'))

if (wiki.destination_content_path) {
destPath = wiki.destination_content_path
.replace('$1', encodeURIComponent(article.replace(/ /g, '_')))
if (wiki.destination_content_path.includes('$1')) {
// Template-style path: replace the $1 placeholder with the article name
destPath = wiki.destination_content_path.replace('$1', encodedArticle)
} else {
// Prefix-style path (e.g. "/wiki/"): append the article name to the prefix
destPath = wiki.destination_content_path + encodedArticle
}
} else if (platform === 'dokuwiki') {
destPath = `/doku.php?id=${encodeURIComponent(article.replace(/ /g, '_').toLowerCase())}`
} else {
// Default: MediaWiki-style /wiki/ArticleName
destPath = `/wiki/${encodeURIComponent(article.replace(/ /g, '_'))}`
destPath = `/wiki/${encodedArticle}`
}

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