Merge pull request #19892 from nextcloud/enh/installation-bundle

Move install scripts to a bundle
This commit is contained in:
Roeland Jago Douma 2020-03-12 10:58:15 +01:00 committed by GitHub
commit a5b0f41a9f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
18 changed files with 292 additions and 194 deletions

82
core/js/dist/install.js vendored Normal file

File diff suppressed because one or more lines are too long

1
core/js/dist/install.js.map vendored Normal file

File diff suppressed because one or more lines are too long

24
core/js/dist/login.js vendored

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

52
core/js/dist/main.js vendored

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -1,5 +0,0 @@
$(document).ready(function() {
$('#adminpass').showPassword().keyup();
$('#dbpass').showPassword().keyup();
});

View File

@ -1,126 +0,0 @@
var dbtypes;
$(document).ready(function() {
dbtypes={
sqlite:!!$('#hasSQLite').val(),
mysql:!!$('#hasMySQL').val(),
postgresql:!!$('#hasPostgreSQL').val(),
oracle:!!$('#hasOracle').val()
};
$('#selectDbType').buttonset();
// change links inside an info box back to their default appearance
$('#selectDbType p.info a').button('destroy');
if($('#hasSQLite').val()){
$('#use_other_db').hide();
$('#use_oracle_db').hide();
} else {
$('#sqliteInformation').hide();
}
$('#adminlogin').change(function(){
$('#adminlogin').val($.trim($('#adminlogin').val()));
});
$('#sqlite').click(function() {
$('#use_other_db').slideUp(250);
$('#use_oracle_db').slideUp(250);
$('#sqliteInformation').show();
$('#dbname').attr('pattern','[0-9a-zA-Z$_-]+');
});
$('#mysql,#pgsql').click(function() {
$('#use_other_db').slideDown(250);
$('#use_oracle_db').slideUp(250);
$('#sqliteInformation').hide();
$('#dbname').attr('pattern','[0-9a-zA-Z$_-]+');
});
$('#oci').click(function() {
$('#use_other_db').slideDown(250);
$('#use_oracle_db').show(250);
$('#sqliteInformation').hide();
$('#dbname').attr('pattern','[0-9a-zA-Z$_-.]+');
});
$('#showAdvanced').click(function(e) {
e.preventDefault();
$('#datadirContent').slideToggle(250);
$('#databaseBackend').slideToggle(250);
$('#databaseField').slideToggle(250);
});
$("form").submit(function(){
// Save form parameters
var post = $(this).serializeArray();
// Show spinner while finishing setup
$('.float-spinner').show(250);
// Disable inputs
$(':submit', this).attr('disabled','disabled').val($(':submit', this).data('finishing'));
$('input', this).addClass('ui-state-disabled').attr('disabled','disabled');
// only disable buttons if they are present
if($('#selectDbType').find('.ui-button').length > 0) {
$('#selectDbType').buttonset('disable');
}
$('.strengthify-wrapper, .tipsy')
.css('-ms-filter', '"progid:DXImageTransform.Microsoft.Alpha(Opacity=30)"')
.css('filter', 'alpha(opacity=30)')
.css('opacity', 0.3);
// Create the form
var form = $('<form>');
form.attr('action', $(this).attr('action'));
form.attr('method', 'POST');
for(var i=0; i<post.length; i++){
var input = $('<input type="hidden">');
input.attr(post[i]);
form.append(input);
}
// Add redirect_url
var redirectURL = getURLParameter('redirect_url');
if (redirectURL) {
var redirectURLInput = $('<input type="hidden">');
redirectURLInput.attr({
name: 'redirect_url',
value: redirectURL
});
form.append(redirectURLInput);
}
// Submit the form
form.appendTo(document.body);
form.submit();
return false;
});
// Expand latest db settings if page was reloaded on error
var currentDbType = $('input[type="radio"]:checked').val();
if (currentDbType === undefined){
$('input[type="radio"]').first().click();
}
if (
currentDbType === 'sqlite' ||
(dbtypes.sqlite && currentDbType === undefined)
){
$('#datadirContent').hide(250);
$('#databaseBackend').hide(250);
$('#databaseField').hide(250);
$('.float-spinner').hide(250);
}
$('#adminpass').strengthify({
zxcvbn: OC.linkTo('core','vendor/zxcvbn/dist/zxcvbn.js'),
titles: [
t('core', 'Very weak password'),
t('core', 'Weak password'),
t('core', 'So-so password'),
t('core', 'Good password'),
t('core', 'Strong password')
],
drawTitles: true,
nonce: btoa(OC.requestToken),
});
});

137
core/src/install.js Normal file
View File

@ -0,0 +1,137 @@
import $ from 'jquery'
import { translate as t } from '@nextcloud/l10n'
import { getToken } from './OC/requesttoken'
import getURLParameter from './Util/get-url-parameter'
import 'jquery-ui/ui/widgets/button'
import 'jquery-ui/themes/base/theme.css'
import 'jquery-ui/themes/base/button.css'
import 'strengthify'
import 'strengthify/strengthify.css'
$(document).ready(function() {
const dbtypes = {
sqlite: !!$('#hasSQLite').val(),
mysql: !!$('#hasMySQL').val(),
postgresql: !!$('#hasPostgreSQL').val(),
oracle: !!$('#hasOracle').val(),
}
$('#selectDbType').buttonset()
// change links inside an info box back to their default appearance
$('#selectDbType p.info a').button('destroy')
if ($('#hasSQLite').val()) {
$('#use_other_db').hide()
$('#use_oracle_db').hide()
} else {
$('#sqliteInformation').hide()
}
$('#adminlogin').change(function() {
$('#adminlogin').val($.trim($('#adminlogin').val()))
})
$('#sqlite').click(function() {
$('#use_other_db').slideUp(250)
$('#use_oracle_db').slideUp(250)
$('#sqliteInformation').show()
$('#dbname').attr('pattern', '[0-9a-zA-Z$_-]+')
})
$('#mysql,#pgsql').click(function() {
$('#use_other_db').slideDown(250)
$('#use_oracle_db').slideUp(250)
$('#sqliteInformation').hide()
$('#dbname').attr('pattern', '[0-9a-zA-Z$_-]+')
})
$('#oci').click(function() {
$('#use_other_db').slideDown(250)
$('#use_oracle_db').show(250)
$('#sqliteInformation').hide()
$('#dbname').attr('pattern', '[0-9a-zA-Z$_-.]+')
})
$('#showAdvanced').click(function(e) {
e.preventDefault()
$('#datadirContent').slideToggle(250)
$('#databaseBackend').slideToggle(250)
$('#databaseField').slideToggle(250)
})
$('form').submit(function() {
// Save form parameters
const post = $(this).serializeArray()
// Show spinner while finishing setup
$('.float-spinner').show(250)
// Disable inputs
$(':submit', this).attr('disabled', 'disabled').val($(':submit', this).data('finishing'))
$('input', this).addClass('ui-state-disabled').attr('disabled', 'disabled')
// only disable buttons if they are present
if ($('#selectDbType').find('.ui-button').length > 0) {
$('#selectDbType').buttonset('disable')
}
$('.strengthify-wrapper, .tipsy')
.css('-ms-filter', '"progid:DXImageTransform.Microsoft.Alpha(Opacity=30)"')
.css('filter', 'alpha(opacity=30)')
.css('opacity', 0.3)
// Create the form
const form = $('<form>')
form.attr('action', $(this).attr('action'))
form.attr('method', 'POST')
for (let i = 0; i < post.length; i++) {
const input = $('<input type="hidden">')
input.attr(post[i])
form.append(input)
}
// Add redirect_url
const redirectURL = getURLParameter('redirect_url')
if (redirectURL) {
const redirectURLInput = $('<input type="hidden">')
redirectURLInput.attr({
name: 'redirect_url',
value: redirectURL,
})
form.append(redirectURLInput)
}
// Submit the form
form.appendTo(document.body)
form.submit()
return false
})
// Expand latest db settings if page was reloaded on error
const currentDbType = $('input[type="radio"]:checked').val()
if (currentDbType === undefined) {
$('input[type="radio"]').first().click()
}
if (
currentDbType === 'sqlite'
|| (dbtypes.sqlite && currentDbType === undefined)
) {
$('#datadirContent').hide(250)
$('#databaseBackend').hide(250)
$('#databaseField').hide(250)
$('.float-spinner').hide(250)
}
$('#adminpass').strengthify({
zxcvbn: OC.linkTo('core', 'vendor/zxcvbn/dist/zxcvbn.js'),
titles: [
t('core', 'Very weak password'),
t('core', 'Weak password'),
t('core', 'So-so password'),
t('core', 'Good password'),
t('core', 'Strong password'),
],
drawTitles: true,
nonce: btoa(getToken()),
})
})

View File

@ -1,6 +1,6 @@
<?php <?php
script('core', [ script('core', [
'installation' 'dist/install'
]); ]);
?> ?>
<input type='hidden' id='hasMySQL' value='<?php p($_['hasMySQL']) ?>'> <input type='hidden' id='hasMySQL' value='<?php p($_['hasMySQL']) ?>'>

View File

@ -8,6 +8,7 @@ module.exports = [
main: path.join(__dirname, 'src/main.js'), main: path.join(__dirname, 'src/main.js'),
maintenance: path.join(__dirname, 'src/maintenance.js'), maintenance: path.join(__dirname, 'src/maintenance.js'),
recommendedapps: path.join(__dirname, 'src/recommendedapps.js'), recommendedapps: path.join(__dirname, 'src/recommendedapps.js'),
install: path.join(__dirname, 'src/install.js')
}, },
output: { output: {
filename: '[name].js', filename: '[name].js',

View File

@ -109,16 +109,18 @@ class OC_Template extends \OC\Template\Base {
OC_Util::addScript ( 'backgroundjobs', null, true ); OC_Util::addScript ( 'backgroundjobs', null, true );
} }
} }
OC_Util::addStyle('css-variables', null, true); OC_Util::addStyle('css-variables', null, true);
OC_Util::addStyle('server', null, true); OC_Util::addStyle('server', null, true);
OC_Util::addTranslations("core", null, true); OC_Util::addTranslations('core', null, true);
if (\OC::$server->getSystemConfig()->getValue ('installed', false)) {
OC_Util::addStyle('search', 'results'); OC_Util::addStyle('search', 'results');
OC_Util::addScript('search', 'search', true); OC_Util::addScript('search', 'search', true);
OC_Util::addScript('search', 'searchprovider'); OC_Util::addScript('search', 'searchprovider');
OC_Util::addScript('merged-template-prepend', null, true); OC_Util::addScript('merged-template-prepend', null, true);
OC_Util::addScript('files/fileinfo'); OC_Util::addScript('files/fileinfo');
OC_Util::addScript('files/client'); OC_Util::addScript('files/client');
}
OC_Util::addScript('core', 'dist/main', true); OC_Util::addScript('core', 'dist/main', true);
if (\OC::$server->getRequest()->isUserAgent([\OC\AppFramework\Http\Request::USER_AGENT_IE])) { if (\OC::$server->getRequest()->isUserAgent([\OC\AppFramework\Http\Request::USER_AGENT_IE])) {

5
package-lock.json generated
View File

@ -6651,6 +6651,11 @@
"resolved": "https://registry.npmjs.org/jquery-migrate/-/jquery-migrate-1.4.1.tgz", "resolved": "https://registry.npmjs.org/jquery-migrate/-/jquery-migrate-1.4.1.tgz",
"integrity": "sha1-hRUvPsmalWJfT30Lz2LpuGOPWnY=" "integrity": "sha1-hRUvPsmalWJfT30Lz2LpuGOPWnY="
}, },
"jquery-ui": {
"version": "1.12.1",
"resolved": "https://registry.npmjs.org/jquery-ui/-/jquery-ui-1.12.1.tgz",
"integrity": "sha1-vLQEXI3QU5wTS8FIjN0+dop6nlE="
},
"jquery-ui-dist": { "jquery-ui-dist": {
"version": "1.12.1", "version": "1.12.1",
"resolved": "https://registry.npmjs.org/jquery-ui-dist/-/jquery-ui-dist-1.12.1.tgz", "resolved": "https://registry.npmjs.org/jquery-ui-dist/-/jquery-ui-dist-1.12.1.tgz",

View File

@ -51,6 +51,7 @@
"jcrop": "git+https://github.com/ChristophWurst/Jcrop.git#v0.9.12-npm3", "jcrop": "git+https://github.com/ChristophWurst/Jcrop.git#v0.9.12-npm3",
"jquery": "2.1.4", "jquery": "2.1.4",
"jquery-migrate": "^1.4.1", "jquery-migrate": "^1.4.1",
"jquery-ui": "^1.12.1",
"jquery-ui-dist": "^1.12.1", "jquery-ui-dist": "^1.12.1",
"jstimezonedetect": "^1.0.7", "jstimezonedetect": "^1.0.7",
"lodash": "^4.17.15", "lodash": "^4.17.15",