mirror of
https://github.com/hydralauncher/hydra.git
synced 2026-01-11 22:06:17 +00:00
Compare commits
2 Commits
fix/fixing
...
fix/HYD-86
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
3928770ef8 | ||
|
|
de1dfca57e |
@@ -4,6 +4,7 @@ from torrent_downloader import TorrentDownloader
|
||||
from http_downloader import HttpDownloader
|
||||
from profile_image_processor import ProfileImageProcessor
|
||||
import libtorrent as lt
|
||||
import os
|
||||
|
||||
app = Flask(__name__)
|
||||
|
||||
@@ -102,8 +103,26 @@ def process_list():
|
||||
if auth_error:
|
||||
return auth_error
|
||||
|
||||
process_list = [proc.info for proc in psutil.process_iter(['exe', 'cwd', 'pid', 'name', 'environ'])]
|
||||
return jsonify(process_list), 200
|
||||
processes = []
|
||||
|
||||
for proc in psutil.process_iter(['exe', 'cwd', 'pid', 'cmdline']):
|
||||
try:
|
||||
info = proc.info
|
||||
cmdline = info.get('cmdline') or []
|
||||
wine_launched_exe = None
|
||||
|
||||
for arg in cmdline:
|
||||
if isinstance(arg, str) and arg.lower().endswith(".exe"):
|
||||
wine_launched_exe = os.path.basename(arg)
|
||||
break
|
||||
|
||||
exe_path = info.get('exe') or ''
|
||||
info['name'] = wine_launched_exe or os.path.basename(exe_path)
|
||||
processes.append(info)
|
||||
except (psutil.NoSuchProcess, psutil.AccessDenied, psutil.ZombieProcess):
|
||||
continue
|
||||
|
||||
return jsonify(processes), 200
|
||||
|
||||
@app.route("/profile-image", methods=["POST"])
|
||||
def profile_image():
|
||||
|
||||
@@ -17,18 +17,30 @@ export interface SteamAppDetailsResponse {
|
||||
};
|
||||
}
|
||||
|
||||
export const getSteamLocation = async () => {
|
||||
export const getSteamLocation = async (): Promise<string> => {
|
||||
const home = SystemPath.getPath("home");
|
||||
|
||||
if (process.platform === "linux") {
|
||||
return path.join(SystemPath.getPath("home"), ".local", "share", "Steam");
|
||||
const candidates = [
|
||||
path.join(home, ".local", "share", "Steam"),
|
||||
path.join(home, ".steam", "steam"),
|
||||
path.join(home, ".steam", "root"),
|
||||
];
|
||||
|
||||
for (const candidate of candidates) {
|
||||
try {
|
||||
fs.accessSync(candidate, fs.constants.F_OK);
|
||||
return candidate;
|
||||
} catch {
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
throw new Error("Steam installation not found on Linux");
|
||||
}
|
||||
|
||||
if (process.platform === "darwin") {
|
||||
return path.join(
|
||||
SystemPath.getPath("home"),
|
||||
"Library",
|
||||
"Application Support",
|
||||
"Steam"
|
||||
);
|
||||
return path.join(home, "Library", "Application Support", "Steam");
|
||||
}
|
||||
|
||||
const regKey = new WinReg({
|
||||
@@ -39,7 +51,7 @@ export const getSteamLocation = async () => {
|
||||
return new Promise<string>((resolve, reject) => {
|
||||
regKey.get("SteamPath", (err, value) => {
|
||||
if (err) {
|
||||
reject(err);
|
||||
return reject(err);
|
||||
}
|
||||
|
||||
resolve(value.value);
|
||||
|
||||
Reference in New Issue
Block a user