model:
	jet -source=sqlite -dsn="./data.db" -schema=follower -path=./.gen

fmt:
	gofumpt -w -l -extra .

db:
	rm -rf data.db; sqlite3 data.db < init.sql
sync:
	scp -r dst root@10.1.1.105:/opt/netboot/www/

proxy:
	rm -rf ./dst/*
	CGO_ENABLE=1 go build -o dst/proxy ./cmd/proxy
	cp -ap modules/web/dst dst/
	cp certs/ca.crt dst/
	rm -rf ./dst/data.db; sqlite3 ./dst/data.db < init.sql

	# rm -rf proxy.gz
	# tar zcvf proxy.gz ./dst
	# scp proxy.gz root@10.1.1.105:/opt/netboot/www/
web:
	CGO_ENABLE=1 go build -o ./dst/web ./cmd/web

all:
	rm -rf ./dst/*
	cd frontend && npm run build && cd ..
	CGO_ENABLE=0 go build -o ./dst/web ./cmd/web
	CGO_ENABLE=0 go build -o ./dst/proxy ./cmd/proxy
	CGO_ENABLED=0 GOOS=windows GOARCH=amd64 go build -o dst/proxy.exe ./cmd/proxy

	echo 'start /d "D:\proxy" proxy.exe' > ./dst/proxy.bat

 win:
	CGO_ENABLED=0 GOOS=windows GOARCH=amd64 go build -o proxy.exe ./cmd/proxy

publish: all
	# scp -r dst/ root@39.105.111.158:/projects/douyin-proxy/
	rsync -aH --progress dst/ root@39.105.111.158:/projects/douyin-proxy/