🔧 chore(app, update): import ags overrides from absolute directory, check if repo is already cloned before cloning
This commit is contained in:
+16
-16
@@ -1,5 +1,5 @@
|
||||
// thanks Aylur!!
|
||||
import "../node_modules/ags/lib/overrides";
|
||||
import "/usr/share/ags/js/lib/overrides";
|
||||
import "./config";
|
||||
import {
|
||||
PluginApps,
|
||||
@@ -210,24 +210,24 @@ you should use the socket in the XDG_RUNTIME_DIR/colorshell.sock for a faster re
|
||||
|
||||
// handle communication via socket
|
||||
createScopedConnection(this.#socketService, "incoming", (conn) => {
|
||||
const inputStream = Gio.DataInputStream.new(conn.inputStream);
|
||||
inputStream.read_upto_async('\x00', -1, GLib.PRIORITY_DEFAULT, null, (_, res) => {
|
||||
const [args, len] = inputStream.read_upto_finish(res);
|
||||
inputStream.close(null);
|
||||
conn.inputStream.close(null);
|
||||
const inputStream = Gio.DataInputStream.new(conn.inputStream);
|
||||
inputStream.read_upto_async('\x00', -1, GLib.PRIORITY_DEFAULT, null, (_, res) => {
|
||||
const [args, len] = inputStream.read_upto_finish(res);
|
||||
inputStream.close(null);
|
||||
conn.inputStream.close(null);
|
||||
|
||||
if(len < 1) {
|
||||
console.error(`Colorshell: No args provided via socket call`);
|
||||
return;
|
||||
}
|
||||
if(len < 1) {
|
||||
console.error(`Colorshell: No args provided via socket call`);
|
||||
return;
|
||||
}
|
||||
|
||||
try {
|
||||
const [success, parsedArgs] = GLib.shell_parse_argv(`colorshell ${args}`);
|
||||
parsedArgs?.splice(0, 1); // remove the unnecessary `colorshell` part
|
||||
try {
|
||||
const [success, parsedArgs] = GLib.shell_parse_argv(`colorshell ${args}`);
|
||||
parsedArgs?.splice(0, 1); // remove the unnecessary `colorshell` part
|
||||
|
||||
if(success) {
|
||||
handleArguments({
|
||||
print_literal: (msg) => conn.outputStream.write_bytes(
|
||||
if(success) {
|
||||
handleArguments({
|
||||
print_literal: (msg) => conn.outputStream.write_bytes(
|
||||
encoder.encode(`${msg}\n`),
|
||||
null
|
||||
),
|
||||
|
||||
@@ -68,16 +68,23 @@ Send_log warn "!! By running this, you assume total responsability for issues th
|
||||
if [[ "$answer" == y ]] || [[ "$skip_prompts" ]]; then
|
||||
if [[ "$is_standalone" ]]; then
|
||||
Send_log "The installer noticed that you're calling the script remotely"
|
||||
rm -rf $repo_directory 2> /dev/null
|
||||
Send_log "Cloning repository in \`$repo_directory\`..."
|
||||
git clone https://github.com/retrozinndev/colorshell.git "$repo_directory"
|
||||
if [[ -d $repo_directory ]]; then
|
||||
Send_log "repo is already cloned! let's just fetch the latest changes..."
|
||||
git -C "$repo_directory" stash # if there are changes, let's just stash them
|
||||
git -C "$repo_directory" fetch && git -C "$repo_directory" pull --rebase
|
||||
git -C "$repo_directory" stash pop # pop changes back if there are any
|
||||
else
|
||||
git clone https://github.com/retrozinndev/colorshell.git "$repo_directory"
|
||||
fi
|
||||
fi
|
||||
|
||||
Ask "Nice! Update to latest stable version instead of unstable(latest commit)?"
|
||||
|
||||
if [[ -z "$skip_prompts" ]] && [[ "$answer" == y ]]; then
|
||||
Send_log "fetching latest release from colorshell repository"
|
||||
latest_tag=`curl -s "$repo_api_url/releases" | jq -r '. | select(.[].prerelease == false) | .[0].tag_name'`
|
||||
# use `head -n1` because for some reason, github api shows the same release 3 times :'(
|
||||
latest_tag=`curl -s "$repo_api_url/releases" | jq -r '. | select(.[].prerelease == false) | .[0].tag_name' | head -n1`
|
||||
|
||||
Send_log "Done fetching"
|
||||
Send_log "Checking out latest non-pre-release version: $latest_tag"
|
||||
|
||||
Reference in New Issue
Block a user