Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
68 changes: 34 additions & 34 deletions .github/workflows/deploy-cloudflare.yml
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ jobs:
fi

if [ -z "$CUSTOM_DOMAIN" ]; then
echo "::error:: CUSTOM_DOMAIN variable is not set."
echo "::warning:: CUSTOM_DOMAIN variable is not set."
fi

CONFIG_FILE="wrangler-action.toml"
Expand Down Expand Up @@ -132,9 +132,18 @@ jobs:
fi

echo "🔍 Checking if the database exists..."
KV_LIST=$(pnpm wrangler kv namespace list)

if echo "$KV_LIST" | jq -e ".[] | select(.title == \"$NAME\")" > /dev/null; then
set +e
KV_LIST=$(pnpm wrangler kv namespace list 2>&1)
STATUS=$?
set -e

if [ $STATUS -ne 0 ]; then
echo "$KV_LIST"
exit 1
fi

if echo "$KV_LIST" | jq -e ".[] | select(.title == \"$NAME\")" >/dev/null; then
echo "✅ Database $NAME already exists."
KV_ID=$(echo "$KV_LIST" | jq -r ".[] | select(.title == \"$NAME\") | .id")
echo "KV_NAMESPACE_ID: $KV_ID"
Expand All @@ -161,9 +170,18 @@ jobs:
fi

echo "🔍 Checking if the database exists..."
DB_LIST=$(pnpm wrangler d1 list --json)

if echo "$DB_LIST" | jq -e ".[] | select(.name == \"$NAME\")" > /dev/null; then
set +e
DB_LIST=$(pnpm wrangler d1 list --json 2>&1)
STATUS=$?
set -e

if [ $STATUS -ne 0 ]; then
echo "$DB_LIST"
exit 1
fi

if echo "$DB_LIST" | jq -e ".[] | select(.name == \"$NAME\")" >/dev/null; then
echo "✅ Database $NAME already exists."
D1_ID=$(echo "$DB_LIST" | jq -r ".[] | select(.name == \"$NAME\") | .uuid")
echo "D1_DATABASE_ID: $D1_ID"
Expand All @@ -182,7 +200,17 @@ jobs:
working-directory: ./mail-worker
run: |
echo "🚀 Starting deployment..."
pnpm wrangler deploy -c wrangler-action.toml | tee deploy.log | grep -v "https://.*\.workers\.dev" || true
pnpm wrangler deploy -c wrangler-action.toml 2>&1 \
| tee deploy.log \
| grep -v "https://.*\.workers\.dev" \
| sed -E 's/env\.domain .*/env.domain (***)/' \
|| true

DEPLOY_EXIT_CODE=${PIPESTATUS[0]}
if [ $DEPLOY_EXIT_CODE -ne 0 ]; then
exit 1
fi

WORKER_URL=$(grep -o "https://.*\.workers\.dev" deploy.log || echo "")

if [ -n "$WORKER_URL" ]; then
Expand Down Expand Up @@ -215,34 +243,6 @@ jobs:
exit 1
fi

- name: 📮 设置邮件接收 / Set up email receiving
run: |

echo "🛠️ Starting email receiving setup..."

WORKER_URL="${CUSTOM_DOMAIN:+https://$CUSTOM_DOMAIN}"
WORKER_URL="${WORKER_URL:-${{ steps.deploy.outputs.worker_url }}}"

HTTP_CODE=$(curl -sL --post301 --post302 --post303 -w "%{http_code}" -o response.txt \
-X POST \
-H "Content-Type: application/json" \
-d "{\"domainList\": $DOMAIN,\"accountId\":\"$CLOUDFLARE_ACCOUNT_ID\",\"token\":\"$CLOUDFLARE_API_TOKEN\",\"workerName\":\"$NAME\"}" \
"$WORKER_URL/api/initForward")

RESPONSE_BODY=$(cat response.txt)

if [ "$RESPONSE_BODY" = "success" ]; then
echo "✅ Setup completed."
exit 0
fi

if [ "$HTTP_CODE" = "200" ] && [ "$RESPONSE_BODY" != "success" ]; then
echo "::error:: Email receiving setup failed: $RESPONSE_BODY"
exit 0
fi

echo "::error:: Email receiving setup failed: $HTTP_CODE $RESPONSE_BODY"

- name: 🗑️ 删除运行记录 / Delete workflow runs
uses: GitRML/delete-workflow-runs@main
continue-on-error: true
Expand Down
2 changes: 1 addition & 1 deletion mail-vue/src/layout/account/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,7 @@ const addForm = reactive({
})
let skeletonRows = 10
const queryParams = {
size: 10
size: 30
}

const mySelect = ref()
Expand Down
5 changes: 0 additions & 5 deletions mail-worker/src/api/init-api.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,6 @@
import app from '../hono/hono';
import { dbInit } from '../init/init';
import { initForward } from "../init/forward";

app.get('/init/:secret', (c) => {
return dbInit.init(c);
})

app.post('/initForward', async (c) => {
return initForward(c, await c.req.json());
})
124 changes: 0 additions & 124 deletions mail-worker/src/init/forward.js

This file was deleted.