Add git disclaimer to asset downloader
This commit is contained in:
parent
410599b287
commit
0c36d113bf
|
@ -733,8 +733,9 @@ export async function installExtension(url) {
|
|||
});
|
||||
|
||||
if (!request.ok) {
|
||||
toastr.info(request.statusText, 'Extension installation failed');
|
||||
console.error('Extension installation failed', request.status, request.statusText);
|
||||
const text = await request.text();
|
||||
toastr.warning(text || request.statusText, 'Extension installation failed', { timeOut: 5000 });
|
||||
console.error('Extension installation failed', request.status, request.statusText, text);
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
|
@ -55,6 +55,14 @@ function downloadAssetsList(url) {
|
|||
for (const assetType of assetTypes) {
|
||||
let assetTypeMenu = $('<div />', { id: "assets_audio_ambient_div", class: "assets-list-div" });
|
||||
assetTypeMenu.append(`<h3>${assetType}</h3>`)
|
||||
|
||||
if (assetType == 'extension') {
|
||||
assetTypeMenu.append(`
|
||||
<div class="assets-list-git">
|
||||
To download extensions from this page, you need to have <a href="https://git-scm.com/downloads" target="_blank">Git</a> installed.
|
||||
</div>`);
|
||||
}
|
||||
|
||||
for (const i in availableAssets[assetType]) {
|
||||
const asset = availableAssets[assetType][i];
|
||||
const elemId = `assets_install_${assetType}_${i}`;
|
||||
|
|
|
@ -13,11 +13,17 @@
|
|||
padding: 5px;
|
||||
}
|
||||
|
||||
.assets-list-git {
|
||||
font-size: calc(var(--mainFontSize) * 0.8);
|
||||
opacity: 0.8;
|
||||
margin-bottom: 1em;
|
||||
}
|
||||
|
||||
.assets-list-div h3 {
|
||||
text-transform: capitalize;
|
||||
}
|
||||
|
||||
.assets-list-div a {
|
||||
.assets-list-div i a {
|
||||
color: inherit;
|
||||
}
|
||||
|
||||
|
|
|
@ -2,6 +2,7 @@ const path = require('path');
|
|||
const fs = require('fs');
|
||||
const { default: simpleGit } = require('simple-git');
|
||||
const sanitize = require('sanitize-filename');
|
||||
const commandExistsSync = require('command-exists').sync;
|
||||
const { DIRECTORIES } = require('./constants');
|
||||
|
||||
/**
|
||||
|
@ -61,12 +62,19 @@ function registerEndpoints(app, jsonParser) {
|
|||
* @returns {void}
|
||||
*/
|
||||
app.post('/api/extensions/install', jsonParser, async (request, response) => {
|
||||
const git = simpleGit();
|
||||
const gitExists = commandExistsSync('git');
|
||||
|
||||
if (!gitExists) {
|
||||
return response.status(400).send('Server Error: git is not installed on the system.');
|
||||
}
|
||||
|
||||
if (!request.body.url) {
|
||||
return response.status(400).send('Bad Request: URL is required in the request body.');
|
||||
}
|
||||
|
||||
try {
|
||||
const git = simpleGit();
|
||||
|
||||
// make sure the third-party directory exists
|
||||
if (!fs.existsSync(path.join(DIRECTORIES.extensions, 'third-party'))) {
|
||||
fs.mkdirSync(path.join(DIRECTORIES.extensions, 'third-party'));
|
||||
|
@ -87,7 +95,6 @@ function registerEndpoints(app, jsonParser) {
|
|||
|
||||
|
||||
return response.send({ version, author, display_name, extensionPath });
|
||||
|
||||
} catch (error) {
|
||||
console.log('Importing custom content failed', error);
|
||||
return response.status(500).send(`Server Error: ${error.message}`);
|
||||
|
|
Loading…
Reference in New Issue