diff --git a/.gitignore b/.gitignore index 3d33a15..796b96d 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1 @@ -/client -/server +/build diff --git a/CHANGELOG.md b/CHANGELOG.md new file mode 100644 index 0000000..f36e6b0 --- /dev/null +++ b/CHANGELOG.md @@ -0,0 +1,5 @@ +[Unreleased] + +# v1.0.0 +## Added +- First release! ๐Ÿ˜ diff --git a/Makefile b/Makefile index a53b12a..1821d94 100644 --- a/Makefile +++ b/Makefile @@ -1,25 +1,34 @@ -CC = go build -CFLAGS = -trimpath -LDFLAGS = all=-w -s -GCFLAGS = all= -ASMFLAGS = all= +DIR = ./build +GO_ARCH_AMD = amd64 +GO_ARCH_ARM = arm64 +GO_OS_LINUX = linux +EXECUTABLE_PREFIX = freetube-sync + +BIN_LINUX_SERVER_AMD64 = $(DIR)/$(EXECUTABLE_PREFIX)-server-$(GO_ARCH_AMD) +BIN_LINUX_SERVER_ARM64 = $(DIR)/$(EXECUTABLE_PREFIX)-server-$(GO_ARCH_ARM) + +BIN_LINUX_CLIENT_AMD64 = $(DIR)/$(EXECUTABLE_PREFIX)-client-$(GO_ARCH_AMD) +BIN_LINUX_CLIENT_ARM64 = $(DIR)/$(EXECUTABLE_PREFIX)-client-$(GO_ARCH_ARM) + +LDFLAGS = -extldflags=-static + +.PHONY: all: client server .PHONY: client client: - GO111MODULE=$(GOMOD) \ - GOARCH=$(GO_ARCH_AMD) \ - GOOS=$(GO_OS_LINUX) \ - CGO_ENABLED=0 \ - $(CC) $(CFLAGS) -ldflags="$(LDFLAGS)" -gcflags="$(GCFLAGS)" -asmflags="$(ASMFLAGS)" \ - -o ./client ./cmd/client + GOARCH=$(GO_ARCH_AMD) GOOS=$(GO_OS_LINUX) CGO_ENABLED=0 go build -o $(BIN_LINUX_CLIENT_AMD64) ./cmd/client + GOARCH=$(GO_ARCH_ARM) GOOS=$(GO_OS_LINUX) CGO_ENABLED=0 go build -o $(BIN_LINUX_CLIENT_ARM64) ./cmd/client .PHONY: server server: - GO111MODULE=$(GOMOD) \ - GOARCH=$(GO_ARCH_AMD) \ - GOOS=$(GO_OS_LINUX) \ - CGO_ENABLED=1 \ - $(CC) $(CFLAGS) -ldflags="$(LDFLAGS)" -gcflags="$(GCFLAGS)" -asmflags="$(ASMFLAGS)" \ - -o ./server ./cmd/server + GOARCH=$(GO_ARCH_AMD) GOOS=$(GO_OS_LINUX) CGO_ENABLED=$(CGO_ENABLED) \ + go build -ldflags="$(LDFLAGS)" -tags osusergo,netgo,sqlite_omit_load_extension -o $(BIN_LINUX_SERVER_AMD64) ./cmd/server + + GOARCH=$(GO_ARCH_ARM) GOOS=$(GO_OS_LINUX) GOARM=7 CGO_ENABLED=$(CGO_ENABLED) \ + CC=arm-linux-gnueabihf-gcc CXX=arm-linux-gnueabihf-g++ \ + go build -ldflags="$(LDFLAGS)" -tags osusergo,netgo,sqlite_omit_load_extension -o $(BIN_LINUX_SERVER_ARM64) ./cmd/server + +clean: + rm $(DIR)/* diff --git a/README.md b/README.md index 86e4c57..f7ead82 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ ![](https://deblan.gitnet.page/freetube-sync/logo.svg) -[FreeTube](https://freetubeapp.io/) is an open source desktop YouTube player built with privacy in mind. Use YouTube without advertisements and prevent Google from tracking you with their cookies and JavaScript. +[FreeTube](https://freetubeapp.io/) is an open source desktop YouTube player built with privacy in mind. Use YouTube without advertisements and prevent Google from tracking you with their cookies and JavaScript. It does not require an account, all datas are on your local storage. In case of you use FreeTube on several computers, you can't synchronize them easily. FreeTube stores datas on plain text files, loaded in memory and rewrite them on each updates. @@ -14,7 +14,7 @@ It does not require an account, all datas are on your local storage. In case of The role of the server is to store the history, the playlists and the profiles of FreeTube instances (clients). -After starting the server, each client must init its local datas on the server. This action must be processed only once. +After starting the server, each client must initialize their local datas on the server. This action must be processed only once. At each time you want to use FreeTube, you have to pull datas from the server before. A watcher will push updates on the server when your history, your playlists or your profiles are updated. When FreeTube is restarted, history, playlists and profiles will be updated. @@ -41,20 +41,40 @@ sequenceDiagram ## ๐Ÿ“— How to use it? +Go to [releases](https://gitnet.fr/deblan/freetube-sync/releases) and download the client and the server according of your system architecture. + +On the server: + +```bash +chmod +x freetube-sync-server-xxx +sudo mv freetube-sync-server-xxx /usr/local/bin/freetube-sync-server +``` + +On clients: + +``` +chmod +x freetube-sync-client-xxx +sudo mv freetube-sync-client-xxx /usr/local/bin/freetube-sync-client +``` + ### Server To start the server, simply run: ``` -/path/to/server +freetube-sync-server ``` +By default, it listens on all interfaces, port 1323. + +โš ๏ธ Consider installing a proxy to secure access (HTTPS, IP access restriction, โ€ฆ). + ### Client First, sync your local datas to the server: ``` -/path/to/client -s http://ip.of.the.server:1323 init +freetube-sync-client -s http://ip.of.the.server:1323 init ``` Create `~/.bin/freetube-wrapper` and fill it with: @@ -62,8 +82,8 @@ Create `~/.bin/freetube-wrapper` and fill it with: ``` #!/bin/sh -/path/to/client -s http://ip.of.the.server:1323 pull -exec /opt/FreeTube/freetube $@ +freetube-sync-client -s http://ip.of.the.server:1323 pull +exec freetube $@ ``` Then run `chmod +x ~/.bin/freetube-wrapper`. @@ -88,7 +108,7 @@ Description=FreeTube Sync Watcher [Service] Type=simple StandardOutput=journal -ExecStart=/path/to/client -s http://ip.of.the.server:1323 watch +ExecStart=freetube-sync-client -s http://ip.of.the.server:1323 watch [Install] WantedBy=default.target @@ -102,3 +122,15 @@ systemctl --user start freetubesync-watcher.service ``` Choose `FreeTube (synced)` to open FreeTube. + +## ๐Ÿงช Compilation sources + +- [GO 1.23](https://go.dev/dl/) +- `build-essential` +- `gcc-arm-linux-gnueabihf` in case of cross compilation + +```bash +git clone https://gitnet.fr/deblan/freetube-sync +cd freetube-sync +make +```