Skip to content

Commit

Permalink
Add BottlesDevs repository
Browse files Browse the repository at this point in the history
Add Runtime (Ubuntu 20.04 libs)
  • Loading branch information
hitman249 committed Jun 9, 2023
1 parent 84c1b1f commit 6ab0ed0
Show file tree
Hide file tree
Showing 12 changed files with 345 additions and 18 deletions.
20 changes: 19 additions & 1 deletion src/src/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,8 @@ import WineRunnerSc from "./modules/repositories/wine-runner-sc";
import ProtonTKG from "./modules/repositories/proton-tkg";
import ProtonTkgGardotd426 from "./modules/repositories/proton-tkg-gardotd426";
import Steam from "./modules/repositories/steam";
import BottlesDevs from "./modules/repositories/bottlesdevs";
import Runtime from "./modules/repositories/runtime";
import MediaFoundation from "./modules/media-foundation";
import Errors from "./helpers/errors";
import Cache from "./modules/cache";
Expand Down Expand Up @@ -76,6 +78,8 @@ class App {
WINE_RUNNER_SC = new WineRunnerSc(this.APP_FOLDERS, this.FILE_SYSTEM, this.NETWORK);
PROTON_TKG = new ProtonTKG(this.APP_FOLDERS, this.FILE_SYSTEM, this.NETWORK);
PROTON_TKG_GARDOTD426 = new ProtonTkgGardotd426(this.APP_FOLDERS, this.FILE_SYSTEM, this.NETWORK);
BOTTLES_DEVS = new BottlesDevs(this.APP_FOLDERS, this.FILE_SYSTEM, this.NETWORK);
RUNTIME = new Runtime(this.APP_FOLDERS, this.FILE_SYSTEM, this.NETWORK);
STEAM = new Steam(this.APP_FOLDERS, this.FILE_SYSTEM, this.NETWORK, this.SYSTEM);
DRIVER = new Driver(this.COMMAND, this.SYSTEM, this.FILE_SYSTEM);
MONITOR = new Monitor(this.APP_FOLDERS, this.PREFIX, this.COMMAND, this.SYSTEM, this.FILE_SYSTEM);
Expand All @@ -91,7 +95,7 @@ class App {
MANGO_HUD = new MangoHud(this.APP_FOLDERS, this.PREFIX, this.FILE_SYSTEM, this.NETWORK);
VK_BASALT = new VkBasalt(this.APP_FOLDERS, this.PREFIX, this.FILE_SYSTEM, this.NETWORK);
FIXES = new Fixes(this.PREFIX);
WINE_PREFIX = new WinePrefix(this.APP_FOLDERS, this.PREFIX, this.CONFIG, this.SYSTEM, this.FILE_SYSTEM, this.REPLACES, this.REGISTRY, this.PATCHES, this.DXVK, this.FIXES, this.MF, this.VKD3D_PROTON, this.UPDATE);
WINE_PREFIX = new WinePrefix(this.APP_FOLDERS, this.PREFIX, this.CONFIG, this.SYSTEM, this.FILE_SYSTEM, this.REPLACES, this.REGISTRY, this.PATCHES, this.DXVK, this.FIXES, this.MF, this.VKD3D_PROTON, this.UPDATE, this.RUNTIME);
DIAGNOSTICS = new Diagnostics(this.APP_FOLDERS, this.COMMAND, this.SYSTEM, this.FILE_SYSTEM);
MOUNT_WINE = new Mount(this.APP_FOLDERS, this.COMMAND, this.FILE_SYSTEM, this.UPDATE, this.SYSTEM, this.APP_FOLDERS.getWineDir());
MOUNT_DATA = new Mount(this.APP_FOLDERS, this.COMMAND, this.FILE_SYSTEM, this.UPDATE, this.SYSTEM, this.APP_FOLDERS.getGamesDir());
Expand Down Expand Up @@ -456,6 +460,20 @@ class App {
return this.PROTON_TKG_GARDOTD426;
}

/**
* @return {BottlesDevs}
*/
getBottlesDevs() {
return this.BOTTLES_DEVS;
}

/**
* @return {Runtime}
*/
getRuntime() {
return this.RUNTIME;
}

/**
* @return {Steam}
*/
Expand Down
8 changes: 8 additions & 0 deletions src/src/components/Prefix/PopupEditPrefix.vue
Original file line number Diff line number Diff line change
Expand Up @@ -364,6 +364,14 @@ export default {
type: 'bool',
required: false,
},
'libs.runtime.install': {
tab: 'libs',
name: 'Runtime',
description_title: '',
description: this.$t('prefix.form-prefix.runtime-desc'),
type: 'bool',
required: false,
},
'fixes-form': {
tab: 'fixes',
Expand Down
1 change: 1 addition & 0 deletions src/src/components/Prefix/PopupWine.vue
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ export default {
window.app.getKron4ek().getElement(),
window.app.getPlayOnLinux().getElement(),
window.app.getLutris().getElement(),
window.app.getBottlesDevs().getElement(),
window.app.getWineGE().getElement(),
window.app.getProtonGE().getElement(),
window.app.getProtonTKG().getElement(),
Expand Down
1 change: 1 addition & 0 deletions src/src/locales/en.js
Original file line number Diff line number Diff line change
Expand Up @@ -231,6 +231,7 @@ export default {
'mangohud-desc': 'Beautiful HUD to display FPS\n[F12] - Show / Hide',
'mf-desc': 'Multimedia framework (x86_64 only prefix)',
'vkbasalt-desc': 'Texture Improvement in Vulkan Games\n[HOME] - Enable / Disable',
'runtime-desc': 'This is a set of libraries from Ubuntu 20.04 to ensure wine compatibility',
'mono': 'Disable installation of .NET Framework compatible counterpart',
'gecko': 'Disable installation of the Gecko browser engine (needed to emulate IE WebView inside Wine)',
'gstreamer': 'Disable winegstreamer (helps in cases where the prefix creation process hangs)',
Expand Down
1 change: 1 addition & 0 deletions src/src/locales/ru.js
Original file line number Diff line number Diff line change
Expand Up @@ -231,6 +231,7 @@ export default {
'mangohud-desc': 'Красивый HUD для отображения FPS.\n[F12] - Показать/скрыть',
'mf-desc': 'Мультимедийный фреймворк (только для x86_64 префикса)',
'vkbasalt-desc': 'Улучшение текстур в Vulkan играх.\n[HOME] - Включить/отключить',
'runtime-desc': 'This is a set of librarires from Ubuntu 20.04 to ensure wine compatibility',
'mono': 'Отключить установку совместимого с .NET Framework аналога',
'gecko': 'Отключить установку браузерного движка Gecko (нужен для эмуляции IE WebView внутри Wine)',
'gstreamer': 'Отключить winegstreamer (помогает в случаях зависания процесса создания префикса)',
Expand Down
41 changes: 26 additions & 15 deletions src/src/modules/file-system.js
Original file line number Diff line number Diff line change
Expand Up @@ -532,9 +532,10 @@ export default class FileSystem {
* @param {string} type
* @param {string} glob
* @param {string} archiver
* @param {boolean} simple
* @return {boolean}
*/
unpackXz(inFile, outDir, type = 'xf', glob = '', archiver = 'tar') {
unpackXz(inFile, outDir, type = 'xf', glob = '', archiver = 'tar', simple = false) {
if (!this.exists(inFile) || this.isDirectory(inFile)) {
return false;
}
Expand All @@ -557,6 +558,11 @@ export default class FileSystem {
this.exec(`cd "${tmpDir}" && ${archiver} ${type} "./${fileName}"`);
this.rm(mvFile);

if (simple) {
this.mv(tmpDir, outDir);
return true;
}

let finds = this.glob(`${tmpDir}/*`).filter(path => this.exists(`${path}/bin`) || this.exists(`${path}/proton`));

if (finds.length === 0) {
Expand Down Expand Up @@ -627,59 +633,64 @@ export default class FileSystem {
/**
* @param {string} inFile
* @param {string} outDir
* @param {boolean} simple
* @return {boolean}
*/
unpackGz(inFile, outDir) {
return this.unpackXz(inFile, outDir, '-xzf');
unpackGz(inFile, outDir, simple = false) {
return this.unpackXz(inFile, outDir, '-xzf', '', 'tar', simple);
}

/**
* @param {string} inFile
* @param {string} outDir
* @param {boolean} simple
* @return {boolean}
*/
unpackPol(inFile, outDir) {
return this.unpackXz(inFile, outDir, '-xjf', 'wineversion/');
unpackPol(inFile, outDir, simple = false) {
return this.unpackXz(inFile, outDir, '-xjf', 'wineversion/', 'tar', simple);
}

/**
* @param {string} inFile
* @param {string} outDir
* @param {boolean} simple
* @return {boolean}
*/
unpackRar(inFile, outDir) {
return this.unpackXz(inFile, outDir, 'x', '', 'unrar');
unpackRar(inFile, outDir, simple = false) {
return this.unpackXz(inFile, outDir, 'x', '', 'unrar', simple);
}

/**
* @param {string} inFile
* @param {string} outDir
* @param {boolean} simple
* @return {boolean}
*/
unpackZip(inFile, outDir) {
return this.unpackXz(inFile, outDir, '', '', 'unzip');
unpackZip(inFile, outDir, simple = false) {
return this.unpackXz(inFile, outDir, '', '', 'unzip', simple);
}

/**
* @param {string} inFile
* @param {string} outDir
* @param {boolean} simple
* @return {boolean}
*/
unpack(inFile, outDir) {
unpack(inFile, outDir, simple = false) {
if (_.endsWith(inFile, '.tar.xz')) {
return this.unpackXz(inFile, outDir);
return this.unpackXz(inFile, outDir, simple);
}
if (_.endsWith(inFile, '.tar.gz') || _.endsWith(inFile, '.tgz')) {
return this.unpackGz(inFile, outDir);
return this.unpackGz(inFile, outDir, simple);
}
if (_.endsWith(inFile, '.pol')) {
return this.unpackPol(inFile, outDir);
return this.unpackPol(inFile, outDir, simple);
}
if (_.endsWith(inFile, '.exe') || _.endsWith(inFile, '.rar')) {
return this.unpackRar(inFile, outDir);
return this.unpackRar(inFile, outDir, simple);
}
if (_.endsWith(inFile, '.zip')) {
return this.unpackZip(inFile, outDir);
return this.unpackZip(inFile, outDir, simple);
}

return false;
Expand Down
7 changes: 7 additions & 0 deletions src/src/modules/prefix.js
Original file line number Diff line number Diff line change
Expand Up @@ -346,6 +346,13 @@ export default class Prefix {
return Boolean(_.get(this.config, 'libs.vkbasalt.install', false));
}

/**
* @return {boolean}
*/
isRuntime() {
return Boolean(_.get(this.config, 'libs.runtime.install', false));
}

/**
* @return {string}
*/
Expand Down
95 changes: 95 additions & 0 deletions src/src/modules/repositories/bottlesdevs.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,95 @@
import AppFolders from "../app-folders";
import FileSystem from "../file-system";
import Network from "../network";
import Utils from "../utils";

export default class BottlesDevs {
/**
* @type {string}
*/
url = 'https://api.github.com/repos/bottlesdevs/wine/releases';

data = null;

/**
* @type {AppFolders}
*/
appFolders = null;

/**
* @type {FileSystem}
*/
fs = null;

/**
* @type {Network}
*/
network = null;

/**
* @param {AppFolders} appFolders
* @param {FileSystem} fs
* @param {Network} network
*/
constructor(appFolders, fs, network) {
this.appFolders = appFolders;
this.fs = fs;
this.network = network;
}

/**
* @return {{name: string, type: string, nested: (function(): Promise)}}
*/
getElement() {
return {
name: 'Bottles Devs',
type: 'dir',
nested: () => this.getList(),
};
}

/**
* @return {Promise}
*/
getList() {
let promise = Promise.resolve();

if (null === this.data) {
promise = this.network.getJSON(this.url).then((data) => {
const names = data.map((item) => (item.name || item.tag_name));
const sortNames = Utils.natsort(names.slice(), true);

this.data = sortNames.map((name) => {
const index = names.indexOf(name);

if (-1 !== index) {
const item = data[index];

return ({
name: item.name || item.tag_name,
type: 'file',
download: () => {
let asset = Utils.findAssetArchive(item.assets);
let url = asset.browser_download_url;
return this.download(url);
},
})
}
});
});
}

return promise.then(() => this.data);
}

/**
* @param {string} url
* @return Promise<string>
*/
download(url) {
let cacheDir = this.appFolders.getCacheDir();
let filename = this.fs.basename(url);

return this.network.download(url, `${cacheDir}/${filename}`).then(() => filename);
}
}
Loading

0 comments on commit 6ab0ed0

Please sign in to comment.