Skip to content

Commit

Permalink
Add maskable icons
Browse files Browse the repository at this point in the history
  • Loading branch information
alistair3149 committed Nov 14, 2024
1 parent 13d1d46 commit 29ee506
Show file tree
Hide file tree
Showing 3 changed files with 108 additions and 55 deletions.
163 changes: 108 additions & 55 deletions config/LocalSettings.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
* These cache would need to be invalidated manually if needed.
*/
// Get the timestamp from https://www.mediawiki.org/wiki/Manual:$wgCacheEpoch and ADD SINGLE QUOTES
$wgCacheEpoch = '20241110231803'; // Page cache - Invalidate when there are HTML changes
$wgCacheEpoch = '20241113030632'; // Page cache - Invalidate when there are HTML changes
$wgThumbnailEpoch = '20241110231803'; // Thumbnail cache - Invalidate when there are thumbanil/image config changes
// $wgExtensionInfoMTime = filemtime( "$IP/LocalSettings.php" ); // Extension cache

Expand Down Expand Up @@ -1171,12 +1171,40 @@
$wgCitizenMaxSearchResults = 10;
// Default to dark theme
$wgCitizenThemeDefault = 'dark';
$wgCitizenThemeColor = '#0d1012';
$wgCitizenManifestOptions = [
'background_color' => '#0d1012',
'description' => 'Unofficial wiki dedicated to Star Citizen and Squadron 42',
'short_name' => 'SC Wiki',
'theme_color' => "#0d1012",
'icons' => [
[
'src' => "$wgResourceBasePath/resources/assets/sitelogo.svg",
'sizes' => 'any',
'type' => 'image/svg+xml'
],
[
'src' => "$wgResourceBasePath/resources/assets/maskable_icon_x192.png",
'sizes' => '192x192',
'type' => 'image/png',
'purpose' => 'maskable'
],
[
'src' => "$wgResourceBasePath/resources/assets/maskable_icon_x512.png",
'sizes' => '512x512',
'type' => 'image/png',
'purpose' => 'maskable'
],
],
];

/**
* Enable WikiDiff2
*/
if ( extension_loaded( 'wikidiff2' ) ) {
$wgDiff = false;
// Set as a variable because we will re-use it at SoftwareInfo hook
$sctIsWikiDiff2Enabled = extension_loaded( 'wikidiff2' );
if ( $sctIsWikiDiff2Enabled ) {
$wgDiffEngine = 'wikidiff2';
}

/**
Expand Down Expand Up @@ -1302,58 +1330,59 @@
* @see https://www.mediawiki.org/wiki/Manual:Hooks/SkinAddFooterLinks
*/
$wgHooks['SkinAddFooterLinks'][] = function( $sk, $key, &$footerlinks ) {
$rel = 'nofollow noreferrer noopener';

if ( $key === 'places' ) {
$footerlinks[ 'cookiestatement' ] = Html::rawElement( 'a',
[
'href' => Title::newFromText(
$sk->msg('cookiestatementpage')->inContentLanguage()->text()
)->getFullURL()
],
$sk->msg('cookiestatement')->escaped()
);
//$footerlinks['analytics'] = Html::rawElement(
// 'a',
// [
// 'href' => 'https://analytics.starcitizen.tools/starcitizen.tools',
// 'rel' => $rel
// ],
// $sk->msg( 'footer-analytics' )->escaped()
//);
$footerlinks['statuspage'] = Html::rawElement(
'a',
[
'href' => 'https://status.starcitizen.tools',
'rel' => $rel
],
$sk->msg('footer-statuspage')->escaped()
);
$footerlinks['github'] = Html::rawElement(
'a',
[
'href' => 'https://github.com/StarCitizenTools',
'rel' => $rel
],
$sk->msg('footer-github')->escaped()
);
$footerlinks['patreon'] = Html::rawElement(
'a',
[
'href' => 'https://www.patreon.com/starcitizentools',
'rel' => $rel
],
$sk->msg('footer-patreon')->escaped()
);
$footerlinks['kofi'] = Html::rawElement(
'a',
[
'href' => 'https://ko-fi.com/starcitizentools',
'rel' => $rel
],
$sk->msg('footer-kofi')->escaped()
);
// Early edit
if ( $key !== 'places' ) {
return;
}
$rel = 'nofollow noreferrer noopener';
$footerlinks[ 'cookiestatement' ] = Html::rawElement( 'a',
[
'href' => Title::newFromText(
$sk->msg('cookiestatementpage')->inContentLanguage()->text()
)->getFullURL()
],
$sk->msg('cookiestatement')->escaped()
);
//$footerlinks['analytics'] = Html::rawElement(
// 'a',
// [
// 'href' => 'https://analytics.starcitizen.tools/starcitizen.tools',
// 'rel' => $rel
// ],
// $sk->msg( 'footer-analytics' )->escaped()
//);
$footerlinks['statuspage'] = Html::rawElement(
'a',
[
'href' => 'https://status.starcitizen.tools',
'rel' => $rel
],
$sk->msg('footer-statuspage')->escaped()
);
$footerlinks['github'] = Html::rawElement(
'a',
[
'href' => 'https://github.com/StarCitizenTools',
'rel' => $rel
],
$sk->msg('footer-github')->escaped()
);
$footerlinks['patreon'] = Html::rawElement(
'a',
[
'href' => 'https://www.patreon.com/starcitizentools',
'rel' => $rel
],
$sk->msg('footer-patreon')->escaped()
);
$footerlinks['kofi'] = Html::rawElement(
'a',
[
'href' => 'https://ko-fi.com/starcitizentools',
'rel' => $rel
],
$sk->msg('footer-kofi')->escaped()
);
};

/**
Expand Down Expand Up @@ -1382,4 +1411,28 @@
}
}
return true;
};
};

/**
* Append rel="nofollow" to red links to avoid unnessecary crawler traffic
*
* @see https://www.mediawiki.org/wiki/Manual:$wgNoFollowLinks
*/
$wgHooks['HtmlPageLinkRendererEnd'][] = function( $linkRenderer, $target, $isKnown, &$text, &$attribs, &$ret ) {
if ( !$isKnown && preg_match( '/\bnew\b/S', $attribs['class'] ?? '' ) ) {
$attribs['rel'] = 'nofollow';
}
return true;
};

/**
* Extend "Installed software" section in Special:Version
*
* @see https://www.mediawiki.org/wiki/Manual:Hooks/SoftwareInfo
*/
$wgHooks['SoftwareInfo'][] = function( &$software ) {
// Backported from http://phabricator.wikimedia.org/T339915
if ( phpversion( "wikidiff2" ) ) {
$software[ '[https://www.mediawiki.org/wiki/Wikidiff2 wikidiff2]' ] = phpversion( "wikidiff2" );
}
};
Binary file added resources/assets/maskable_icon_x192.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added resources/assets/maskable_icon_x512.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 29ee506

Please sign in to comment.