mirror of
https://github.com/the-djmaze/snappymail.git
synced 2026-07-13 03:27:39 +03:00
Make 'snappymail/v/' path dynamic for cleaner Nextcloud paths
This commit is contained in:
parent
35f37381ae
commit
538f752fbe
4 changed files with 14 additions and 12 deletions
|
|
@ -13,8 +13,9 @@ $nc_tar->buildFromDirectory('./integrations/nextcloud', "@integrations/nextcloud
|
||||||
$files = new RecursiveIteratorIterator(new RecursiveDirectoryIterator('snappymail/v'), RecursiveIteratorIterator::SELF_FIRST);
|
$files = new RecursiveIteratorIterator(new RecursiveDirectoryIterator('snappymail/v'), RecursiveIteratorIterator::SELF_FIRST);
|
||||||
foreach ($files as $file) {
|
foreach ($files as $file) {
|
||||||
if (is_file($file)) {
|
if (is_file($file)) {
|
||||||
$file = str_replace('\\', '/', $file);
|
$newFile = str_replace('\\', '/', $file);
|
||||||
$nc_tar->addFile($file, "snappymail/app/{$file}");
|
$newFile = str_replace("'snappymail/v/'.", '', $newFile);
|
||||||
|
$nc_tar->addFile($file, "snappymail/app/{$newFile}");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
/*
|
/*
|
||||||
|
|
@ -27,6 +28,7 @@ $nc_tar->addFile('.htaccess', 'snappymail/app/.htaccess');
|
||||||
|
|
||||||
$index = file_get_contents('index.php');
|
$index = file_get_contents('index.php');
|
||||||
$index = str_replace('0.0.0', $package->version, $index);
|
$index = str_replace('0.0.0', $package->version, $index);
|
||||||
|
$index = str_replace('snappymail/v/', '', $index);
|
||||||
$nc_tar->addFromString('snappymail/app/index.php', $index);
|
$nc_tar->addFromString('snappymail/app/index.php', $index);
|
||||||
$nc_tar->addFile('README.md', 'snappymail/app/README.md');
|
$nc_tar->addFile('README.md', 'snappymail/app/README.md');
|
||||||
$nc_tar->addFile('CHANGELOG.md', 'snappymail/CHANGELOG.md');
|
$nc_tar->addFile('CHANGELOG.md', 'snappymail/CHANGELOG.md');
|
||||||
|
|
|
||||||
|
|
@ -4,8 +4,6 @@ import { Settings } from 'Common/Globals';
|
||||||
const
|
const
|
||||||
HASH_PREFIX = '#/',
|
HASH_PREFIX = '#/',
|
||||||
SERVER_PREFIX = './?',
|
SERVER_PREFIX = './?',
|
||||||
VERSION = Settings.app('version'),
|
|
||||||
VERSION_PREFIX = 'snappymail/v/' + VERSION + '/',
|
|
||||||
|
|
||||||
adminPath = () => rl.adminArea() && !Settings.app('adminHostUse'),
|
adminPath = () => rl.adminArea() && !Settings.app('adminHostUse'),
|
||||||
|
|
||||||
|
|
@ -62,26 +60,27 @@ export const
|
||||||
* @returns {string}
|
* @returns {string}
|
||||||
*/
|
*/
|
||||||
langLink = (lang, isAdmin) =>
|
langLink = (lang, isAdmin) =>
|
||||||
SERVER_PREFIX + '/Lang/0/' + (isAdmin ? 'Admin' : 'App') + '/' + encodeURI(lang) + '/' + VERSION + '/',
|
SERVER_PREFIX + '/Lang/0/' + (isAdmin ? 'Admin' : 'App')
|
||||||
|
+ '/' + encodeURI(lang)
|
||||||
|
+ '/' + Settings.app('version') + '/',
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param {string} path
|
* @param {string} path
|
||||||
* @returns {string}
|
* @returns {string}
|
||||||
*/
|
*/
|
||||||
staticLink = path => Settings.app('webPath') + VERSION_PREFIX + 'static/' + path,
|
staticLink = path => Settings.app('webVersionPath') + 'static/' + path,
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param {string} theme
|
* @param {string} theme
|
||||||
* @returns {string}
|
* @returns {string}
|
||||||
*/
|
*/
|
||||||
themePreviewLink = theme => {
|
themePreviewLink = theme => {
|
||||||
let prefix = VERSION_PREFIX;
|
let path = 'webVersionPath';
|
||||||
if (theme.endsWith('@custom')) {
|
if (theme.endsWith('@custom')) {
|
||||||
theme = theme.slice(0, theme.length - 7).trim();
|
theme = theme.slice(0, theme.length - 7).trim();
|
||||||
prefix = '';
|
path = 'webPath';
|
||||||
}
|
}
|
||||||
|
return Settings.app(path) + 'themes/' + encodeURI(theme) + '/images/preview.png';
|
||||||
return Settings.app('webPath') + prefix + 'themes/' + encodeURI(theme) + '/images/preview.png';
|
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
||||||
|
|
@ -611,7 +611,8 @@ class Actions
|
||||||
'version' => APP_VERSION,
|
'version' => APP_VERSION,
|
||||||
'token' => $oConfig->Get('security', 'csrf_protection', false) ? Utils::GetCsrfToken() : '',
|
'token' => $oConfig->Get('security', 'csrf_protection', false) ? Utils::GetCsrfToken() : '',
|
||||||
'languages' => \SnappyMail\L10n::getLanguages(false),
|
'languages' => \SnappyMail\L10n::getLanguages(false),
|
||||||
'webPath' => \RainLoop\Utils::WebPath()
|
'webPath' => \RainLoop\Utils::WebPath(),
|
||||||
|
'webVersionPath' => \RainLoop\Utils::WebVersionPath()
|
||||||
), $bAdmin ? array(
|
), $bAdmin ? array(
|
||||||
'adminHostUse' => '' !== $oConfig->Get('security', 'admin_panel_host', ''),
|
'adminHostUse' => '' !== $oConfig->Get('security', 'admin_panel_host', ''),
|
||||||
'adminPath' => $oConfig->Get('security', 'admin_panel_key', '') ?: 'admin',
|
'adminPath' => $oConfig->Get('security', 'admin_panel_key', '') ?: 'admin',
|
||||||
|
|
|
||||||
|
|
@ -202,7 +202,7 @@ class Utils
|
||||||
|
|
||||||
public static function WebVersionPath() : string
|
public static function WebVersionPath() : string
|
||||||
{
|
{
|
||||||
return self::WebPath().'snappymail/v/'.APP_VERSION.'/';
|
return self::WebPath() . \str_replace(APP_INDEX_ROOT_PATH, '', APP_VERSION_ROOT_PATH);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function WebStaticPath(string $path = '') : string
|
public static function WebStaticPath(string $path = '') : string
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue