Skip to content

Commit cc688bb

Browse files
author
root
committed
create scripts
1 parent 6c87bbb commit cc688bb

115 files changed

Lines changed: 12640 additions & 2304 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

Makefile

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11

22
.PHONY: help install tidy build run test test-strict test-fast lint lint-strict lint-fast fmt fmt-strict fmt-fast check check-fast sec sec-strict sec-fast artifact-scan \
33
backend web backend-targeted backend-iac backend-software fast strict build-local latest dev \
4-
image start stop restart logs stats delete rm kill-port redo \
4+
image start stop restart logs stats delete rm kill-port redo sync-store \
55
openapi-gen openapi-merge openapi-check openapi-sync
66

77
# ============================================================
@@ -41,6 +41,7 @@ help:
4141
@echo " make build Build all (backend + web)"
4242
@echo " make build backend Build Go binary → backend/appos"
4343
@echo " make build web Build React app → web/dist"
44+
@echo " make sync-store Refresh web/public/store/*.json from artifact.websoft9.com"
4445
@echo " make run Copy artifacts + restart services (~10s)"
4546
@echo " make run 9092 Copy artifacts + restart on custom port"
4647
@echo " make redo Full rebuild: rm volumes + build + image + start dev"
@@ -197,13 +198,27 @@ tidy:
197198
@cd backend && go mod tidy
198199
@echo "✓ Go modules tidied"
199200

201+
sync-store:
202+
@echo "Refreshing web store JSON files..."
203+
@set -e; \
204+
base_url="https://artifact.websoft9.com/release/websoft9/store"; \
205+
for file in web/public/store/*.json; do \
206+
name=$$(basename "$$file"); \
207+
tmp_file="$$file.tmp"; \
208+
echo "$$name"; \
209+
curl -fsSL "$$base_url/$$name" -o "$$tmp_file"; \
210+
mv "$$tmp_file" "$$file"; \
211+
done
212+
@echo "✓ Web store JSON refreshed"
213+
200214
build:
201215
ifeq ($(ARG2),backend)
202216
@echo "Building backend binaries (static, no dependencies)..."
203217
@$(MAKE) openapi-sync
204218
@cd backend && CGO_ENABLED=0 go build -ldflags="-w -s" -o appos ./cmd/appos
205219
@echo "✓ Backend built → backend/appos (statically linked)"
206220
else ifeq ($(ARG2),web)
221+
@$(MAKE) sync-store
207222
@echo "Building web app..."
208223
@cd web && npm run build
209224
@echo "✓ Web app built → web/dist/"
@@ -214,6 +229,7 @@ else
214229
@$(MAKE) openapi-sync
215230
@cd backend && CGO_ENABLED=0 go build -ldflags="-w -s" -o appos ./cmd/appos
216231
@echo "✓ Backend built → backend/appos"
232+
@$(MAKE) sync-store
217233
@cd web && npm run build
218234
@echo "✓ Web app built → web/dist/"
219235
@echo "✓ All built"

Note.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,10 @@
2222

2323
## 我的应用
2424

25+
## 应用商店
26+
27+
由文件管理机制机制,迁移至后端提供
28+
2529
## 部署
2630

2731
- docker 部署
@@ -149,3 +153,7 @@ rss 文章总数量,每个 source 文章上限问题,清理机制
149153

150154

151155

156+
157+
158+
159+
## 去nginx 改造

backend/cmd/appos/bootstrap/cron.go

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ const monitorRuntimeSnapshotPullCronJobID = "monitor_runtime_snapshot_pull"
2525
const monitorCredentialCronJobID = "monitor_credential_checks"
2626
const monitorAppHealthCronJobID = "monitor_app_health_checks"
2727
const feedsPollCronJobID = "feeds_poll"
28+
const feedsRetentionCronJobID = "feeds_retention_sweep"
2829

2930
func registerCronHooks(app *pocketbase.PocketBase, asynqClient *asynq.Client) {
3031
app.Cron().MustAdd(
@@ -47,6 +48,16 @@ func registerCronHooks(app *pocketbase.PocketBase, asynqClient *asynq.Client) {
4748
}),
4849
)
4950

51+
app.Cron().MustAdd(
52+
feedsRetentionCronJobID,
53+
"0 * * * *",
54+
cronutil.Wrap(app, feedsRetentionCronJobID, func() {
55+
if _, err := feeds.RunRetentionSweep(app); err != nil {
56+
panic(err)
57+
}
58+
}),
59+
)
60+
5061
if asynqClient == nil {
5162
return
5263
}

backend/cmd/appos/bootstrap/cron_test.go

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -102,11 +102,21 @@ func TestRegisterCronHooksRegistersFeedsPollJob(t *testing.T) {
102102
app := pocketbase.New()
103103
registerCronHooks(app, nil)
104104

105+
foundFeedsPoll := false
106+
foundFeedsRetention := false
105107
for _, job := range app.Cron().Jobs() {
106108
if job.Id() == feedsPollCronJobID {
107-
return
109+
foundFeedsPoll = true
110+
}
111+
if job.Id() == feedsRetentionCronJobID {
112+
foundFeedsRetention = true
108113
}
109114
}
110115

111-
t.Fatalf("expected cron job %q to be registered", feedsPollCronJobID)
116+
if !foundFeedsPoll {
117+
t.Fatalf("expected cron job %q to be registered", feedsPollCronJobID)
118+
}
119+
if !foundFeedsRetention {
120+
t.Fatalf("expected cron job %q to be registered", feedsRetentionCronJobID)
121+
}
112122
}

backend/cmd/openapi/gen.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,7 @@ var publicPrefixes = []string{
6969
"/api/ext/auth",
7070
"/api/space/preview",
7171
"/api/space/share",
72+
"/api/settings/public",
7273
"/tunnel/setup",
7374
"/openapi",
7475
}

0 commit comments

Comments
 (0)