Skip to content

Commit 9c4863d

Browse files
authored
Merge pull request #14 from Shikakiben/test
Test
2 parents d0bdd3d + 0e471cc commit 9c4863d

File tree

10 files changed

+539
-11
lines changed

10 files changed

+539
-11
lines changed

.github/workflows/appimage.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ concurrency:
55
on:
66
push:
77
branches:
8-
- build
8+
- main
99
schedule:
1010
- cron: "0 7 1/21 * *" # We default to rebuilding every 21 days, change this to your liking
1111
workflow_dispatch: {}

AM-INSTALLER

Lines changed: 106 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,106 @@
1+
#!/bin/sh
2+
3+
set -e
4+
5+
# Colors
6+
RED='\033[0;31m'; LightBlue='\033[1;34m'; Green='\033[0;32m'
7+
8+
# For developers
9+
AM_BRANCH="main"
10+
11+
# Check dependencies for this script
12+
_check_dependency() {
13+
AMDEPENDENCES="chmod chown curl grep wget"
14+
for dependency in $AMDEPENDENCES; do
15+
if ! command -v "$dependency" >/dev/null 2>&1; then
16+
printf "\n %b💀 ERROR! MISSING ESSENTIAL COMMAND \033[0m: %b\n\n Install the above and try again! \n\n" "${RED}" "$dependency"
17+
exit 1
18+
fi
19+
done
20+
}
21+
22+
_check_dependency
23+
24+
# Function to check online connections (uses github.com by default, as the database and CLI itself are stored/hosted there)
25+
_online_check() {
26+
if ! wget -q --tries=3 --timeout=10 --spider https://github.com; then
27+
printf "\n Installer wouldn't work offline\n\n Please check your internet connection and try again\n\n"
28+
exit 1
29+
fi
30+
}
31+
32+
_online_check
33+
34+
# INSTALL "AM" SYSTEM-WIDE
35+
_install_am() {
36+
CACHEDIR="${XDG_CACHE_HOME:-$HOME/.cache}"
37+
mkdir -p "$CACHEDIR" || true
38+
rm -f "$CACHEDIR"/INSTALL-AM.sh || true
39+
wget -q "https://raw.githubusercontent.com/ivan-hc/AM/$AM_BRANCH/INSTALL" -O "$CACHEDIR"/INSTALL-AM.sh && chmod a+x "$CACHEDIR"/INSTALL-AM.sh
40+
#cp ./INSTALL "$CACHEDIR"/INSTALL-AM.sh && chmod a+x "$CACHEDIR"/INSTALL-AM.sh # for developers
41+
if command -v sudo >/dev/null 2>&1; then
42+
SUDOCMD="sudo"
43+
elif command -v doas >/dev/null 2>&1; then
44+
SUDOCMD="doas"
45+
else
46+
echo 'ERROR: No sudo or doas found'
47+
exit 1
48+
fi
49+
$SUDOCMD "$CACHEDIR"/INSTALL-AM.sh && rm -f "$CACHEDIR"/INSTALL-AM.sh
50+
}
51+
52+
# INSTALL "AM" LOCALLY, AS "APPMAN"
53+
_install_appman() {
54+
ZSHRC="${ZDOTDIR:-$HOME}/.zshrc"
55+
BINDIR="${XDG_BIN_HOME:-$HOME/.local/bin}"
56+
mkdir -p "$BINDIR"
57+
if ! echo $PATH | grep "$BINDIR" >/dev/null 2>&1; then
58+
echo '--------------------------------------------------------------------------'
59+
echo " Adding $BINDIR to PATH, you might need to"
60+
echo " close and reopen the terminal for this to take effect."
61+
if [ -e ~/.bashrc ] && ! grep 'PATH="$PATH:$BINDIR"' ~/.bashrc >/dev/null 2>&1; then
62+
printf '\n%s\n' 'BINDIR="${XDG_BIN_HOME:-$HOME/.local/bin}"' >> ~/.bashrc
63+
printf '\n%s\n' 'if ! echo $PATH | grep "$BINDIR" >/dev/null 2>&1; then' >> ~/.bashrc
64+
printf ' export PATH="$PATH:$BINDIR"\nfi\n' >> ~/.bashrc
65+
fi
66+
if [ -e "$ZSHRC" ] && ! grep 'PATH="$PATH:$BINDIR"' "$ZSHRC" >/dev/null 2>&1; then
67+
printf '\n%s\n' 'BINDIR="${XDG_BIN_HOME:-$HOME/.local/bin}"' >> "$ZSHRC"
68+
printf '\n%s\n' 'if ! echo $PATH | grep "$BINDIR" >/dev/null 2>&1; then' >> "$ZSHRC"
69+
printf ' export PATH="$PATH:$BINDIR"\nfi\n' >> "$ZSHRC"
70+
fi
71+
fi
72+
wget -q "https://raw.githubusercontent.com/ivan-hc/AM/$AM_BRANCH/APP-MANAGER" -O "$BINDIR"/appman && chmod a+x "$BINDIR"/appman
73+
}
74+
75+
# CHOOSE BETWEEN "AM" AND "APPMAN"
76+
printf " Choose how to install \"AM\" and all its managed applications.
77+
78+
1) As \"${RED}AM\033[0m\", command \"${Green}am\033[0m\", this is a system-wide installation:
79+
- the command is a symlink /usr/local/bin/am for /opt/am/APP-MANAGER
80+
- install and manage both system (default, require \"root\") and local apps
81+
- choose wherever you want to install local apps
82+
- you are the one with read-write permissions for \"AM\" and system programs
83+
- other users can only use programs you have installed, nothing else
84+
- other users can still use \"AppMan mode\" for their rootless configurations
85+
86+
2) As \"${LightBlue}AppMan\033[0m\", command \"${Green}appman\033[0m\", local installation:
87+
- the command is the script ~/.local/bin/appman
88+
- install and manage only local apps
89+
- choose wherever you want to install local apps
90+
- you can replicate your configurations on every system you want
91+
- more storage space required, if more users use \"AppMan\"
92+
93+
"
94+
read -r -p "Choose between \"AM\" (type 1) and \"AppMan\" (2), or leave blank to exit: " response
95+
case "$response" in
96+
1) _install_am || exit 1
97+
;;
98+
2) _install_appman || exit 1
99+
echo '--------------------------------------------------------------------------'
100+
printf " ${Green}\"AppMan\" has been successfully installed!\033[0m\n"
101+
printf " Please, run \"${LightBlue}appman -h\033[0m\" to see the list of the options.\n"
102+
echo '--------------------------------------------------------------------------'
103+
;;
104+
''|*) echo "Installation aborted, exiting." && exit 1
105+
;;
106+
esac

index.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -181,6 +181,7 @@ <h2 class="panel-heading-sm centered" data-i18n="advanced.title">Mode avancé</h
181181
</section>
182182

183183

184+
<div id="featuredBanner" class="featured-banner" aria-hidden="false"></div>
184185
<div id="apps" class="app-list" aria-live="polite" aria-busy="true"></div>
185186
<section id="appDetails" class="app-details" hidden>
186187
<button id="backToListBtn" class="btn btn-outline back-btn" data-i18n="details.back">← Retour</button>
@@ -354,8 +355,7 @@ <h3 id="nonAppimageTitle" class="modal-title" data-i18n="sandbox.unsupported.tit
354355
<script src="src/renderer/features/categories/dropdown.js"></script>
355356
<script src="src/renderer/features/categories/index.js"></script>
356357
<script src="src/renderer/features/search/index.js"></script>
357-
<script src="src/renderer/features/details/index.js"></script>
358-
<script src="src/renderer/ui/syncButton.js"></script>
358+
<script src="src/renderer/features/details/index.js"></script> <script src="src/renderer/features/featured/index.js"></script> <script src="src/renderer/ui/syncButton.js"></script>
359359
<script src="src/renderer/renderer.js"></script>
360360
<!-- Modale choix installation multiple -->
361361
<div id="multiChoiceModal" class="modal" role="dialog" aria-modal="true" aria-label="Choix d'installation" hidden>

scripts/make-appimage.sh

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,8 @@ export UPINFO="gh-releases-zsync|${GITHUB_REPOSITORY%/*}|${GITHUB_REPOSITORY#*/}
1111

1212
# Deploy dependencies
1313
quick-sharun \
14-
./AppDir/bin/start-am-gui.sh
14+
./AppDir/bin/start-am-gui.sh \
15+
./AppDir/node_modules/node-pty/build/Release/pty.node
1516

1617
# Additional changes can be done in between here
1718

src/renderer/app/init.js

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,12 +28,13 @@
2828
errorHandlersInstalled = true;
2929
window.addEventListener('error', (ev) => {
3030
const toast = document.getElementById('toast');
31+
const location = ev.filename ? ` at ${ev.filename}:${ev.lineno || 0}:${ev.colno || 0}` : '';
3132
if (toast) {
3233
toast.hidden = false;
33-
toast.textContent = 'Erreur: ' + ev.message;
34-
setTimeout(() => { toast.hidden = true; }, 5000);
34+
toast.textContent = 'Erreur: ' + ev.message + (location ? (' ' + location) : '');
35+
setTimeout(() => { toast.hidden = true; }, 8000);
3536
}
36-
console.error('Erreur globale', ev.error || ev.message);
37+
console.error('Erreur globale', ev.error || ev.message, location, ev.error && ev.error.stack ? ev.error.stack : '');
3738
});
3839

3940
window.addEventListener('unhandledrejection', (ev) => {

src/renderer/features/categories/dropdown.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -182,6 +182,8 @@
182182
apps: detailedApps,
183183
toastMessage: `Catégorie "${name}" : ${filteredApps.length} apps`
184184
});
185+
// notify other parts (renderer) that a custom category was activated so they can refresh UI such as featured
186+
try { document.dispatchEvent(new CustomEvent('category.override', { detail: { name, count: detailedApps.length } })); } catch(_) {}
185187
}, iconMap);
186188
categoriesDropdownMenu.appendChild(btn);
187189
});

0 commit comments

Comments
 (0)