This repository has been archived by the owner on Feb 5, 2025. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Update 1.3.1 (Add Freedom Plus Downloader and Runner)
- Loading branch information
Showing
9 changed files
with
324 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -18,3 +18,4 @@ Users.txt | |
configsVibeLink.json | ||
configsVibeName.json | ||
one.one | ||
plus/apps |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
<!DOCTYPE html> | ||
<html lang="en"> | ||
|
||
<head> | ||
<meta charset="UTF-8"> | ||
<meta name="viewport" content="width=device-width, initial-scale=1.0"> | ||
<title>Freedom Plus</title> | ||
<link rel="stylesheet" href="style.css"> | ||
</head> | ||
|
||
<body> | ||
<button id="back">Back To Warp</button> | ||
<div class="container"> | ||
<h1>لیست برنامهها</h1> | ||
<input type="text" id="search" dir="rtl" placeholder="برنامه را جستجو کنید..."> | ||
<div id="apps-list"></div> | ||
</div> | ||
<div id="download-dialog" class="dialog" dir="rtl"> | ||
<div class="dialog-content"> | ||
<h2>دانلود فایلها</h2> | ||
<progress id="download-progress" value="0" max="100"></progress> | ||
<p id="download-status">در حال دانلود...</p> | ||
</div> | ||
</div> | ||
</body> | ||
<script src="script.js"></script> | ||
|
||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
{ | ||
"Calculator": { | ||
"name": "Calculator", | ||
"icon": "https://raw.githubusercontent.com/fwldom/Calculator_Web.github.io/main/icon.png", | ||
"directory":"./apps/Calculator", | ||
"type": "app", | ||
"description": "A simple calculator app", | ||
"version": "1.0.0", | ||
"author": "Fwldom", | ||
"website": "https://github.com/Fwldom/Calculator", | ||
"license": "MIT", | ||
"download":{ | ||
"index.js":"https://raw.githubusercontent.com/fwldom/Calculator_Web.github.io/main/index.js", | ||
"index.html":"https://raw.githubusercontent.com/fwldom/Calculator_Web.github.io/main/index.html", | ||
"style.css":"https://raw.githubusercontent.com/fwldom/Calculator_Web.github.io/main/style.css", | ||
"icon.png":"https://raw.githubusercontent.com/fwldom/Calculator_Web.github.io/main/icon.png" | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,145 @@ | ||
const fs = require('fs'); | ||
const axios = require('axios'); | ||
const path = require('path'); | ||
const ipc = require('electron').ipcRenderer; | ||
__dirname = path.join(__dirname.replace("app.asar")); | ||
|
||
fetch('listapps.json') | ||
.then(response => response.json()) | ||
.then(data => { | ||
const appsList = document.getElementById('apps-list'); | ||
const searchInput = document.getElementById('search'); | ||
|
||
function displayApps(filteredApps) { | ||
appsList.innerHTML = ''; | ||
for (let key in filteredApps) { | ||
const app = filteredApps[key]; | ||
|
||
const appCard = document.createElement('div'); | ||
appCard.classList.add('app-card'); | ||
|
||
appCard.innerHTML = ` | ||
<img src="${app.icon}" alt="${app.name} Icon"> | ||
<h2>${app.name}</h2> | ||
<p>${app.description}</p> | ||
`; | ||
appCard.addEventListener('click', () => { | ||
runApp(app); | ||
}); | ||
|
||
appsList.appendChild(appCard); | ||
} | ||
} | ||
displayApps(data); | ||
searchInput.addEventListener('input', (e) => { | ||
const searchTerm = e.target.value.toLowerCase(); | ||
const filteredApps = Object.keys(data) | ||
.filter(key => data[key].name.toLowerCase().includes(searchTerm)) | ||
.reduce((res, key) => (res[key] = data[key], res), {}); | ||
displayApps(filteredApps); | ||
}); | ||
function runApp(app) { | ||
if (!fs.existsSync(path.join(__dirname, app.directory))) { | ||
fs.mkdirSync(path.join(__dirname, app.directory)); | ||
}; | ||
if (!fs.existsSync(path.join(__dirname, './apps'))) { | ||
fs.mkdirSync(path.join(__dirname, "./apps")); | ||
}; | ||
downloadFiles([ | ||
{ "url": app["download"]["index.html"], "savePath": path.join(__dirname, app.directory, "index.html") }, | ||
{ "url": app["download"]["style.css"], "savePath": path.join(__dirname, app.directory, "style.css") }, | ||
{ "url": app["download"]["icon.png"], "savePath": path.join(__dirname, app.directory, "icon.png") }, | ||
{ "url": app["download"]["index.js"], "savePath": path.join(__dirname, app.directory, "index.js") }, | ||
], app = app) | ||
|
||
} | ||
}) | ||
.catch(error => console.error('Error loading apps:', error)); | ||
|
||
|
||
const downloadDialog = document.getElementById('download-dialog'); | ||
const downloadProgress = document.getElementById('download-progress'); | ||
const downloadStatus = document.getElementById('download-status'); | ||
|
||
function showDownloadDialog() { | ||
downloadDialog.style.display = 'flex'; | ||
} | ||
|
||
function hideDownloadDialog() { | ||
downloadDialog.style.display = 'none'; | ||
} | ||
|
||
async function checkAndDownloadFile(fileUrl, savePath) { | ||
if (fs.existsSync(savePath)) { | ||
console.log(`File already exists at ${savePath}`); | ||
return; | ||
} | ||
|
||
try { | ||
var Xhr = new XMLHttpRequest(); | ||
Xhr.open("GET", fileUrl, true); | ||
Xhr.send(); | ||
Xhr.onreadystatechange = function () { | ||
if (Xhr.readyState == 4 && Xhr.status == 200) { | ||
write_file(savePath, Xhr.response); | ||
console.log(savePath + " Downloaded"); | ||
return; | ||
}; | ||
}; | ||
await sleep(15000); | ||
|
||
} catch (error) { | ||
console.error(`Error downloading file from ${fileUrl}:`, error); | ||
} | ||
}; | ||
async function sleep(time) { | ||
return new Promise((resolve) => setTimeout(resolve, time)); | ||
} | ||
read_file = function (path) { | ||
return fs.readFileSync(path, 'utf8'); | ||
}; | ||
write_file = function (path, output) { | ||
fs.writeFileSync(path, output); | ||
}; | ||
async function downloadFiles(filesToDownload, app) { | ||
showDownloadDialog(); | ||
|
||
let completed = 0; | ||
const totalFiles = filesToDownload.length; | ||
|
||
for (const file of filesToDownload) { | ||
await checkAndDownloadFile(file.url, file.savePath); | ||
completed++; | ||
const progress = (completed / totalFiles) * 100; | ||
downloadProgress.value = progress; | ||
downloadStatus.innerText = `در حال دانلود: ${completed}/${totalFiles} فایل`; | ||
if (!fs.existsSync(file.savePath)) { | ||
alert("Error Download Files Try Again"); | ||
hideDownloadDialog(); | ||
return; | ||
|
||
} | ||
if (completed === totalFiles) { | ||
downloadStatus.innerText = 'دانلود تکمیل شد!'; | ||
setTimeout(() => { | ||
hideDownloadDialog(); | ||
runApp(app); | ||
}, 1000); | ||
} | ||
} | ||
} | ||
function runApp(app) { | ||
if (fs.existsSync(path.join(__dirname, app.directory, "index.html"))) | ||
ipc.send("load-file-plus", path.join(__dirname, app.directory, "index.html")); | ||
else alert("Error RUN APP") | ||
|
||
} | ||
function CloseToPlus() { | ||
try { | ||
ipc.send("load-file", "./index.html"); | ||
} | ||
catch { } | ||
} | ||
document.getElementById("back").addEventListener("click", function () { | ||
CloseToPlus(); | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,122 @@ | ||
body { | ||
font-family: 'Courier New', monospace; | ||
background-color: #121212; | ||
color: #fff; | ||
margin: 0; | ||
padding: 0; | ||
display: flex; | ||
justify-content: center; | ||
align-items: center; | ||
height: 100vh; | ||
} | ||
|
||
.container { | ||
width: 80%; | ||
} | ||
|
||
h1 { | ||
text-align: center; | ||
font-size: 2em; | ||
margin-bottom: 20px; | ||
} | ||
|
||
input[type="text"] { | ||
width: 100%; | ||
padding: 10px; | ||
font-size: 1.2em; | ||
border: none; | ||
margin-bottom: 20px; | ||
background-color: #333; | ||
color: #fff; | ||
outline: none; | ||
} | ||
|
||
#apps-list { | ||
display: flex; | ||
flex-wrap: wrap; | ||
gap: 15px; | ||
justify-content: center; | ||
} | ||
|
||
.app-card { | ||
background-color: #1e1e1e; | ||
padding: 20px; | ||
border-radius: 8px; | ||
width: 200px; | ||
text-align: center; | ||
cursor: pointer; | ||
transition: 0.3s ease; | ||
} | ||
|
||
.app-card:hover { | ||
background-color: #333; | ||
} | ||
|
||
.app-card img { | ||
width: 100px; | ||
height: 100px; | ||
} | ||
|
||
.app-card h2 { | ||
font-size: 1.5em; | ||
margin: 10px 0; | ||
} | ||
|
||
.app-card p { | ||
font-size: 0.9em; | ||
color: #bbb; | ||
} | ||
|
||
.dialog { | ||
display: none; | ||
position: fixed; | ||
top: 0; | ||
left: 0; | ||
width: 100%; | ||
height: 100%; | ||
background-color: rgba(0, 0, 0, 0.8); | ||
justify-content: center; | ||
align-items: center; | ||
} | ||
|
||
.dialog-content { | ||
background-color: #1e1e1e; | ||
padding: 20px; | ||
border-radius: 8px; | ||
text-align: center; | ||
} | ||
|
||
progress { | ||
width: 100%; | ||
height: 20px; | ||
} | ||
|
||
p { | ||
margin-top: 10px; | ||
} | ||
#back { | ||
position: absolute; | ||
left: 10px; | ||
top: 10px; | ||
padding: 10px 20px; | ||
font-size: 1.2em; | ||
font-family: 'Courier New', monospace; | ||
color: #fff; | ||
background-color: #333; | ||
border: none; | ||
border-radius: 5px; | ||
cursor: pointer; | ||
transition: background-color 0.3s ease, transform 0.2s ease; | ||
box-shadow: 0 4px 6px rgba(0, 0, 0, 0.3); | ||
} | ||
|
||
#back:hover { | ||
background-color: #555; | ||
transform: translateY(-2px); | ||
} | ||
|
||
#back:active { | ||
background-color: #111; | ||
transform: translateY(0); | ||
box-shadow: 0 2px 4px rgba(0, 0, 0, 0.4); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters