Skip to content

Commit

Permalink
Add files via upload
Browse files Browse the repository at this point in the history
  • Loading branch information
Extravi authored May 5, 2024
1 parent 5457d80 commit d6a4585
Show file tree
Hide file tree
Showing 7 changed files with 174 additions and 4 deletions.
42 changes: 42 additions & 0 deletions installer/bloxshade/dist/assets/index-BFVUHZ5g.js

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions installer/bloxshade/dist/assets/index-DVAdU4LS.css

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions installer/bloxshade/dist/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
<link rel="icon" type="image/svg+xml" href="/vite.svg" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Vite + React + TS</title>
<script type="module" crossorigin src="/assets/index-BEUZOzOK.js"></script>
<link rel="stylesheet" crossorigin href="/assets/index-BJe5nD8y.css">
<script type="module" crossorigin src="/assets/index-BFVUHZ5g.js"></script>
<link rel="stylesheet" crossorigin href="/assets/index-DVAdU4LS.css">
</head>
<body>
<div id="root"></div>
Expand Down
2 changes: 1 addition & 1 deletion installer/bloxshade/src-tauri/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ fn cmd(executable_path: String, arguments: String) {
println!("Executing command: {} {}", executable_path, arguments);

let child = Command::new(&executable_path)
.arg(&arguments)
.args(&arguments.split_whitespace().collect::<Vec<&str>>())
.spawn()
.expect("failed to start installer");
}
Expand Down
54 changes: 53 additions & 1 deletion installer/bloxshade/src/App.tsx
Original file line number Diff line number Diff line change
@@ -1,9 +1,33 @@
import { useEffect, useState } from 'react';
import { open } from '@tauri-apps/api/shell';
import { fs } from '@tauri-apps/api';
import { invoke } from '@tauri-apps/api/tauri';
import './script.js';

interface Preset {
title: string;
description: string;
author: string;
source: string;
}

function App() {
const [presets, setPresets] = useState<Preset[]>([]);

useEffect(() => {
fetchPresets();
}, []);

const fetchPresets = async () => {
try {
const response = await fetch('https://extravi.dev/update/presets.json');
const data = await response.json();
setPresets(data.presets);
} catch (error) {
console.error('Error fetching presets:', error);
}
};

const openLink = async (url: string) => {
try {
await open(url);
Expand Down Expand Up @@ -62,7 +86,7 @@ function App() {

// done installing go to last page
const element1: HTMLElement | null = document.getElementById("con-1");
const element2: HTMLElement | null = document.getElementById("con-2");
const element2: HTMLElement | null = document.getElementById("con-4");

if (element1 && element2) {
element1.classList.remove("show");
Expand Down Expand Up @@ -146,6 +170,17 @@ function App() {
}
}

const userPreset = async (source: string) => {
const bloxshadeFolderPath = 'C:\\Program Files\\Bloxshade';
try {
console.log(source);
// todo
invoke('cmd', { executable_path: `${bloxshadeFolderPath}\\installer.exe`, arguments: `-install "${source}"` });
} catch (error) {
console.error(error);
}
};

return (
<>
<div className="side-img"></div>
Expand Down Expand Up @@ -231,6 +266,23 @@ function App() {
<a className="settings-settings extravi" onClick={() => openLink('https://extravi.dev/')}>extravi.dev</a>
<a id="uwu" className="settings-settings uwu">Back</a>
</div>
{/* content 4 */}
<div id="con-4" className="content hide">
<h1>Community presets</h1>
<p className="c-settings">Download and install community presets</p>
<div className='results'>
{presets.map((preset, index) => (
<div key={index} className={index === 0 ? 'results-div-1' : 'results-div'}>
<div className='results-row'>
<p><span>{preset.title}</span></p>
<p><span>{preset.description}</span></p>
<p><span className="highlight">Author: </span><span>{preset.author}</span><a className='uwu-rar' onClick={() => userPreset(preset.source)}>Install</a></p>
</div>
</div>
))}
</div>
<button id="userPresets" className="btn btn-p">Next</button>
</div>
</>
)
}
Expand Down
61 changes: 61 additions & 0 deletions installer/bloxshade/src/index.css
Original file line number Diff line number Diff line change
Expand Up @@ -165,6 +165,16 @@ a:hover {
margin-top: 6px;
}

.highlight {
color: var(--highlight);
font-weight: 700;
font-style: normal;
}

.c-settings {
margin-top: -6px;
}

.settings-settings {
margin-top: 5px;
float: right;
Expand All @@ -185,4 +195,55 @@ a:hover {

.show {
display: block;
}

.results-row {
padding: 0px;
margin: 0px;
width: 100%;
}

.results-row p {
padding: 0px;
margin: 0px;
margin-bottom: 4px;
max-width: 300px;
}

.results-div {
border-bottom: 1px solid #363a3c;
padding-left: 12px;
padding-bottom: 4px;
padding-top: 4px;
width: 200% !important;
margin-left: -12px;
}

.results-div-1 {
border-top: 1px solid #363a3c;
border-bottom: 1px solid #363a3c;
padding-left: 12px;
padding-bottom: 4px;
padding-top: 4px;
width: 200% !important;
margin-left: -12px;
}

.results {
background-color: #1f1f1f;
height: 230px;
width: 300px;
max-height: 300px;
overflow-x: hidden;
overflow-y: auto;
}

.btn-p {
margin-top: 12px;
margin-right: 0px;
}

.uwu-rar {
float: right;
margin-right: 20px;
}
14 changes: 14 additions & 0 deletions installer/bloxshade/src/script.js
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,20 @@ document.addEventListener("DOMContentLoaded", function () {
});
});

// wait for user presets
waitForElementToExist("userPresets", function () {
document.getElementById("userPresets").addEventListener("click", function () {
var element0 = document.getElementById("con-4");
var element1 = document.getElementById("con-2");

element0.classList.remove("show");
element0.classList.add("hide");

element1.classList.remove("hide");
element1.classList.add("show");
});
});

// wait for checkbox
waitForElementToExist("box-0", function () {
document.getElementById("box-0").checked = true;
Expand Down

0 comments on commit d6a4585

Please sign in to comment.