Skip to content

Commit

Permalink
GUI-Warp.app changes
Browse files Browse the repository at this point in the history
  • Loading branch information
mezantrop committed Aug 29, 2024
1 parent 102b5b5 commit 1cc154c
Show file tree
Hide file tree
Showing 7 changed files with 67 additions and 6 deletions.
4 changes: 3 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
# CHANGELOG

* **2024.08.26 Current**
* **2024.08.29 Current**
* `GUI-Warp.app`: Added an internal launcher - `starter.c`
* `ts-warp.sh`: Enable `PF`-firewall in `ts-warp.sh` `start`; Minor fixes for `PF` on `macOS` in `GUI-Warp` on `stop`
* `pidlist.c`: `ACT` shows destination IP-address, when internal proxy servers are used
* `ts-warp.c`: `-D 0..512` DPI bypass fragment size by default 0 - disabled; To enable use a positive value, e.g., 2

Expand Down
8 changes: 7 additions & 1 deletion gui/ports/macOS/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -40,26 +40,32 @@ all: ts-warp
ts-warp_x64:
$(CC) $(CFLAGS) -o ts-warp_x64 -target x86_64-apple-macos11 $(WARP_FILES)
$(CC) $(CFLAGS) -o ts-pass_x64 -target x86_64-apple-macos11 $(PASS_FILES)
$(CC) $(CFLAGS) -o starter_x64 -target x86_64-apple-macos11 starter.c

ts-warp_arm:
$(CC) $(CFLAGS) -o ts-warp_arm -target arm64-apple-macos11 $(WARP_FILES)
$(CC) $(CFLAGS) -o ts-pass_arm -target arm64-apple-macos11 $(PASS_FILES)
$(CC) $(CFLAGS) -o starter_arm -target arm64-apple-macos11 starter.c

ts-warp: ts-warp_x64 ts-warp_arm
lipo -create -output ts-warp ts-warp_x64 ts-warp_arm
lipo -create -output ts-pass ts-pass_x64 ts-pass_arm
lipo -create -output starter starter_x64 starter_arm

ts-warp_x64-ssh2:
$(CC) $(CFLAGS) -DWITH_LIBSSH2=1 -o ts-warp_x64 -lcrypto -lssl -lssh2 -lz -L./ -target x86_64-apple-macos11 $(WARP_FILES)
$(CC) $(CFLAGS) -o ts-pass_x64 -target x86_64-apple-macos11 $(PASS_FILES)
$(CC) $(CFLAGS) -o starter_x64 -target x86_64-apple-macos11 starter.c

ts-warp_arm-ssh2:
$(CC) $(CFLAGS) -DWITH_LIBSSH2=1 -o ts-warp_arm -lcrypto -lssl -lssh2 -lz -L./ -target arm64-apple-macos11 $(WARP_FILES)
$(CC) $(CFLAGS) -o ts-pass_arm -target arm64-apple-macos11 $(PASS_FILES)
$(CC) $(CFLAGS) -o starter_arm -target arm64-apple-macos11 starter.c

ts-warp-ssh2: ts-warp_x64-ssh2 ts-warp_arm-ssh2
lipo -create -output ts-warp ts-warp_x64 ts-warp_arm
lipo -create -output ts-pass ts-pass_x64 ts-pass_arm
lipo -create -output starter starter_x64 starter_arm

clean:
rm -rf ts-warp ts-warp_x64 ts-warp_arm ts-pass ts-pass_x64 ts-pass_arm *.o *.dSYM *.core
rm -rf ts-warp ts-warp_x64 ts-warp_arm ts-pass ts-pass_x64 ts-pass_arm starter starter_x64 starter_arm *.o *.dSYM *.core
5 changes: 5 additions & 0 deletions gui/ports/macOS/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -98,10 +98,15 @@ $pv/bin/python3 setup.py py2app &&
# echo "-- Archiving ----------------------------------------------------------------------------------------------------" &&
# tar cvf - -C dist gui-warp.app | gzip --best > gui-warp.app.tgz &&

# Installing the app-launcher - starter
mv dist/gui-warp.app/Contents/MacOS/gui-warp dist/gui-warp.app/Contents/MacOS/app
cp starter dist/gui-warp.app/Contents/MacOS/gui-warp

echo "-- Creating DMG -------------------------------------------------------------------------------------------------" &&
mkdir GUI-Warp
mv dist/gui-warp.app GUI-Warp
ln -s /Applications GUI-Warp

hdiutil create GUI-Warp-tmp.dmg -ov -volname "GUI-Warp" -fs HFS+ -srcfolder "GUI-Warp"
hdiutil convert GUI-Warp-tmp.dmg -format UDZO -o GUI-Warp.dmg

Expand Down
2 changes: 1 addition & 1 deletion gui/ports/macOS/gui-warp.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ def __init__(self, width=800, height=560,

self.password = ''

self.version = 'v1.0.30-mac'
self.version = 'v1.0.31-mac'
self.width = width
self.height = height

Expand Down
45 changes: 45 additions & 0 deletions gui/ports/macOS/starter.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
/* -------------------------------------------------------------------------- */
/* Trivial starter program to launch other applications */
/* -------------------------------------------------------------------------- */

/*
"THE BEER-WARE LICENSE" (Revision 42):
zmey20000@yahoo.com wrote this file. As long as you retain this notice you
can do whatever you want with this stuff. If we meet some day, and you think
this stuff is worth it, you can buy me a beer in return Mikhail Zakharov
*/


/* -------------------------------------------------------------------------- */
#include <stdio.h>
#include <libgen.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>

/* -------------------------------------------------------------------------- */
#define APP_NAME "app"
#define DIRBUFSZ 256

/* -------------------------------------------------------------------------- */
int main(int argc, char *argv[]) {
char buf[DIRBUFSZ];

if (argc > 2 || (argc == 2 && !strncmp(argv[1], "-h", 2))) {
fprintf(stdout,
"Run a program (default name: app) in the same directory\n\n"
"Usage: %s [program]\n", basename(argv[0]));
return 0;
}

setuid(geteuid());

if (argv[0][0] == '/')
strncpy(buf, dirname(argv[0]), DIRBUFSZ);
else
getcwd(buf, DIRBUFSZ);
sprintf(buf + strnlen(buf, DIRBUFSZ), "/%s", APP_NAME);

return execl(buf, APP_NAME, NULL);
}

6 changes: 4 additions & 2 deletions gui/ports/macOS/ts-warp.sh
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@ _start() {
_check_root
printf "Starting ts-warp: "

/sbin/pfctl -eq
awk -v pf_conf="$tswarp_prefix"/etc/ts-warp_pf.conf '
/ts-warp/ {next}
/ns-warp/ {next}
Expand All @@ -85,7 +86,7 @@ _start() {
print("anchor \"ns-warp\"")
printf("load anchor \"ts-warp\" from \"%s\"\n", pf_conf)
}
' /etc/pf.conf | /sbin/pfctl -f -
' /etc/pf.conf | /sbin/pfctl -q -f -

echo $tswarp_options $* | xargs $SCRIPTPATH/ts-warp > /dev/null
}
Expand Down Expand Up @@ -126,7 +127,8 @@ _stop() {
[ -f "$tswarp_pidfile" ] && rm -f "$tswarp_pidfile"
pkill -x ts-warp

/sbin/pfctl -f /etc/pf.conf
/sbin/pfctl -q -a ts-warp -F all
/sbin/pfctl -q -a ns-warp -F all
}

# ---------------------------------------------------------------------------- #
Expand Down
3 changes: 2 additions & 1 deletion ts-warp.sh.in
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,7 @@ _start() {
;;

Darwin|FreeBSD|OpenBSD)
/sbin/pfctl -eq
awk -v pf_conf="$tswarp_prefix"/etc/ts-warp_pf.conf '
/ts-warp/ {next}
/ns-warp/ {next}
Expand All @@ -102,7 +103,7 @@ _start() {
print("anchor \"ns-warp\"")
printf("load anchor \"ts-warp\" from \"%s\"\n", pf_conf)
}
' /etc/pf.conf | /sbin/pfctl -f -
' /etc/pf.conf | /sbin/pfctl -q -f -
;;

*)
Expand Down

0 comments on commit 1cc154c

Please sign in to comment.