Merge pull request 'feat: INS hotel technology landing page with lead capture' (#1) from feat/hotel-landing-page into main
CI / build (push) Failing after 0s
CI / build (push) Failing after 0s
Reviewed-on: #1
This commit was merged in pull request #1.
This commit is contained in:
commit
110018e9d3
17 files changed
+1507
No files matched your search
@@ -0,0 +1,7 @@
|
||||
.git
|
||||
.superpowers
|
||||
.playwright-cli
|
||||
data
|
||||
docs
|
||||
node_modules
|
||||
*.db
|
||||
@@ -0,0 +1,190 @@
|
||||
name: CI
|
||||
|
||||
# Image build for ins-landing-page, following dynamic-qr's pipeline (build container, DinD, one
|
||||
# moving tag per profile, per-branch run queue, guarded microk8s rollout, notifications). The k8s
|
||||
# manifests live in k8s/ and are applied by hand (README "Kubernetes"); CI only rolls the
|
||||
# Deployment so it pulls the new image, and only from main. Tests run inside the Dockerfile's
|
||||
# `test` stage, so a failing test stops the image from being pushed.
|
||||
#
|
||||
# Tags: main -> ins-landing-page-prd-latest; dev -> ins-landing-page-dev-latest.
|
||||
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- main
|
||||
- dev
|
||||
|
||||
# Do NOT add workflow `concurrency`: Gitea keeps one waiting run per group and cancels the rest.
|
||||
# Runs queue per branch in the "Wait for older runs" step instead (scripts/waitForOlderRuns.sh).
|
||||
|
||||
jobs:
|
||||
build:
|
||||
runs-on: ubuntu-latest
|
||||
container:
|
||||
image: gitea.containerverse.dev/solvway/maven-custom-21:latest
|
||||
credentials:
|
||||
username: ${{ secrets.PACKAGE_USER }}
|
||||
password: ${{ secrets.PACKAGE_RW_KEY }}
|
||||
env:
|
||||
_REGISTRY: gitea.containerverse.dev
|
||||
_REGISTRY_PREFIX: solvway
|
||||
_REPO_NAME: ins-landing-page
|
||||
_IMAGE_NAME: ins-landing-page
|
||||
# Images are built against the DinD sidecar (no host docker socket), without TLS.
|
||||
DOCKER_HOST: tcp://docker:2375
|
||||
DOCKER_TLS_VERIFY: ""
|
||||
# Push a single manifest, not a manifest list with a provenance attestation.
|
||||
BUILDX_NO_DEFAULT_ATTESTATIONS: "1"
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Wait for older runs of this branch
|
||||
timeout-minutes: 125
|
||||
env:
|
||||
GITEA_TOKEN: ${{ github.token }}
|
||||
GITEA_API: ${{ github.server_url }}/api/v1
|
||||
GITEA_REPO: ${{ github.repository }}
|
||||
GITEA_BRANCH: ${{ github.ref_name }}
|
||||
RUN_NUMBER: ${{ github.run_number }}
|
||||
# Values reach scripts through env:, never as ${{ }} inside run:.
|
||||
run: |
|
||||
"$GITHUB_WORKSPACE/scripts/waitForOlderRuns.sh" "$RUN_NUMBER"
|
||||
|
||||
- name: Docker build & push
|
||||
env:
|
||||
REGISTRY_USER: ${{ secrets.PACKAGE_USER }}
|
||||
REGISTRY_PASSWORD: ${{ secrets.PACKAGE_RW_KEY }}
|
||||
BRANCH: ${{ github.ref_name }}
|
||||
run: |
|
||||
case "$BRANCH" in
|
||||
main) PROFILE=prd ;;
|
||||
dev) PROFILE=dev ;;
|
||||
*) echo "Refusing unexpected branch name"; exit 1 ;;
|
||||
esac
|
||||
IMAGE_REF="$_REGISTRY/$_REGISTRY_PREFIX/$_IMAGE_NAME:$_REPO_NAME-$PROFILE-latest"
|
||||
printf '%s' "$REGISTRY_PASSWORD" | docker login "$_REGISTRY" -u "$REGISTRY_USER" --password-stdin
|
||||
docker build --pull -f Dockerfile --target test .
|
||||
docker build -f Dockerfile -t "$IMAGE_REF" .
|
||||
docker push "$IMAGE_REF"
|
||||
echo "Pushed $IMAGE_REF"
|
||||
|
||||
- name: Rollout to microk8s
|
||||
if: ${{ github.ref_name == 'main' }}
|
||||
env:
|
||||
DEPLOY_USER: ${{ secrets.DRONECICD_SSH_USERNAME }}
|
||||
DEPLOY_HOST: ${{ secrets.DRONECICD_SSH_HOST }}
|
||||
DEPLOY_SSH_KEY: ${{ secrets.DRONECICD_SSH_KEY }}
|
||||
SHA: ${{ github.sha }}
|
||||
# Same guard as babyboo's emitGuardedRollout.sh: annotate first, and skip when the
|
||||
# Deployment already runs a newer commit (by committer time), so an older run never rolls
|
||||
# back a newer image. A missing Deployment (manifests not applied yet) is skipped, not failed.
|
||||
run: |
|
||||
case "$SHA" in *[!0-9a-f]*|'') echo "Refusing unexpected sha"; exit 1 ;; esac
|
||||
COMMIT_TIME="$(git log -1 --format=%ct "$SHA")"
|
||||
case "$COMMIT_TIME" in ''|*[!0-9]*) echo "cannot resolve the commit time of $SHA"; exit 1 ;; esac
|
||||
mkdir -p /root/.ssh && chmod 700 /root/.ssh
|
||||
printf '%s' "$DEPLOY_SSH_KEY" > /root/.ssh/id_rsa
|
||||
chmod 600 /root/.ssh/id_rsa
|
||||
ssh -i /root/.ssh/id_rsa -o StrictHostKeyChecking=no "${DEPLOY_USER}@${DEPLOY_HOST}" 'bash -s' <<EOF
|
||||
set -e
|
||||
k() { PATH="\$PATH:/snap/bin" microk8s kubectl "\$@"; }
|
||||
if ! k -n ins-landing-page get deployment/ins-landing-page >/dev/null 2>&1; then
|
||||
echo "ins-landing-page/ins-landing-page not found: apply k8s/ first (README). Skipping rollout."
|
||||
exit 0
|
||||
fi
|
||||
cur=\$(k -n ins-landing-page get deployment/ins-landing-page -o 'go-template={{with .metadata.annotations}}{{index . "ins-landing-page/deployed-commit-time"}}{{end}}')
|
||||
case "\$cur" in ''|*[!0-9]*) cur=0 ;; esac
|
||||
if [ "\$cur" -gt $COMMIT_TIME ]; then
|
||||
echo "Skip: ins-landing-page runs a newer commit (commit time \$cur > $COMMIT_TIME)"
|
||||
else
|
||||
k -n ins-landing-page annotate --overwrite deployment/ins-landing-page ins-landing-page/deployed-commit-time=$COMMIT_TIME ins-landing-page/deployed-commit=$SHA
|
||||
./krrd.sh ins-landing-page ins-landing-page
|
||||
fi
|
||||
EOF
|
||||
|
||||
- name: Telegram notification
|
||||
if: always()
|
||||
# Uses github.actor (the authenticated pusher) — always populated, so the
|
||||
# "Commit by <blank>" problem from the Drone setup cannot happen here.
|
||||
env:
|
||||
TG_TOKEN: ${{ secrets.TELEGRAM_TOKEN }}
|
||||
TG_TO: ${{ secrets.TELEGRAM_TO }}
|
||||
BUILD_STATUS: ${{ job.status }}
|
||||
ACTOR: ${{ github.actor }}
|
||||
REPO: ${{ github.repository }}
|
||||
BRANCH: ${{ github.ref_name }}
|
||||
RUN_NUMBER: ${{ github.run_number }}
|
||||
COMMIT_MSG: ${{ github.event.head_commit.message }}
|
||||
RUN_URL: ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}
|
||||
run: |
|
||||
if [ "$BUILD_STATUS" = "success" ]; then
|
||||
HEAD="✅ Build #${RUN_NUMBER} of \`${REPO}\` succeeded."
|
||||
else
|
||||
HEAD="❌ Build #${RUN_NUMBER} of \`${REPO}\` failed."
|
||||
fi
|
||||
TEXT="$(printf '%s\n\n📝 Pushed by %s on `%s`:\n\n```\n%s\n```\n\n🌐 %s' \
|
||||
"$HEAD" "$ACTOR" "$BRANCH" "$COMMIT_MSG" "$RUN_URL")"
|
||||
curl -sS "https://api.telegram.org/bot${TG_TOKEN}/sendMessage" \
|
||||
--data-urlencode "chat_id=${TG_TO}" \
|
||||
--data-urlencode "parse_mode=Markdown" \
|
||||
--data-urlencode "text=${TEXT}" >/dev/null
|
||||
|
||||
- name: Microsoft Teams notification
|
||||
if: always()
|
||||
# Independent of the Telegram step: both run on every build regardless of
|
||||
# the other's outcome. Posts an Adaptive Card, which both Teams Workflows
|
||||
# webhooks and legacy incoming webhooks accept.
|
||||
env:
|
||||
TEAMS_WEBHOOK_URL: ${{ secrets.MICROSOFT_TEAMS_WEBHOOK_URL }}
|
||||
BUILD_STATUS: ${{ job.status }}
|
||||
ACTOR: ${{ github.actor }}
|
||||
REPO: ${{ github.repository }}
|
||||
BRANCH: ${{ github.ref_name }}
|
||||
RUN_NUMBER: ${{ github.run_number }}
|
||||
COMMIT_MSG: ${{ github.event.head_commit.message }}
|
||||
RUN_URL: ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}
|
||||
run: |
|
||||
if [ -z "$TEAMS_WEBHOOK_URL" ]; then
|
||||
echo "MICROSOFT_TEAMS_WEBHOOK_URL not set — skipping."
|
||||
exit 0
|
||||
fi
|
||||
if [ "$BUILD_STATUS" = "success" ]; then
|
||||
HEAD="✅ Build #${RUN_NUMBER} of ${REPO} succeeded."
|
||||
COLOR="Good"
|
||||
else
|
||||
HEAD="❌ Build #${RUN_NUMBER} of ${REPO} failed."
|
||||
COLOR="Attention"
|
||||
fi
|
||||
# JSON-escape without relying on jq being in the build image.
|
||||
json_escape() {
|
||||
printf '%s' "$1" | tr -d '\r' \
|
||||
| sed -e 's/\\/\\\\/g' -e 's/"/\\"/g' -e 's/\t/\\t/g' \
|
||||
| awk 'NR > 1 { printf "\\n" } { printf "%s", $0 }'
|
||||
}
|
||||
BODY="$(cat <<JSON
|
||||
{
|
||||
"type": "message",
|
||||
"attachments": [{
|
||||
"contentType": "application/vnd.microsoft.card.adaptive",
|
||||
"content": {
|
||||
"\$schema": "http://adaptivecards.io/schemas/adaptive-card.json",
|
||||
"type": "AdaptiveCard",
|
||||
"version": "1.4",
|
||||
"body": [
|
||||
{ "type": "TextBlock", "text": "$(json_escape "$HEAD")", "weight": "Bolder", "size": "Medium", "color": "$COLOR", "wrap": true },
|
||||
{ "type": "TextBlock", "text": "📝 Pushed by $(json_escape "$ACTOR") on $(json_escape "$BRANCH"):", "wrap": true },
|
||||
{ "type": "TextBlock", "text": "$(json_escape "$COMMIT_MSG")", "fontType": "Monospace", "wrap": true }
|
||||
],
|
||||
"actions": [
|
||||
{ "type": "Action.OpenUrl", "title": "🌐 View run", "url": "$(json_escape "$RUN_URL")" }
|
||||
]
|
||||
}
|
||||
}]
|
||||
}
|
||||
JSON
|
||||
)"
|
||||
HTTP_CODE="$(curl -sS -o /dev/null -w '%{http_code}' -X POST \
|
||||
-H 'Content-Type: application/json' \
|
||||
--data-binary "$BODY" "$TEAMS_WEBHOOK_URL")" || true
|
||||
echo "Teams webhook responded HTTP ${HTTP_CODE}."
|
||||
@@ -3,3 +3,4 @@ data/
|
||||
*.db
|
||||
.worktrees/
|
||||
.superpowers/
|
||||
.playwright-cli/
|
||||
@@ -0,0 +1,26 @@
|
||||
{
|
||||
"detector": {
|
||||
"ignoreRules": [],
|
||||
"ignoreFiles": [],
|
||||
"ignoreValues": [
|
||||
{
|
||||
"rule": "all-caps-body",
|
||||
"value": "*",
|
||||
"files": [
|
||||
"public/index.html"
|
||||
],
|
||||
"createdAt": "2026-12-01T02:43:53.510Z",
|
||||
"reason": "Claude decided: uppercase only on short .eyebrow section labels (max 5 words), no body passages"
|
||||
},
|
||||
{
|
||||
"rule": "dark-glow",
|
||||
"value": "*",
|
||||
"files": [
|
||||
"public/index.html"
|
||||
],
|
||||
"createdAt": "2026-12-01T03:24:54.020Z",
|
||||
"reason": "Claude decided: only shadows on dark sections are neutral black elevation (rgba(0,0,0,.25-.35)) under the white form card and mobile contact bar, no chromatic glow"
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
+17
@@ -0,0 +1,17 @@
|
||||
FROM node:22-alpine AS base
|
||||
WORKDIR /app
|
||||
COPY package.json server.js ./
|
||||
COPY public ./public
|
||||
|
||||
# CI builds this stage first (`--target test`); a failing test stops the image from being pushed.
|
||||
FROM base AS test
|
||||
COPY server.test.js ./
|
||||
RUN node --disable-warning=ExperimentalWarning --test
|
||||
|
||||
FROM base
|
||||
ENV NODE_ENV=production PORT=3000 DB_PATH=/data/leads.db
|
||||
RUN mkdir -p /data && chown node:node /data
|
||||
USER node
|
||||
VOLUME /data
|
||||
EXPOSE 3000
|
||||
CMD ["node", "--disable-warning=ExperimentalWarning", "server.js"]
|
||||
@@ -0,0 +1,69 @@
|
||||
# INS Landing Page
|
||||
|
||||
Single landing page for Infinity Networks Security with a lead form. Leads are stored in a SQLite file; there is no admin UI, leads are exported manually.
|
||||
|
||||
- `public/index.html`: the page (content from infinitynetworks.com.my)
|
||||
- `server.js`: serves the page and `POST /api/leads`, Node 22 built-ins only, no npm dependencies
|
||||
|
||||
## Run locally
|
||||
|
||||
Requires Node 22.13 or newer.
|
||||
|
||||
```bash
|
||||
npm start # http://localhost:3000, database at ./data/leads.db
|
||||
npm test
|
||||
```
|
||||
|
||||
Environment: `PORT` (default `3000`), `DB_PATH` (default `./data/leads.db`).
|
||||
|
||||
## Docker
|
||||
|
||||
```bash
|
||||
docker build -t ins-landing-page .
|
||||
docker run -p 3000:3000 -v ins-leads:/data ins-landing-page
|
||||
```
|
||||
|
||||
## Kubernetes (microk8s)
|
||||
|
||||
`k8s/` deploys everything into namespace `ins-landing-page`, the same way as dynamic-qr:
|
||||
|
||||
- `40-app.yaml`: Longhorn PVC (1 Gi, ReadWriteOnce) mounted at `/data`, Service, and Deployment. The Deployment runs **1 replica** with `strategy: Recreate`, because SQLite has a single writer. It runs as uid 1000 with a read-only root filesystem.
|
||||
- `50-gateway.yaml`:
|
||||
- A Let's Encrypt Certificate and a Traefik Gateway for `ins-landing.containerverse.dev`.
|
||||
- HTTP redirects to HTTPS.
|
||||
- `POST /api/leads` goes through the `lead-rate-limit` middleware: 5 per minute per visitor, burst 5, keyed on the Cloudflare visitor IP.
|
||||
- `60-network-policy.yaml`: denies all ingress except Traefik to port 3000, and Traefik to cert-manager's HTTP-01 solver.
|
||||
|
||||
Prerequisite: DNS for `ins-landing.containerverse.dev` points at the cluster through Cloudflare, like the other `containerverse.dev` hosts.
|
||||
|
||||
First install, on the microk8s host (`k` = `microk8s kubectl`):
|
||||
|
||||
k apply -f k8s/00-namespace.yaml
|
||||
k -n ins-landing-page create secret docker-registry regcred \
|
||||
--docker-server=gitea.containerverse.dev --docker-username=<user> --docker-password=<token>
|
||||
k apply -f k8s/
|
||||
k -n ins-landing-page rollout status deployment/ins-landing-page
|
||||
|
||||
Updates: every push to `main` runs the tests and builds `gitea.containerverse.dev/solvway/ins-landing-page:ins-landing-page-prd-latest`. CI then runs `./krrd.sh ins-landing-page ins-landing-page` on the deploy host. Manifest changes are applied by hand (`k apply -f k8s/`).
|
||||
|
||||
CI needs the same repository secrets as dynamic-qr: `PACKAGE_USER`, `PACKAGE_RW_KEY`, `DRONECICD_SSH_*`, `TELEGRAM_*` and, optionally, `MICROSOFT_TEAMS_WEBHOOK_URL`. They come from the `solvway` org once the repo is transferred there.
|
||||
|
||||
## Exporting leads
|
||||
|
||||
To CSV, from the running pod:
|
||||
|
||||
```bash
|
||||
microk8s kubectl -n ins-landing-page exec deploy/ins-landing-page -- node --disable-warning=ExperimentalWarning -e "
|
||||
const {DatabaseSync}=require('node:sqlite');
|
||||
const rows=new DatabaseSync(process.env.DB_PATH,{readOnly:true}).prepare('SELECT * FROM leads ORDER BY id').all();
|
||||
const q=v=>v==null?'':'\"'+String(v).replace(/^[=+\-@]/,\"'\$&\").replace(/\"/g,'\"\"')+'\"';
|
||||
if(rows.length)console.log(Object.keys(rows[0]).join(','));
|
||||
for(const r of rows)console.log(Object.values(r).map(q).join(','));
|
||||
" > leads.csv
|
||||
```
|
||||
|
||||
Prefer the CSV export above. The database runs in WAL mode, so copying only `leads.db` can miss the newest leads; if you copy the file, copy `leads.db-wal` with it.
|
||||
|
||||
Columns: `id, created_at (UTC), name, email, phone, company, service, referrer, utm_source, utm_medium, utm_campaign`.
|
||||
|
||||
Leads contain personal data (PDPA). Keep exported files out of shared drives and delete them when done.
|
||||
@@ -39,3 +39,17 @@ Admin portal, email notifications, CAPTCHA, analytics, CMS.
|
||||
## Left to the builder
|
||||
|
||||
Visual styling, exact section copy wording (from source site), field length limits.
|
||||
|
||||
## Revision 2026-12-01: hotel technology brief from the page owner
|
||||
|
||||
The page owner supplied a new brief. It replaces the page content and form; storage and deployment are unchanged.
|
||||
|
||||
- Audience: hotel, resort, serviced-apartment and co-living decision-makers. Positioning: "One partner for the connected hotel."
|
||||
- Five services: WiFi Managed Services (Infinity OneBox), Cloud IP PABX (CloudExt), GRE IPTV, Digital Signage, QR Door Locks. Process: Design, Supply, Install, Manage.
|
||||
- Sections: sticky header, hero with form, trust strip, services, how we work, why Infinity, FAQ, final CTA with a second form, footer. Optional "Meet us at" badge, disabled by default.
|
||||
- Form fields, exactly: full name, work email, phone/WhatsApp, company (all required); service interested in (optional select). Free email providers (gmail, yahoo, hotmail, etc.) are rejected with a friendly message, on the page and on the server.
|
||||
- No statistics or client claims; unknown facts use `[PLACEHOLDER]` with a code comment.
|
||||
- Contact: +6019 365 6987, John.goh@infinitynetworks.com.my.
|
||||
- Google Fonts allowed (owner request). Floating WhatsApp/call button on mobile.
|
||||
- Decision (user, 2026-12-01): keep the existing database endpoint instead of the brief's `action="#"` placeholder.
|
||||
- Schema: `industry` and `message` columns replaced by `service`. The local database held only throwaway test data and is recreated.
|
||||
@@ -0,0 +1,4 @@
|
||||
apiVersion: v1
|
||||
kind: Namespace
|
||||
metadata:
|
||||
name: ins-landing-page
|
||||
@@ -0,0 +1,95 @@
|
||||
# Leads live in a SQLite file on this volume. ReadWriteOnce + 1 replica + Recreate: SQLite has a
|
||||
# single writer, so two pods must never hold the file at once (not even during a rollout).
|
||||
apiVersion: v1
|
||||
kind: PersistentVolumeClaim
|
||||
metadata:
|
||||
name: ins-landing-page-data
|
||||
namespace: ins-landing-page
|
||||
spec:
|
||||
storageClassName: longhorn
|
||||
accessModes:
|
||||
- ReadWriteOnce
|
||||
resources:
|
||||
requests:
|
||||
storage: 1Gi
|
||||
---
|
||||
apiVersion: v1
|
||||
kind: Service
|
||||
metadata:
|
||||
name: ins-landing-page
|
||||
namespace: ins-landing-page
|
||||
spec:
|
||||
selector:
|
||||
app: ins-landing-page
|
||||
ports:
|
||||
- name: http
|
||||
port: 3000
|
||||
---
|
||||
apiVersion: apps/v1
|
||||
kind: Deployment
|
||||
metadata:
|
||||
name: ins-landing-page
|
||||
namespace: ins-landing-page
|
||||
spec:
|
||||
replicas: 1
|
||||
strategy:
|
||||
type: Recreate
|
||||
selector:
|
||||
matchLabels:
|
||||
app: ins-landing-page
|
||||
template:
|
||||
metadata:
|
||||
labels:
|
||||
app: ins-landing-page
|
||||
spec:
|
||||
imagePullSecrets:
|
||||
- name: regcred
|
||||
terminationGracePeriodSeconds: 10
|
||||
securityContext:
|
||||
runAsNonRoot: true
|
||||
runAsUser: 1000 # the image's `node` user
|
||||
runAsGroup: 1000
|
||||
fsGroup: 1000 # so the app can write to the Longhorn volume
|
||||
containers:
|
||||
- name: ins-landing-page
|
||||
# One moving tag per profile (CI); the rollout restarts the pod to pull it.
|
||||
image: gitea.containerverse.dev/solvway/ins-landing-page:ins-landing-page-prd-latest
|
||||
imagePullPolicy: Always
|
||||
env:
|
||||
- name: PORT
|
||||
value: "3000"
|
||||
- name: DB_PATH
|
||||
value: /data/leads.db
|
||||
ports:
|
||||
- name: http
|
||||
containerPort: 3000
|
||||
volumeMounts:
|
||||
- name: data
|
||||
mountPath: /data
|
||||
readinessProbe:
|
||||
httpGet:
|
||||
path: /
|
||||
port: http
|
||||
periodSeconds: 10
|
||||
livenessProbe:
|
||||
httpGet:
|
||||
path: /
|
||||
port: http
|
||||
initialDelaySeconds: 10
|
||||
periodSeconds: 30
|
||||
failureThreshold: 3
|
||||
resources:
|
||||
requests:
|
||||
cpu: 20m
|
||||
memory: 48Mi
|
||||
limits:
|
||||
memory: 192Mi
|
||||
securityContext:
|
||||
allowPrivilegeEscalation: false
|
||||
readOnlyRootFilesystem: true
|
||||
capabilities:
|
||||
drop: ["ALL"]
|
||||
volumes:
|
||||
- name: data
|
||||
persistentVolumeClaim:
|
||||
claimName: ins-landing-page-data
|
||||
@@ -0,0 +1,124 @@
|
||||
# Served by Traefik through the Gateway API (GatewayClass `traefik`), the same way as dynamic-qr.
|
||||
# Cloudflare connects to the origin over HTTPS: port 8443 is Traefik's `websecure` entry point
|
||||
# (host port 443), 8000 its `web` entry point (host port 80), which only redirects to HTTPS.
|
||||
#
|
||||
# Let's Encrypt certificate via cert-manager (ClusterIssuer `lets-encrypt`, HTTP-01). The solver
|
||||
# pod runs in this namespace and is allowed in by k8s/60-network-policy.yaml.
|
||||
apiVersion: cert-manager.io/v1
|
||||
kind: Certificate
|
||||
metadata:
|
||||
name: ins-landing-page-tls
|
||||
namespace: ins-landing-page
|
||||
spec:
|
||||
secretName: ins-landing-page-tls
|
||||
issuerRef:
|
||||
group: cert-manager.io
|
||||
kind: ClusterIssuer
|
||||
name: lets-encrypt
|
||||
dnsNames:
|
||||
- ins-landing.containerverse.dev
|
||||
usages:
|
||||
- digital signature
|
||||
- key encipherment
|
||||
---
|
||||
apiVersion: gateway.networking.k8s.io/v1
|
||||
kind: Gateway
|
||||
metadata:
|
||||
name: ins-landing-page
|
||||
namespace: ins-landing-page
|
||||
spec:
|
||||
gatewayClassName: traefik
|
||||
listeners:
|
||||
- name: http
|
||||
protocol: HTTP
|
||||
port: 8000
|
||||
allowedRoutes:
|
||||
namespaces:
|
||||
from: Same
|
||||
- name: websecure
|
||||
protocol: HTTPS
|
||||
port: 8443
|
||||
hostname: ins-landing.containerverse.dev
|
||||
tls:
|
||||
mode: Terminate
|
||||
certificateRefs:
|
||||
- kind: Secret
|
||||
group: ""
|
||||
name: ins-landing-page-tls
|
||||
allowedRoutes:
|
||||
namespaces:
|
||||
from: Same
|
||||
---
|
||||
# Plain HTTP: permanent redirect to HTTPS.
|
||||
apiVersion: gateway.networking.k8s.io/v1
|
||||
kind: HTTPRoute
|
||||
metadata:
|
||||
name: https-redirect
|
||||
namespace: ins-landing-page
|
||||
spec:
|
||||
parentRefs:
|
||||
- name: ins-landing-page
|
||||
sectionName: http
|
||||
hostnames:
|
||||
- ins-landing.containerverse.dev
|
||||
rules:
|
||||
- matches:
|
||||
- path:
|
||||
type: PathPrefix
|
||||
value: /
|
||||
filters:
|
||||
- type: RequestRedirect
|
||||
requestRedirect:
|
||||
scheme: https
|
||||
port: 443
|
||||
statusCode: 301
|
||||
---
|
||||
# The lead form is public; the honeypot only stops naive bots. Limit form posts per visitor so a
|
||||
# script cannot fill the volume. depth: 1 takes the right-most X-Forwarded-For entry, which
|
||||
# Cloudflare sets to the visitor (Traefik keeps that header only from Cloudflare's ranges).
|
||||
apiVersion: traefik.io/v1alpha1
|
||||
kind: Middleware
|
||||
metadata:
|
||||
name: lead-rate-limit
|
||||
namespace: ins-landing-page
|
||||
spec:
|
||||
rateLimit:
|
||||
average: 5
|
||||
period: 1m
|
||||
burst: 5
|
||||
sourceCriterion:
|
||||
ipStrategy:
|
||||
depth: 1
|
||||
---
|
||||
apiVersion: gateway.networking.k8s.io/v1
|
||||
kind: HTTPRoute
|
||||
metadata:
|
||||
name: ins-landing-page
|
||||
namespace: ins-landing-page
|
||||
spec:
|
||||
parentRefs:
|
||||
- name: ins-landing-page
|
||||
sectionName: websecure
|
||||
hostnames:
|
||||
- ins-landing.containerverse.dev
|
||||
rules:
|
||||
- matches:
|
||||
- path:
|
||||
type: Exact
|
||||
value: /api/leads
|
||||
filters:
|
||||
- type: ExtensionRef
|
||||
extensionRef:
|
||||
group: traefik.io
|
||||
kind: Middleware
|
||||
name: lead-rate-limit
|
||||
backendRefs:
|
||||
- name: ins-landing-page
|
||||
port: 3000
|
||||
- matches:
|
||||
- path:
|
||||
type: PathPrefix
|
||||
value: /
|
||||
backendRefs:
|
||||
- name: ins-landing-page
|
||||
port: 3000
|
||||
@@ -0,0 +1,61 @@
|
||||
# Ingress rules for namespace ins-landing-page (enforced by Calico). Everything is denied unless
|
||||
# a policy below allows it. The kubelet's probes come from the pod's own node, which Calico always
|
||||
# allows, so they need no rule.
|
||||
apiVersion: networking.k8s.io/v1
|
||||
kind: NetworkPolicy
|
||||
metadata:
|
||||
name: default-deny-ingress
|
||||
namespace: ins-landing-page
|
||||
spec:
|
||||
podSelector: {}
|
||||
policyTypes:
|
||||
- Ingress
|
||||
---
|
||||
# Traefik (MicroK8s ingress addon, namespace `ingress`) to the app.
|
||||
apiVersion: networking.k8s.io/v1
|
||||
kind: NetworkPolicy
|
||||
metadata:
|
||||
name: app-from-traefik
|
||||
namespace: ins-landing-page
|
||||
spec:
|
||||
podSelector:
|
||||
matchLabels:
|
||||
app: ins-landing-page
|
||||
policyTypes:
|
||||
- Ingress
|
||||
ingress:
|
||||
- from:
|
||||
- namespaceSelector:
|
||||
matchLabels:
|
||||
kubernetes.io/metadata.name: ingress
|
||||
podSelector:
|
||||
matchLabels:
|
||||
app.kubernetes.io/name: traefik
|
||||
ports:
|
||||
- protocol: TCP
|
||||
port: 3000
|
||||
---
|
||||
# cert-manager's HTTP-01 solver pod: Traefik must reach it, or the certificate cannot be issued
|
||||
# or renewed.
|
||||
apiVersion: networking.k8s.io/v1
|
||||
kind: NetworkPolicy
|
||||
metadata:
|
||||
name: acme-solver-from-traefik
|
||||
namespace: ins-landing-page
|
||||
spec:
|
||||
podSelector:
|
||||
matchLabels:
|
||||
acme.cert-manager.io/http01-solver: "true"
|
||||
policyTypes:
|
||||
- Ingress
|
||||
ingress:
|
||||
- from:
|
||||
- namespaceSelector:
|
||||
matchLabels:
|
||||
kubernetes.io/metadata.name: ingress
|
||||
podSelector:
|
||||
matchLabels:
|
||||
app.kubernetes.io/name: traefik
|
||||
ports:
|
||||
- protocol: TCP
|
||||
port: 8089
|
||||
@@ -0,0 +1,9 @@
|
||||
{
|
||||
"name": "ins-landing-page",
|
||||
"private": true,
|
||||
"engines": { "node": ">=22.13" },
|
||||
"scripts": {
|
||||
"start": "node server.js",
|
||||
"test": "node --test"
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,541 @@
|
||||
<!doctype html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||
<title>Hotel Technology, One Partner | Infinity Networks Security</title>
|
||||
<meta name="description" content="WiFi, cloud phones, IPTV, digital signage and QR door locks for hotels, designed, supplied, installed and managed by one Malaysian team. Get a free consultation.">
|
||||
<meta property="og:type" content="website">
|
||||
<meta property="og:title" content="One partner for the connected hotel | Infinity Networks Security">
|
||||
<meta property="og:description" content="WiFi, cloud phones, IPTV, digital signage and QR door locks for hotels, managed by one local team.">
|
||||
<!-- [PLACEHOLDER] set og:url to the live page address -->
|
||||
<meta property="og:url" content="https://www.infinitynetworks.com.my/">
|
||||
<!-- [PLACEHOLDER] add a 1200x630 share image: <meta property="og:image" content="https://.../og-image.jpg"> -->
|
||||
<link rel="preconnect" href="https://fonts.googleapis.com">
|
||||
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
|
||||
<link href="https://fonts.googleapis.com/css2?family=Fraunces:opsz,wght@9..144,500;9..144,600&family=Inter:wght@400;500;600;700&display=swap" rel="stylesheet">
|
||||
<style>
|
||||
:root {
|
||||
--midnight: #0a1a2c;
|
||||
--navy: #10294a;
|
||||
--gold: #e0b04a;
|
||||
--gold-ink: #7d5a10;
|
||||
--ink: #1c2530;
|
||||
--muted: #55616d;
|
||||
--line: #e2e6ea;
|
||||
--paper: #ffffff;
|
||||
--mist: #f5f6f4;
|
||||
--ok: #1d7a46;
|
||||
--err: #b3261e;
|
||||
--display: "Fraunces", Georgia, serif;
|
||||
--body: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
|
||||
}
|
||||
* { box-sizing: border-box; }
|
||||
html { scroll-behavior: smooth; scroll-padding-top: 80px; }
|
||||
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }
|
||||
body { margin: 0; font: 16px/1.65 var(--body); color: var(--ink); background: var(--paper); }
|
||||
h1, h2, h3 { margin: 0 0 .5em; line-height: 1.15; }
|
||||
h1, h2 { font-family: var(--display); font-weight: 600; letter-spacing: -.01em; }
|
||||
h3 { font-size: 1.15rem; font-weight: 600; }
|
||||
p { margin: 0 0 1em; }
|
||||
a { color: inherit; }
|
||||
.wrap { max-width: 1160px; margin: 0 auto; padding: 0 20px; }
|
||||
.label { font-size: .78rem; font-weight: 600; letter-spacing: .12em; text-transform: uppercase; color: var(--gold-ink); margin-bottom: 12px; }
|
||||
.on-dark .label { color: var(--gold); }
|
||||
|
||||
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; background: var(--gold); color: var(--midnight); font: 600 1rem var(--body); text-decoration: none; padding: 13px 24px; border-radius: 999px; border: 0; cursor: pointer; transition: transform .15s ease, box-shadow .15s ease; }
|
||||
.btn:hover { transform: translateY(-1px); box-shadow: 0 6px 16px rgba(0,0,0,.18); }
|
||||
.btn:focus-visible, input:focus-visible, select:focus-visible, summary:focus-visible, a:focus-visible { outline: 3px solid var(--gold); outline-offset: 2px; }
|
||||
|
||||
/* Header */
|
||||
header { position: sticky; top: 0; z-index: 20; background: rgba(255,255,255,.96); backdrop-filter: blur(8px); border-bottom: 1px solid var(--line); }
|
||||
header .wrap { display: flex; align-items: center; justify-content: space-between; height: 68px; }
|
||||
header img { height: 42px; width: auto; display: block; }
|
||||
header .btn { padding: 10px 18px; font-size: .92rem; }
|
||||
@media (max-width: 420px) { header .btn { padding: 9px 14px; font-size: .85rem; } }
|
||||
|
||||
/* Hero */
|
||||
.hero { position: relative; overflow: hidden; color: #fff; background: linear-gradient(160deg, var(--navy), var(--midnight)); padding: 72px 0 88px; }
|
||||
.hero .net { position: absolute; inset: 0; width: 100%; height: 100%; opacity: .18; pointer-events: none; }
|
||||
.hero .wrap { position: relative; display: grid; grid-template-columns: 1.05fr .95fr; gap: 56px; align-items: center; }
|
||||
.hero h1 { font-size: clamp(2.3rem, 5vw, 3.6rem); }
|
||||
.hero .sub { font-size: 1.15rem; color: #d5dde6; max-width: 32em; }
|
||||
.hero .points { list-style: none; padding: 0; margin: 28px 0 0; display: grid; gap: 10px; color: #e6ebf0; }
|
||||
.hero .points li { display: flex; gap: 10px; align-items: baseline; }
|
||||
.hero .points li::before { content: ""; flex: none; width: 8px; height: 8px; border-radius: 50%; background: var(--gold); transform: translateY(-2px); }
|
||||
.badge { display: inline-block; margin-bottom: 20px; padding: 6px 14px; border: 1px solid rgba(224,176,74,.5); border-radius: 999px; color: var(--gold); font-size: .85rem; }
|
||||
@media (max-width: 920px) { .hero { padding: 48px 0 56px; } .hero .wrap { grid-template-columns: 1fr; gap: 32px; } }
|
||||
|
||||
/* Form */
|
||||
.form-card { background: #fff; color: var(--ink); border-radius: 16px; padding: 28px; box-shadow: 0 24px 60px rgba(0,0,0,.35); }
|
||||
.form-card h2 { font-size: 1.5rem; color: var(--navy); margin-bottom: .25em; }
|
||||
.form-card .intro { color: var(--muted); font-size: .95rem; }
|
||||
.field { margin-bottom: 14px; }
|
||||
.field label { display: block; font-size: .88rem; font-weight: 600; margin-bottom: 4px; }
|
||||
.field label .opt { font-weight: 400; color: var(--muted); }
|
||||
.field input, .field select { display: block; width: 100%; padding: 12px 14px; border: 1px solid #c3cad2; border-radius: 10px; font: 1rem var(--body); color: inherit; background: #fff; min-height: 48px; }
|
||||
.field input[aria-invalid="true"] { border-color: var(--err); }
|
||||
.field .error { color: var(--err); font-size: .83rem; margin: 4px 0 0; }
|
||||
.field .error:empty { display: none; }
|
||||
.hp { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }
|
||||
.lead-form .btn { width: 100%; padding: 15px; margin-top: 4px; }
|
||||
.lead-form .btn[disabled] { opacity: .6; cursor: wait; transform: none; box-shadow: none; }
|
||||
.next { font-size: .85rem; color: var(--muted); margin: 12px 0 4px; }
|
||||
.privacy { font-size: .78rem; color: var(--muted); margin: 0; }
|
||||
.form-status { font-weight: 600; font-size: .95rem; margin: 12px 0 0; }
|
||||
.form-status.err { color: var(--err); }
|
||||
.form-status:empty { display: none; }
|
||||
.success { text-align: center; padding: 24px 8px; }
|
||||
.success svg { width: 56px; height: 56px; color: var(--ok); }
|
||||
.success h3 { color: var(--navy); font-family: var(--display); font-size: 1.5rem; margin-top: 12px; }
|
||||
|
||||
/* Trust strip */
|
||||
.trust { background: var(--mist); border-bottom: 1px solid var(--line); }
|
||||
.trust ul { list-style: none; margin: 0 auto; padding: 22px 20px; display: flex; flex-wrap: wrap; justify-content: center; gap: 12px 40px; font-weight: 600; color: var(--navy); font-size: .95rem; text-align: center; }
|
||||
|
||||
/* Sections */
|
||||
section { padding: 88px 0; }
|
||||
.head { max-width: 640px; margin-bottom: 44px; }
|
||||
.head h2 { font-size: clamp(1.8rem, 3.4vw, 2.6rem); color: var(--navy); }
|
||||
.head p { color: var(--muted); font-size: 1.05rem; }
|
||||
@media (max-width: 700px) { section { padding: 64px 0; } }
|
||||
|
||||
.services { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 16px; }
|
||||
.svc { border: 1px solid var(--line); border-radius: 14px; padding: 26px 22px; background: #fff; transition: transform .2s ease, box-shadow .2s ease, border-color .2s ease; }
|
||||
.svc:hover { transform: translateY(-3px); box-shadow: 0 14px 30px rgba(16,41,74,.1); border-color: #cfd6de; }
|
||||
.svc { display: grid; grid-template-columns: 26px 1fr; column-gap: 12px; align-content: start; }
|
||||
.svc .icon { color: var(--gold-ink); grid-row: 1; align-self: center; display: flex; }
|
||||
.svc .icon svg { width: 26px; height: 26px; }
|
||||
.svc h3 { grid-column: 2; grid-row: 1; margin: 0; }
|
||||
.svc p { grid-column: 1 / -1; }
|
||||
.svc h3 { color: var(--navy); margin-bottom: .35em; }
|
||||
.svc .tag { font-size: .8rem; color: var(--muted); margin-bottom: .6em; }
|
||||
.svc p { color: var(--muted); font-size: .95rem; margin: 0; }
|
||||
.svc p.tag { margin: .5em 0 .6em; }
|
||||
|
||||
.steps { list-style: none; padding: 0; margin: 0; display: grid; grid-template-columns: repeat(4, 1fr); counter-reset: s; }
|
||||
.steps li { counter-increment: s; position: relative; padding: 56px 24px 0 0; }
|
||||
.steps li::before { content: counter(s); position: absolute; top: 0; left: 0; width: 36px; height: 36px; border-radius: 50%; background: var(--gold); color: var(--midnight); font-weight: 700; display: grid; place-items: center; }
|
||||
.steps li::after { content: ""; position: absolute; top: 18px; left: 44px; right: 8px; height: 1px; background: rgba(255,255,255,.25); }
|
||||
.steps li:last-child::after { display: none; }
|
||||
.steps h3 { color: #fff; }
|
||||
.steps p { color: #c7d1db; font-size: .95rem; }
|
||||
@media (max-width: 800px) {
|
||||
.steps { grid-template-columns: 1fr; gap: 28px; }
|
||||
.steps li { padding: 0 0 0 56px; }
|
||||
.steps li::after { top: 44px; bottom: -24px; left: 18px; right: auto; width: 1px; height: auto; }
|
||||
}
|
||||
.dark { background: linear-gradient(160deg, var(--navy), var(--midnight)); color: #fff; }
|
||||
.dark .head h2 { color: #fff; }
|
||||
.dark .head p { color: #c7d1db; }
|
||||
|
||||
.why { display: grid; grid-template-columns: 1fr 1fr; gap: 56px; align-items: center; }
|
||||
.why ul { list-style: none; padding: 0; margin: 0; display: grid; gap: 22px; }
|
||||
.why li { display: grid; grid-template-columns: 28px 1fr; gap: 14px; }
|
||||
.why li svg { width: 24px; height: 24px; color: var(--gold-ink); margin-top: 2px; }
|
||||
.why li strong { display: block; color: var(--navy); }
|
||||
.why li span { color: var(--muted); font-size: .95rem; }
|
||||
.img-ph { aspect-ratio: 4 / 5; border-radius: 18px; border: 2px dashed #c3cad2; background: repeating-linear-gradient(135deg, var(--mist) 0 14px, #eef0ee 14px 28px); display: grid; place-items: center; color: var(--muted); font-size: .9rem; text-align: center; padding: 20px; }
|
||||
@media (max-width: 860px) { .why { grid-template-columns: 1fr; } .img-ph { aspect-ratio: 16 / 9; } }
|
||||
|
||||
.faq { max-width: 780px; }
|
||||
.faq details { border-bottom: 1px solid var(--line); }
|
||||
.faq summary { cursor: pointer; list-style: none; padding: 20px 36px 20px 0; font-weight: 600; color: var(--navy); position: relative; font-size: 1.05rem; }
|
||||
.faq summary::-webkit-details-marker { display: none; }
|
||||
.faq summary::after { content: "+"; position: absolute; right: 4px; top: 16px; font-size: 1.5rem; color: var(--gold-ink); transition: transform .2s ease; }
|
||||
.faq details[open] summary::after { transform: rotate(45deg); }
|
||||
.faq details p { color: var(--muted); padding-right: 36px; }
|
||||
|
||||
.final .wrap { display: grid; grid-template-columns: 1fr 1fr; gap: 56px; align-items: center; }
|
||||
.final .reveal h2 { font-size: clamp(1.9rem, 3.6vw, 2.8rem); }
|
||||
.final .reveal p { color: #c7d1db; font-size: 1.05rem; }
|
||||
@media (max-width: 920px) { .final .wrap { grid-template-columns: 1fr; gap: 32px; } }
|
||||
|
||||
footer { background: #061220; color: #b9c4cf; font-size: .92rem; padding: 48px 0 96px; }
|
||||
footer .cols { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 28px; }
|
||||
footer strong { color: #fff; display: block; margin-bottom: 6px; }
|
||||
footer a { color: var(--gold); text-decoration: none; }
|
||||
footer a:hover { text-decoration: underline; }
|
||||
footer .legal { margin-top: 32px; padding-top: 16px; border-top: 1px solid rgba(255,255,255,.1); font-size: .8rem; color: #8f9eac; }
|
||||
@media (min-width: 761px) { footer { padding-bottom: 32px; } }
|
||||
|
||||
/* Floating contact (mobile) */
|
||||
.float { position: fixed; left: 12px; right: 12px; bottom: 12px; z-index: 30; display: none; gap: 10px; }
|
||||
.float a { flex: 1; display: flex; align-items: center; justify-content: center; gap: 8px; padding: 13px; border-radius: 999px; font-weight: 600; text-decoration: none; box-shadow: 0 8px 24px rgba(0,0,0,.25); }
|
||||
.float svg { width: 20px; height: 20px; }
|
||||
.float .wa { background: #1f7a4d; color: #fff; }
|
||||
.float .call { background: var(--midnight); color: #fff; }
|
||||
@media (max-width: 760px) { .float { display: flex; } }
|
||||
|
||||
/* Scroll reveal: content stays visible if JS is off or motion is reduced */
|
||||
.js .reveal { opacity: 0; transform: translateY(16px); transition: opacity .6s ease, transform .6s ease; }
|
||||
.js .reveal.in { opacity: 1; transform: none; }
|
||||
@media (prefers-reduced-motion: reduce) { .js .reveal { opacity: 1; transform: none; transition: none; } }
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<script>document.documentElement.classList.add('js');</script>
|
||||
|
||||
<header>
|
||||
<div class="wrap">
|
||||
<a href="#top" aria-label="Infinity Networks Security, back to top"><img src="/logo.png" alt="Infinity Networks Security" width="170" height="65"></a>
|
||||
<a class="btn" href="#consult">Get My Free Consultation</a>
|
||||
</div>
|
||||
</header>
|
||||
|
||||
<main id="top">
|
||||
<section class="hero on-dark" aria-labelledby="hero-title">
|
||||
<!-- abstract connectivity pattern -->
|
||||
<svg class="net" viewBox="0 0 1200 600" preserveAspectRatio="xMidYMid slice" aria-hidden="true">
|
||||
<g stroke="#e0b04a" stroke-width="1" fill="none">
|
||||
<path d="M80 480 L260 360 L420 420 L600 260 L780 320 L960 160 L1140 220"/>
|
||||
<path d="M260 360 L340 180 L600 260 M780 320 L860 500 L1040 420 L960 160"/>
|
||||
<path d="M420 420 L520 560 M600 260 L700 80 L960 160"/>
|
||||
</g>
|
||||
<g fill="#e0b04a">
|
||||
<circle cx="80" cy="480" r="4"/><circle cx="260" cy="360" r="5"/><circle cx="420" cy="420" r="4"/>
|
||||
<circle cx="600" cy="260" r="6"/><circle cx="780" cy="320" r="4"/><circle cx="960" cy="160" r="5"/>
|
||||
<circle cx="1140" cy="220" r="4"/><circle cx="340" cy="180" r="3"/><circle cx="860" cy="500" r="3"/>
|
||||
<circle cx="1040" cy="420" r="4"/><circle cx="520" cy="560" r="3"/><circle cx="700" cy="80" r="4"/>
|
||||
</g>
|
||||
</svg>
|
||||
<div class="wrap">
|
||||
<div>
|
||||
<!-- [PLACEHOLDER] Optional event badge. To show it, move the line below out of this comment and fill it in.
|
||||
<span class="badge">Meet us at [EVENT] · [DATE] · [VENUE]</span>
|
||||
-->
|
||||
<h1 id="hero-title">One partner for the connected hotel.</h1>
|
||||
<p class="sub">WiFi, phones, in-room TV, signage and door locks, designed, installed and managed by one local team so yours can focus on guests.</p>
|
||||
<ul class="points">
|
||||
<li>One accountable partner instead of five vendors</li>
|
||||
<li>Cloud-managed, so updates and fixes happen remotely</li>
|
||||
<li>Local support team in Malaysia</li>
|
||||
</ul>
|
||||
</div>
|
||||
<div class="form-card" id="consult">
|
||||
<h2>Get a free consultation</h2>
|
||||
<p class="intro">Tell us about your property. It takes under a minute.</p>
|
||||
<!-- The form posts to this site's own server (POST /api/leads), which stores each lead in the database. -->
|
||||
<form class="lead-form" novalidate>
|
||||
<div class="field">
|
||||
<label for="h-name">Full name</label>
|
||||
<input id="h-name" name="name" required maxlength="200" autocomplete="name">
|
||||
<p class="error" id="h-name-err"></p>
|
||||
</div>
|
||||
<div class="field">
|
||||
<label for="h-email">Work email</label>
|
||||
<input id="h-email" name="email" type="email" required maxlength="200" autocomplete="email" inputmode="email">
|
||||
<p class="error" id="h-email-err"></p>
|
||||
</div>
|
||||
<div class="field">
|
||||
<label for="h-phone">Phone / WhatsApp</label>
|
||||
<input id="h-phone" name="phone" type="tel" required maxlength="200" autocomplete="tel" inputmode="tel">
|
||||
<p class="error" id="h-phone-err"></p>
|
||||
</div>
|
||||
<div class="field">
|
||||
<label for="h-company">Company name</label>
|
||||
<input id="h-company" name="company" required maxlength="200" autocomplete="organization">
|
||||
<p class="error" id="h-company-err"></p>
|
||||
</div>
|
||||
<div class="field">
|
||||
<label for="h-service">Service interested in <span class="opt">(optional)</span></label>
|
||||
<select id="h-service" name="service">
|
||||
<option value="">Choose a service</option>
|
||||
<option>WiFi Managed Services</option>
|
||||
<option>Cloud IP PABX</option>
|
||||
<option>GRE IPTV</option>
|
||||
<option>Digital Signage</option>
|
||||
<option>QR Door Locks</option>
|
||||
<option>Not sure yet</option>
|
||||
</select>
|
||||
</div>
|
||||
<div class="hp" aria-hidden="true"><label>Leave blank <input name="website" tabindex="-1" autocomplete="off"></label></div>
|
||||
<input type="hidden" name="utm_source"><input type="hidden" name="utm_medium"><input type="hidden" name="utm_campaign"><input type="hidden" name="referrer">
|
||||
<button class="btn" type="submit">Get My Free Consultation</button>
|
||||
<p class="form-status" role="alert"></p>
|
||||
<!-- [PLACEHOLDER] confirm the follow-up timeframe (also in the second form below) -->
|
||||
<p class="next">A specialist will call or WhatsApp you within [PLACEHOLDER: 1 business day] to understand your property.</p>
|
||||
<p class="privacy">We only use your details to respond to this enquiry.</p>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
|
||||
<div class="trust" aria-label="Why hotels trust us">
|
||||
<ul class="wrap">
|
||||
<li>Certified with LG · Samsung · Philips</li>
|
||||
<li>Design • Supply • Install • Manage</li>
|
||||
<li>Malaysian-based local support</li>
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
<section id="services" aria-labelledby="svc-title">
|
||||
<div class="wrap">
|
||||
<div class="head reveal">
|
||||
<p class="label">Services</p>
|
||||
<h2 id="svc-title">Everything your guests touch, handled by one team</h2>
|
||||
<p>Pick one service or bring them all together. Either way, you get one point of contact.</p>
|
||||
</div>
|
||||
<div class="services">
|
||||
<article class="svc reveal">
|
||||
<div class="icon" aria-hidden="true"><svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round"><path d="M2 8.5a15 15 0 0 1 20 0"/><path d="M5 12a10 10 0 0 1 14 0"/><path d="M8.5 15.5a5 5 0 0 1 7 0"/><circle cx="12" cy="19" r="1" fill="currentColor"/></svg></div>
|
||||
<h3>WiFi Managed Services</h3>
|
||||
<p class="tag">Infinity OneBox</p>
|
||||
<p>Fast, reliable WiFi in every room and back office, monitored around the clock so problems are fixed before guests complain.</p>
|
||||
</article>
|
||||
<article class="svc reveal">
|
||||
<div class="icon" aria-hidden="true"><svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M5 4h4l2 5-2.5 1.5a11 11 0 0 0 5 5L15 13l5 2v4a2 2 0 0 1-2 2A16 16 0 0 1 3 6a2 2 0 0 1 2-2"/></svg></div>
|
||||
<h3>Cloud IP PABX</h3>
|
||||
<p class="tag">CloudExt</p>
|
||||
<p>Replace your ageing phone system without ripping it out. Front-desk features, wake-up calls and call reports, all in the cloud.</p>
|
||||
</article>
|
||||
<article class="svc reveal">
|
||||
<div class="icon" aria-hidden="true"><svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><rect x="2" y="4" width="20" height="13" rx="2"/><path d="M8 21h8M12 17v4"/></svg></div>
|
||||
<h3>GRE IPTV</h3>
|
||||
<p class="tag">Works with LG, Samsung, Philips</p>
|
||||
<p>In-room TV with your own welcome screen, and guests can cast from their phones, all over the network you already have.</p>
|
||||
</article>
|
||||
<article class="svc reveal">
|
||||
<div class="icon" aria-hidden="true"><svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><rect x="3" y="3" width="18" height="12" rx="1.5"/><path d="M12 15v6M8 21h8M7 7h6M7 10h10"/></svg></div>
|
||||
<h3>Digital Signage</h3>
|
||||
<p class="tag">Lobby, meeting rooms, F&B</p>
|
||||
<p>Keep meeting schedules, wayfinding, promotions and menus up to date from one dashboard, with no reprinting.</p>
|
||||
</article>
|
||||
<article class="svc reveal">
|
||||
<div class="icon" aria-hidden="true"><svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><rect x="4" y="10" width="16" height="11" rx="2"/><path d="M8 10V7a4 4 0 0 1 8 0v3"/><path d="M9 14h2v2H9zM13 14h2M13 17h2v1"/></svg></div>
|
||||
<h3>QR Door Locks</h3>
|
||||
<p class="tag">Hotels, serviced apartments, co-living</p>
|
||||
<p>Contactless entry. Issue or revoke keys remotely, with a full record of who opened which door and when.</p>
|
||||
</article>
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
|
||||
<section class="dark on-dark" aria-labelledby="how-title">
|
||||
<div class="wrap">
|
||||
<div class="head reveal">
|
||||
<p class="label">How we work</p>
|
||||
<h2 id="how-title">From first survey to day-to-day care</h2>
|
||||
<p>One team carries your project from start to finish, so nothing falls between vendors.</p>
|
||||
</div>
|
||||
<ol class="steps">
|
||||
<li class="reveal"><h3>Design</h3><p>We survey your property and plan around your guests, your building and your budget.</p></li>
|
||||
<li class="reveal"><h3>Supply</h3><p>We source the right equipment, reusing what you already have where it makes sense.</p></li>
|
||||
<li class="reveal"><h3>Install</h3><p>Our engineers install and test on site, scheduled around your occupancy.</p></li>
|
||||
<li class="reveal"><h3>Manage</h3><p>We monitor, update and support everything after go-live, so your team doesn't have to.</p></li>
|
||||
</ol>
|
||||
</div>
|
||||
</section>
|
||||
|
||||
<section aria-labelledby="why-title">
|
||||
<div class="wrap why">
|
||||
<div>
|
||||
<div class="head reveal" style="margin-bottom:32px">
|
||||
<p class="label">Why Infinity</p>
|
||||
<h2 id="why-title">Fewer vendors. Fewer headaches.</h2>
|
||||
</div>
|
||||
<ul>
|
||||
<li class="reveal"><svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M5 12l5 5L20 7"/></svg><div><strong>One accountable partner</strong><span>One number to call for WiFi, phones, TV, signage and locks.</span></div></li>
|
||||
<li class="reveal"><svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M5 12l5 5L20 7"/></svg><div><strong>Lower total cost</strong><span>Consolidating vendors cuts duplicated contracts and support fees.</span></div></li>
|
||||
<li class="reveal"><svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M5 12l5 5L20 7"/></svg><div><strong>Better guest experience</strong><span>Systems that work together, so guests notice comfort, not technology.</span></div></li>
|
||||
<li class="reveal"><svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M5 12l5 5L20 7"/></svg><div><strong>Cloud-managed, future-ready</strong><span>Remote updates and monitoring, with room to add services later.</span></div></li>
|
||||
<li class="reveal"><svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M5 12l5 5L20 7"/></svg><div><strong>Local support in Malaysia</strong><span>A team in your time zone who can be on site when needed.</span></div></li>
|
||||
<li class="reveal"><svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M5 12l5 5L20 7"/></svg><div><strong>Built for multiple properties</strong><span>A proven rollout playbook to bring every site up to the same standard.</span></div></li>
|
||||
</ul>
|
||||
</div>
|
||||
<!-- [PLACEHOLDER] Replace with a hotel photo, e.g. <img src="/hotel.jpg" alt="..." style="width:100%;border-radius:18px">, and add the file to PAGES in server.js -->
|
||||
<div class="img-ph reveal" role="img" aria-label="Hotel photo placeholder">Hotel photo placeholder<br>(lobby or guest room, 4:5)</div>
|
||||
</div>
|
||||
</section>
|
||||
|
||||
<section style="background:var(--mist)" aria-labelledby="faq-title">
|
||||
<div class="wrap">
|
||||
<div class="head reveal">
|
||||
<p class="label">FAQ</p>
|
||||
<h2 id="faq-title">Questions hotels ask us</h2>
|
||||
</div>
|
||||
<div class="faq">
|
||||
<details>
|
||||
<summary>Can you work with our existing cabling and equipment?</summary>
|
||||
<p>Often, yes. We survey first and reuse cabling and equipment wherever it is sound. Our cloud phone migration, for example, is designed to avoid a rip-and-replace.</p>
|
||||
</details>
|
||||
<details>
|
||||
<summary>Do you support groups with multiple properties?</summary>
|
||||
<p>Yes. We use a proven rollout playbook so every property gets the same setup and standard, and everything is managed centrally from the cloud.</p>
|
||||
</details>
|
||||
<details>
|
||||
<summary>How long does installation take?</summary>
|
||||
<!-- [PLACEHOLDER] confirm typical timelines with the delivery team -->
|
||||
<p>It depends on the size of the property and the services you choose. As a guide, [PLACEHOLDER: typical timeline]. We schedule work around your occupancy to keep disruption to guests low.</p>
|
||||
</details>
|
||||
<details>
|
||||
<summary>Is support local?</summary>
|
||||
<p>Yes. Our team is based in Malaysia, with offices in Petaling Jaya and Penang.</p>
|
||||
</details>
|
||||
<details>
|
||||
<summary>Can I choose just one service?</summary>
|
||||
<p>Absolutely. Many hotels start with one service, such as WiFi or phones, and add more later. You still get one point of contact.</p>
|
||||
</details>
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
|
||||
<section class="dark on-dark final" aria-labelledby="final-title">
|
||||
<div class="wrap">
|
||||
<div class="reveal">
|
||||
<p class="label">Free consultation</p>
|
||||
<h2 id="final-title">Let's make your hotel easier to run.</h2>
|
||||
<p>Tell us what you have today and what's not working. We'll come back with a practical plan, with no obligation.</p>
|
||||
</div>
|
||||
<div class="form-card">
|
||||
<h2>Get a free consultation</h2>
|
||||
<p class="intro">Tell us about your property. It takes under a minute.</p>
|
||||
<form class="lead-form" novalidate>
|
||||
<div class="field">
|
||||
<label for="f-name">Full name</label>
|
||||
<input id="f-name" name="name" required maxlength="200" autocomplete="name">
|
||||
<p class="error" id="f-name-err"></p>
|
||||
</div>
|
||||
<div class="field">
|
||||
<label for="f-email">Work email</label>
|
||||
<input id="f-email" name="email" type="email" required maxlength="200" autocomplete="email" inputmode="email">
|
||||
<p class="error" id="f-email-err"></p>
|
||||
</div>
|
||||
<div class="field">
|
||||
<label for="f-phone">Phone / WhatsApp</label>
|
||||
<input id="f-phone" name="phone" type="tel" required maxlength="200" autocomplete="tel" inputmode="tel">
|
||||
<p class="error" id="f-phone-err"></p>
|
||||
</div>
|
||||
<div class="field">
|
||||
<label for="f-company">Company name</label>
|
||||
<input id="f-company" name="company" required maxlength="200" autocomplete="organization">
|
||||
<p class="error" id="f-company-err"></p>
|
||||
</div>
|
||||
<div class="field">
|
||||
<label for="f-service">Service interested in <span class="opt">(optional)</span></label>
|
||||
<select id="f-service" name="service">
|
||||
<option value="">Choose a service</option>
|
||||
<option>WiFi Managed Services</option>
|
||||
<option>Cloud IP PABX</option>
|
||||
<option>GRE IPTV</option>
|
||||
<option>Digital Signage</option>
|
||||
<option>QR Door Locks</option>
|
||||
<option>Not sure yet</option>
|
||||
</select>
|
||||
</div>
|
||||
<div class="hp" aria-hidden="true"><label>Leave blank <input name="website" tabindex="-1" autocomplete="off"></label></div>
|
||||
<input type="hidden" name="utm_source"><input type="hidden" name="utm_medium"><input type="hidden" name="utm_campaign"><input type="hidden" name="referrer">
|
||||
<button class="btn" type="submit">Get My Free Consultation</button>
|
||||
<p class="form-status" role="alert"></p>
|
||||
<p class="next">A specialist will call or WhatsApp you within [PLACEHOLDER: 1 business day] to understand your property.</p>
|
||||
<p class="privacy">We only use your details to respond to this enquiry.</p>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
</main>
|
||||
|
||||
<footer>
|
||||
<div class="wrap">
|
||||
<div class="cols">
|
||||
<div>
|
||||
<strong>Infinity Networks Security Sdn Bhd</strong>
|
||||
Unit 2-6, Infinity Tower,<br>Petaling Jaya, Malaysia
|
||||
</div>
|
||||
<div>
|
||||
<strong>Talk to us</strong>
|
||||
<a href="tel:+60193656987">+6019 365 6987</a><br>
|
||||
<a href="mailto:John.goh@infinitynetworks.com.my">John.goh@infinitynetworks.com.my</a>
|
||||
</div>
|
||||
<div>
|
||||
<strong>Website</strong>
|
||||
<a href="https://www.infinitynetworks.com.my/">www.infinitynetworks.com.my</a>
|
||||
</div>
|
||||
</div>
|
||||
<p class="legal">© <span class="year">2026</span> Infinity Networks Security Sdn Bhd. All rights reserved.</p>
|
||||
</div>
|
||||
</footer>
|
||||
|
||||
<div class="float" aria-label="Quick contact">
|
||||
<a class="wa" href="https://wa.me/60193656987" target="_blank" rel="noopener">
|
||||
<svg viewBox="0 0 24 24" fill="currentColor" aria-hidden="true"><path d="M12 2a10 10 0 0 0-8.6 15.1L2 22l5-1.3A10 10 0 1 0 12 2zm0 18.2a8.2 8.2 0 0 1-4.2-1.2l-.3-.2-3 .8.8-2.9-.2-.3A8.2 8.2 0 1 1 12 20.2zm4.5-6.1c-.2-.1-1.5-.7-1.7-.8s-.4-.1-.6.1-.7.8-.8 1-.3.2-.5.1a6.7 6.7 0 0 1-3.3-2.9c-.3-.4.2-.4.7-1.3.1-.2 0-.3 0-.4l-.8-1.8c-.2-.5-.4-.4-.6-.4h-.5a1 1 0 0 0-.7.3 3 3 0 0 0-.9 2.2 5.2 5.2 0 0 0 1.1 2.7 11.8 11.8 0 0 0 4.5 4c1.7.7 2.3.8 3.2.6a2.7 2.7 0 0 0 1.7-1.2 2.2 2.2 0 0 0 .2-1.2c-.1-.1-.3-.2-.5-.3z"/></svg>
|
||||
WhatsApp
|
||||
</a>
|
||||
<a class="call" href="tel:+60193656987">
|
||||
<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M5 4h4l2 5-2.5 1.5a11 11 0 0 0 5 5L15 13l5 2v4a2 2 0 0 1-2 2A16 16 0 0 1 3 6a2 2 0 0 1 2-2"/></svg>
|
||||
Call us
|
||||
</a>
|
||||
</div>
|
||||
|
||||
<script>
|
||||
document.querySelectorAll('.year').forEach((el) => { el.textContent = new Date().getFullYear(); });
|
||||
|
||||
// Scroll reveal
|
||||
if ('IntersectionObserver' in window) {
|
||||
const io = new IntersectionObserver((entries) => entries.forEach((e) => {
|
||||
if (e.isIntersecting) { e.target.classList.add('in'); io.unobserve(e.target); }
|
||||
}), { threshold: 0.12 });
|
||||
document.querySelectorAll('.reveal').forEach((el) => io.observe(el));
|
||||
} else {
|
||||
document.querySelectorAll('.reveal').forEach((el) => el.classList.add('in'));
|
||||
}
|
||||
|
||||
// Keep this list in sync with FREE_EMAIL in server.js
|
||||
const FREE_EMAIL = /@(gmail|googlemail|yahoo|ymail|rocketmail|hotmail|outlook|live|msn|icloud|me|mac|aol|protonmail|proton|gmx|yandex|zoho)\.[a-z.]+$/i;
|
||||
const EMAIL = /^[^\s@]+@[^\s@]+\.[^\s@]+$/;
|
||||
|
||||
function checkField(input) {
|
||||
const v = input.value.trim();
|
||||
let msg = '';
|
||||
if (input.required && !v) msg = 'Please fill this in.';
|
||||
else if (input.name === 'email' && !EMAIL.test(v)) msg = 'Please enter a valid email address.';
|
||||
else if (input.name === 'email' && FREE_EMAIL.test(v)) msg = 'Please use your work email so our team can reach the right person.';
|
||||
const err = document.getElementById(input.id + '-err');
|
||||
if (err) err.textContent = msg;
|
||||
input.setAttribute('aria-invalid', msg ? 'true' : 'false');
|
||||
if (msg) input.setAttribute('aria-describedby', input.id + '-err'); else input.removeAttribute('aria-describedby');
|
||||
return !msg;
|
||||
}
|
||||
|
||||
// Capture UTM parameters and the referring site into every form's hidden fields
|
||||
const params = new URLSearchParams(location.search);
|
||||
document.querySelectorAll('.lead-form').forEach((form) => {
|
||||
for (const k of ['utm_source', 'utm_medium', 'utm_campaign']) form.elements[k].value = params.get(k) || '';
|
||||
form.elements.referrer.value = document.referrer;
|
||||
|
||||
const inputs = [...form.querySelectorAll('input[required]')];
|
||||
inputs.forEach((input) => {
|
||||
input.addEventListener('blur', () => { if (input.value) checkField(input); });
|
||||
input.addEventListener('input', () => { if (input.getAttribute('aria-invalid') === 'true') checkField(input); });
|
||||
});
|
||||
|
||||
form.addEventListener('submit', async (e) => {
|
||||
e.preventDefault();
|
||||
const status = form.querySelector('.form-status');
|
||||
status.textContent = '';
|
||||
const bad = inputs.filter((i) => !checkField(i));
|
||||
if (bad.length) { bad[0].focus(); return; }
|
||||
|
||||
const button = form.querySelector('button');
|
||||
button.disabled = true;
|
||||
button.textContent = 'Sending…';
|
||||
const data = Object.fromEntries([...new FormData(form)].filter(([, v]) => v !== ''));
|
||||
try {
|
||||
const res = await fetch('/api/leads', { method: 'POST', headers: { 'content-type': 'application/json' }, body: JSON.stringify(data) });
|
||||
const body = await res.json().catch(() => ({}));
|
||||
if (!res.ok) throw new Error(body.error || 'Something went wrong');
|
||||
const card = form.closest('.form-card');
|
||||
card.innerHTML = '<div class="success" tabindex="-1"><svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><circle cx="12" cy="12" r="10"/><path d="M7 12.5l3 3 7-7"/></svg><h3>Thanks! Our team will contact you shortly.</h3><p>Prefer to talk now? Call <a href="tel:+60193656987">+6019 365 6987</a>.</p></div>';
|
||||
card.querySelector('.success').focus();
|
||||
} catch (err) {
|
||||
const why = err instanceof TypeError ? 'connection problem' : err.message;
|
||||
status.textContent = `Sorry, we couldn't send your details (${why}). Please try again or call +6019 365 6987.`;
|
||||
status.classList.add('err');
|
||||
button.disabled = false;
|
||||
button.textContent = 'Get My Free Consultation';
|
||||
}
|
||||
});
|
||||
});
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 5.3 KiB |
Executable
+82
@@ -0,0 +1,82 @@
|
||||
#!/bin/bash
|
||||
# Usage: waitForOlderRuns.sh <own_run_number>
|
||||
# Queues deploy runs per branch (openspec ci-pipeline): returns 0 once no OLDER push run of this
|
||||
# branch is pending, queued or in progress, so runs build and roll out one at a time, in push order.
|
||||
# Gitea's workflow `concurrency` cannot do this: it keeps one waiting run per group and cancels the
|
||||
# others, even with cancel-in-progress: false.
|
||||
#
|
||||
# It also refuses (exit 1) when a NEWER push run of the branch has already succeeded: that is a manual
|
||||
# re-run of an old run, which would roll an older image out over a newer one. Push again instead; the
|
||||
# self-heal (resolveDeployBase.sh) rebuilds whatever the old run missed.
|
||||
#
|
||||
# Fails closed: a failed or unreadable API answer counts as "still waiting", and a run still waiting
|
||||
# after WAIT_TIMEOUT seconds exits 1 rather than build alongside an older run. A refused token (401/403)
|
||||
# exits 1 at once — waiting would only end in the timeout.
|
||||
#
|
||||
# ponytail: reads the newest 50 runs of each kind; an older unfinished run beyond them is not seen. A run
|
||||
# being cancelled (Gitea "cancelling") is reported in_progress by the API but is not matched by the
|
||||
# status=in_progress filter; both gaps are seconds-to-minutes wide here — page the API if that changes.
|
||||
#
|
||||
# Env: GITEA_TOKEN, GITEA_API (…/api/v1), GITEA_REPO (owner/name), GITEA_BRANCH — for the default fetch.
|
||||
# WAIT_INTERVAL (s, default 30), WAIT_TIMEOUT (s, default 7200), WAIT_FETCH (a command printing the
|
||||
# runs JSON; tests replace the API with it).
|
||||
set -u
|
||||
own="${1:-}"
|
||||
if ! [[ "$own" =~ ^[0-9]+$ ]]; then
|
||||
echo "waitForOlderRuns: own run number must be a number, got '$own'" >&2
|
||||
exit 2
|
||||
fi
|
||||
interval="${WAIT_INTERVAL:-30}"
|
||||
deadline=$(( $(date +%s) + ${WAIT_TIMEOUT:-7200} ))
|
||||
|
||||
fetch() { # $1 = unfinished | succeeded. Prints the runs JSON; exit 3 = token refused, other non-zero = failed.
|
||||
if [ -n "${WAIT_FETCH:-}" ]; then
|
||||
"$WAIT_FETCH" "$1"
|
||||
return
|
||||
fi
|
||||
local status=status=success code body
|
||||
[ "$1" = unfinished ] && status="status=pending&status=queued&status=in_progress"
|
||||
body="$(mktemp)"
|
||||
code="$(curl -sS --max-time 20 -o "$body" -w '%{http_code}' -H "Authorization: token $GITEA_TOKEN" \
|
||||
"$GITEA_API/repos/$GITEA_REPO/actions/runs?branch=$GITEA_BRANCH&event=push&$status&limit=50")" || code=000
|
||||
case "$code" in
|
||||
200) cat "$body"; rm -f "$body"; return 0 ;;
|
||||
401|403) rm -f "$body"; return 3 ;;
|
||||
*) rm -f "$body"; return 1 ;;
|
||||
esac
|
||||
}
|
||||
|
||||
run_numbers() { # runs JSON on stdin -> its run numbers, one per line. Nested objects carry no run_number.
|
||||
grep -o '"run_number":[0-9]\+' | cut -d: -f2
|
||||
}
|
||||
|
||||
while :; do
|
||||
json="$(fetch unfinished)"; rc=$?
|
||||
if [ "$rc" -eq 3 ]; then
|
||||
echo "Runs API refused the job token (401/403); cannot queue run #$own safely." >&2
|
||||
exit 1
|
||||
fi
|
||||
if [ "$rc" -eq 0 ] && [[ "$json" == *'"workflow_runs"'* ]]; then
|
||||
older="$(printf '%s' "$json" | run_numbers | awk -v own="$own" '$1 < own' | sort -n | tr '\n' ' ')"
|
||||
if [ -n "$older" ]; then
|
||||
echo "Run #$own waits for older run(s): ${older% }"
|
||||
elif done_json="$(fetch succeeded)" && [[ "$done_json" == *'"workflow_runs"'* ]]; then
|
||||
newer="$(printf '%s' "$done_json" | run_numbers | awk -v own="$own" '$1 > own' | sort -n | tr '\n' ' ')"
|
||||
if [ -n "$newer" ]; then
|
||||
echo "Run #$own is older than run(s) ${newer% }, which already deployed; refusing to roll back. Push again instead." >&2
|
||||
exit 1
|
||||
fi
|
||||
echo "No older run of this branch is unfinished; starting run #$own."
|
||||
exit 0
|
||||
else
|
||||
echo "Runs API read failed; run #$own keeps waiting."
|
||||
fi
|
||||
else
|
||||
echo "Runs API read failed; run #$own keeps waiting."
|
||||
fi
|
||||
if [ "$(date +%s)" -ge "$deadline" ]; then
|
||||
echo "Run #$own still waiting after ${WAIT_TIMEOUT:-7200}s; failing rather than building alongside an older run." >&2
|
||||
exit 1
|
||||
fi
|
||||
sleep "$interval"
|
||||
done
|
||||
@@ -0,0 +1,121 @@
|
||||
const http = require('node:http');
|
||||
const fs = require('node:fs');
|
||||
const path = require('node:path');
|
||||
const { DatabaseSync } = require('node:sqlite');
|
||||
|
||||
const MAX_BODY = 10 * 1024;
|
||||
const REQUIRED = ['name', 'email', 'phone', 'company'];
|
||||
const OPTIONAL = ['service', 'referrer', 'utm_source', 'utm_medium', 'utm_campaign'];
|
||||
const MAX_LEN = { referrer: 500 };
|
||||
const EMAIL = /^[^\s@]+@[^\s@]+\.[^\s@]+$/;
|
||||
const SERVICES = ['WiFi Managed Services', 'Cloud IP PABX', 'GRE IPTV', 'Digital Signage', 'QR Door Locks', 'Not sure yet'];
|
||||
// matches the domain's first label, so yahoo.com.my, hotmail.co.uk etc. are covered.
|
||||
// ponytail: fixed list of the common providers; extend if sales sees others slip through.
|
||||
const FREE_EMAIL = /@(gmail|googlemail|yahoo|ymail|rocketmail|hotmail|outlook|live|msn|icloud|me|mac|aol|protonmail|proton|gmx|yandex|zoho)\.[a-z.]+$/i;
|
||||
const PAGES = { '/': ['index.html', 'text/html; charset=utf-8'], '/logo.png': ['logo.png', 'image/png'] };
|
||||
|
||||
function openDb(dbPath) {
|
||||
fs.mkdirSync(path.dirname(dbPath), { recursive: true });
|
||||
const db = new DatabaseSync(dbPath);
|
||||
// WAL: an export (reader) never blocks inserts. busy_timeout blocks the event loop while waiting,
|
||||
// ponytail: fine for one low-traffic pod; move to Postgres if this ever needs concurrency.
|
||||
db.exec('PRAGMA journal_mode = WAL; PRAGMA busy_timeout = 5000;');
|
||||
db.exec(`CREATE TABLE IF NOT EXISTS leads (
|
||||
id INTEGER PRIMARY KEY,
|
||||
created_at TEXT NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
||||
name TEXT NOT NULL, email TEXT NOT NULL, phone TEXT NOT NULL, company TEXT NOT NULL,
|
||||
service TEXT, referrer TEXT,
|
||||
utm_source TEXT, utm_medium TEXT, utm_campaign TEXT
|
||||
)`);
|
||||
return db;
|
||||
}
|
||||
|
||||
function validate(lead) {
|
||||
for (const f of REQUIRED) {
|
||||
if (typeof lead[f] !== 'string' || !lead[f].trim()) return `${f} is required`;
|
||||
}
|
||||
for (const f of [...REQUIRED, ...OPTIONAL]) {
|
||||
const v = lead[f];
|
||||
if (v != null && typeof v !== 'string') return `${f} must be text`;
|
||||
if (v && v.length > (MAX_LEN[f] || 200)) return `${f} is too long`;
|
||||
}
|
||||
if (!EMAIL.test(lead.email.trim())) return 'email is invalid';
|
||||
if (FREE_EMAIL.test(lead.email.trim())) return 'Please use your work email address';
|
||||
if (lead.service && !SERVICES.includes(lead.service)) return 'service is invalid';
|
||||
return null;
|
||||
}
|
||||
|
||||
function send(res, status, body) {
|
||||
res.writeHead(status, { 'content-type': 'application/json' });
|
||||
res.end(JSON.stringify(body));
|
||||
}
|
||||
|
||||
function readBody(req) {
|
||||
return new Promise((resolve, reject) => {
|
||||
let size = 0;
|
||||
const chunks = [];
|
||||
req.on('data', (c) => {
|
||||
size += c.length;
|
||||
// keep draining (not destroy) so the 413 reaches the client; the ingress body limit (nginx default 1m) caps abuse
|
||||
if (size > MAX_BODY) reject(Object.assign(new Error('too large'), { status: 413 }));
|
||||
else chunks.push(c);
|
||||
});
|
||||
req.on('end', () => resolve(Buffer.concat(chunks).toString('utf8')));
|
||||
req.on('error', reject);
|
||||
});
|
||||
}
|
||||
|
||||
function createServer(dbPath) {
|
||||
// load static files up front: a missing file fails at startup instead of crashing on a request
|
||||
const files = {};
|
||||
for (const [url, [file, type]] of Object.entries(PAGES)) {
|
||||
files[url] = { body: fs.readFileSync(path.join(__dirname, 'public', file)), type };
|
||||
}
|
||||
const db = openDb(dbPath);
|
||||
const insert = db.prepare(`INSERT INTO leads
|
||||
(name, email, phone, company, service, referrer, utm_source, utm_medium, utm_campaign)
|
||||
VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?)`);
|
||||
|
||||
const server = http.createServer(async (req, res) => {
|
||||
const url = req.url.split('?')[0];
|
||||
|
||||
if (req.method === 'GET' && files[url]) {
|
||||
res.writeHead(200, { 'content-type': files[url].type });
|
||||
return res.end(files[url].body);
|
||||
}
|
||||
if (req.method === 'POST' && url === '/api/leads') {
|
||||
let lead;
|
||||
try {
|
||||
lead = JSON.parse(await readBody(req));
|
||||
} catch (e) {
|
||||
return send(res, e.status || 400, { error: e.status ? 'Request too large' : 'Invalid request' });
|
||||
}
|
||||
if (!lead || typeof lead !== 'object') return send(res, 400, { error: 'Invalid request' });
|
||||
if (lead.website) return send(res, 200, { ok: true }); // honeypot: pretend success, store nothing
|
||||
const error = validate(lead);
|
||||
if (error) return send(res, 400, { error });
|
||||
try {
|
||||
const t = (f) => (lead[f] ? lead[f].trim() : null);
|
||||
insert.run(t('name'), t('email'), t('phone'), t('company'), t('service'),
|
||||
t('referrer'), t('utm_source'), t('utm_medium'), t('utm_campaign'));
|
||||
} catch (e) {
|
||||
console.error('lead insert failed:', e.message);
|
||||
return send(res, 500, { error: 'Could not save, please try again' });
|
||||
}
|
||||
return send(res, 201, { ok: true });
|
||||
}
|
||||
send(res, 404, { error: 'Not found' });
|
||||
});
|
||||
server.on('close', () => db.close());
|
||||
return server;
|
||||
}
|
||||
|
||||
module.exports = { createServer };
|
||||
|
||||
if (require.main === module) {
|
||||
const port = Number(process.env.PORT ?? 3000);
|
||||
const server = createServer(process.env.DB_PATH || path.join(__dirname, 'data', 'leads.db'));
|
||||
server.listen(port, () => console.log(`listening on :${port}`));
|
||||
// node as PID 1 ignores SIGTERM by default; exit cleanly so k8s rollouts don't wait 30s
|
||||
process.on('SIGTERM', () => server.close(() => process.exit(0)));
|
||||
}
|
||||
+146
@@ -0,0 +1,146 @@
|
||||
const { test, before, after } = require('node:test');
|
||||
const assert = require('node:assert');
|
||||
const fs = require('node:fs');
|
||||
const os = require('node:os');
|
||||
const path = require('node:path');
|
||||
const { DatabaseSync } = require('node:sqlite');
|
||||
const { createServer } = require('./server');
|
||||
|
||||
const dir = fs.mkdtempSync(path.join(os.tmpdir(), 'ins-leads-'));
|
||||
const dbPath = path.join(dir, 'leads.db');
|
||||
let server, base;
|
||||
|
||||
before(async () => {
|
||||
server = createServer(dbPath);
|
||||
await new Promise((r) => server.listen(0, r));
|
||||
base = `http://127.0.0.1:${server.address().port}`;
|
||||
});
|
||||
after(() => {
|
||||
server.close();
|
||||
fs.rmSync(dir, { recursive: true, force: true });
|
||||
});
|
||||
|
||||
const valid = {
|
||||
name: 'Aisyah Rahman',
|
||||
email: 'aisyah@seripinang.com.my',
|
||||
phone: '+60 12-345 6789',
|
||||
company: 'Hotel Seri Pinang',
|
||||
service: 'Cloud IP PABX',
|
||||
utm_source: 'google',
|
||||
referrer: 'https://www.google.com/',
|
||||
};
|
||||
|
||||
const post = (body) =>
|
||||
fetch(`${base}/api/leads`, {
|
||||
method: 'POST',
|
||||
headers: { 'content-type': 'application/json', referer: 'https://ads.example.com/' },
|
||||
body: typeof body === 'string' ? body : JSON.stringify(body),
|
||||
});
|
||||
|
||||
const rows = () => {
|
||||
const db = new DatabaseSync(dbPath);
|
||||
const r = db.prepare('SELECT * FROM leads').all();
|
||||
db.close();
|
||||
return r;
|
||||
};
|
||||
|
||||
test('serves the landing page', async () => {
|
||||
const res = await fetch(`${base}/`);
|
||||
assert.strictEqual(res.status, 200);
|
||||
assert.match(res.headers.get('content-type'), /text\/html/);
|
||||
});
|
||||
|
||||
test('valid lead is stored', async () => {
|
||||
const res = await post(valid);
|
||||
assert.strictEqual(res.status, 201);
|
||||
const r = rows();
|
||||
assert.strictEqual(r.length, 1);
|
||||
assert.strictEqual(r[0].name, valid.name);
|
||||
assert.strictEqual(r[0].company, valid.company);
|
||||
assert.strictEqual(r[0].service, 'Cloud IP PABX');
|
||||
assert.strictEqual(r[0].utm_source, 'google');
|
||||
assert.strictEqual(r[0].referrer, 'https://www.google.com/');
|
||||
assert.ok(r[0].created_at);
|
||||
});
|
||||
|
||||
test('missing required field is rejected', async () => {
|
||||
const before = rows().length;
|
||||
const res = await post({ ...valid, phone: '' });
|
||||
assert.strictEqual(res.status, 400);
|
||||
assert.ok((await res.json()).error);
|
||||
assert.strictEqual(rows().length, before);
|
||||
});
|
||||
|
||||
test('invalid email is rejected', async () => {
|
||||
assert.strictEqual((await post({ ...valid, email: 'abc' })).status, 400);
|
||||
});
|
||||
|
||||
test('free email providers are rejected with a friendly message', async () => {
|
||||
for (const email of ['a@gmail.com', 'a@Yahoo.com.my', 'a@hotmail.com', 'a@outlook.com', 'a@icloud.com']) {
|
||||
const res = await post({ ...valid, email });
|
||||
assert.strictEqual(res.status, 400, email);
|
||||
assert.match((await res.json()).error, /work email/i);
|
||||
}
|
||||
});
|
||||
|
||||
test('unknown service is rejected, missing service is allowed', async () => {
|
||||
assert.strictEqual((await post({ ...valid, service: 'Plumbing' })).status, 400);
|
||||
const { service, ...noService } = valid;
|
||||
assert.strictEqual((await post(noService)).status, 201);
|
||||
});
|
||||
|
||||
test('over-long field is rejected', async () => {
|
||||
assert.strictEqual((await post({ ...valid, name: 'x'.repeat(201) })).status, 400);
|
||||
});
|
||||
|
||||
test('non-JSON body is rejected', async () => {
|
||||
assert.strictEqual((await post('not json')).status, 400);
|
||||
});
|
||||
|
||||
test('oversized body is rejected', async () => {
|
||||
assert.strictEqual((await post({ ...valid, company: 'x'.repeat(11000) })).status, 413);
|
||||
});
|
||||
|
||||
test('honeypot submission is accepted but not stored', async () => {
|
||||
const before = rows().length;
|
||||
const res = await post({ ...valid, website: 'http://spam.example' });
|
||||
assert.strictEqual(res.status, 200);
|
||||
assert.strictEqual(rows().length, before);
|
||||
});
|
||||
|
||||
const { spawn } = require('node:child_process');
|
||||
|
||||
test('missing page file fails at startup, not on a request', () => {
|
||||
const tmp = fs.mkdtempSync(path.join(os.tmpdir(), 'ins-nopage-'));
|
||||
fs.copyFileSync(path.join(__dirname, 'server.js'), path.join(tmp, 'server.js'));
|
||||
const { createServer: create } = require(path.join(tmp, 'server.js'));
|
||||
assert.throws(() => create(path.join(tmp, 'leads.db')), /ENOENT/);
|
||||
fs.rmSync(tmp, { recursive: true, force: true });
|
||||
});
|
||||
|
||||
test('insert waits for a lock held by another process (e.g. an export)', async () => {
|
||||
const lock = spawn(process.execPath, ['--disable-warning=ExperimentalWarning', '-e', `
|
||||
const { DatabaseSync } = require('node:sqlite');
|
||||
const db = new DatabaseSync(${JSON.stringify(dbPath)});
|
||||
db.exec('BEGIN EXCLUSIVE');
|
||||
console.log('locked');
|
||||
setTimeout(() => { db.exec('COMMIT'); db.close(); }, 500);
|
||||
`]);
|
||||
await new Promise((r) => lock.stdout.once('data', r));
|
||||
const res = await post(valid);
|
||||
assert.strictEqual(res.status, 201);
|
||||
});
|
||||
|
||||
test('exits promptly on SIGTERM', async () => {
|
||||
const tmp = fs.mkdtempSync(path.join(os.tmpdir(), 'ins-term-'));
|
||||
const child = spawn(process.execPath, ['--disable-warning=ExperimentalWarning', path.join(__dirname, 'server.js')], {
|
||||
env: { ...process.env, PORT: '0', DB_PATH: path.join(tmp, 'leads.db') },
|
||||
});
|
||||
await new Promise((r) => child.stdout.once('data', r));
|
||||
const start = Date.now();
|
||||
child.kill('SIGTERM');
|
||||
const code = await new Promise((r) => child.on('exit', (c) => r(c)));
|
||||
assert.strictEqual(code, 0);
|
||||
assert.ok(Date.now() - start < 2000);
|
||||
fs.rmSync(tmp, { recursive: true, force: true });
|
||||
});
|
||||
Reference in new issue
Block a user