mirror of
https://git.roussel.pro/public-website/singapore_rain_radar.git
synced 2026-02-09 02:20:17 +01:00
bypassed browser fingerprinting
This commit is contained in:
34
.gitea/workflows/deploy.yaml
Normal file
34
.gitea/workflows/deploy.yaml
Normal file
@@ -0,0 +1,34 @@
|
|||||||
|
name: Deploy
|
||||||
|
run-name: deploy frontned to remote server
|
||||||
|
on: [push]
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
copy:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- name: Configure SSH
|
||||||
|
run: |
|
||||||
|
mkdir -p ~/.ssh/
|
||||||
|
echo "$SSH_KEY" > ~/.ssh/remote.key
|
||||||
|
chmod 600 ~/.ssh/remote.key
|
||||||
|
cat >>~/.ssh/config <<END
|
||||||
|
Host remote
|
||||||
|
HostName $SSH_HOST
|
||||||
|
User $SSH_USER
|
||||||
|
IdentityFile ~/.ssh/remote.key
|
||||||
|
StrictHostKeyChecking no
|
||||||
|
env:
|
||||||
|
SSH_USER: ${{ secrets.USERNAME }}
|
||||||
|
SSH_KEY: ${{ secrets.SSH_KEY }}
|
||||||
|
SSH_HOST: ${{ secrets.HOST }}
|
||||||
|
- name: Setup rsync
|
||||||
|
run: apt-get update && apt-get install rsync -y
|
||||||
|
|
||||||
|
- name: Checkout code
|
||||||
|
uses: actions/checkout@v2
|
||||||
|
|
||||||
|
- name: Upload files
|
||||||
|
run: rsync -rvp --chown=quentin:users --chmod=777 --exclude=.gitea --exclude=.git ${{ vars.RSYNC_ARGS }} . remote:${{ vars.DESTINATION_DIR }}
|
||||||
|
|
||||||
|
- name: Run container
|
||||||
|
run: ssh remote 'cd ${{ vars.DESTINATION_DIR }} && make run'
|
||||||
@@ -5,7 +5,11 @@ ENV TZ="Asia/Singapore"
|
|||||||
|
|
||||||
RUN apt-get update && apt-get install -y ffmpeg && apt-get clean
|
RUN apt-get update && apt-get install -y ffmpeg && apt-get clean
|
||||||
|
|
||||||
RUN mkdir -p /home/node/app/node_modules && chown -R node:node /home/node/app
|
RUN mkdir -p /home/node/app/node_modules
|
||||||
|
RUN mkdir -p /home/node/app/images/raw
|
||||||
|
RUN mkdir -p /home/node/app/images/final
|
||||||
|
RUN mkdir -p /home/node/app/out
|
||||||
|
RUN chown -R node:node /home/node/app
|
||||||
|
|
||||||
WORKDIR /home/node/app
|
WORKDIR /home/node/app
|
||||||
|
|
||||||
|
|||||||
14
Makefile
14
Makefile
@@ -1,12 +1,24 @@
|
|||||||
APP_NAME = "sg_rainradar_video"
|
APP_NAME = "sg_rain_radar"
|
||||||
|
OUTPUT_DIR = $(PWD)/out
|
||||||
|
|
||||||
build:
|
build:
|
||||||
docker build . -t $(APP_NAME)
|
docker build . -t $(APP_NAME)
|
||||||
|
|
||||||
debug:build
|
debug:build
|
||||||
|
mkdir -p $(OUTPUT_DIR)
|
||||||
|
mkdir -p $(PWD)/images/raw
|
||||||
|
mkdir -p $(PWD)/images/final
|
||||||
docker run \
|
docker run \
|
||||||
-it \
|
-it \
|
||||||
--mount type=bind,source=$(PWD)/images,target=/home/node/app/images \
|
--mount type=bind,source=$(PWD)/images,target=/home/node/app/images \
|
||||||
|
--mount type=bind,source=$(OUTPUT_DIR),target=/home/node/app/out \
|
||||||
$(APP_NAME)
|
$(APP_NAME)
|
||||||
|
|
||||||
|
run:build
|
||||||
|
mkdir -p $(OUTPUT_DIR)
|
||||||
|
docker run \
|
||||||
|
-d \
|
||||||
|
--mount type=bind,source=$(OUTPUT_DIR),target=/home/node/app/out \
|
||||||
|
$(APP_NAME)
|
||||||
|
|
||||||
.PHONY: build debug run
|
.PHONY: build debug run
|
||||||
@@ -20,20 +20,8 @@ function downloadImage(time_string, filepath) {
|
|||||||
port: 443,
|
port: 443,
|
||||||
path: `/docs/default-source/rain-area/dpsri_70km_${time_string}0000dBR.dpsri.png`,
|
path: `/docs/default-source/rain-area/dpsri_70km_${time_string}0000dBR.dpsri.png`,
|
||||||
headers: {
|
headers: {
|
||||||
"Host":"www.nea.gov.sg",
|
"User-Agent": "Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:129.0) Gecko/20100101 Firefox/129." + Math.round(Math.random() * 1000),
|
||||||
"User-Agent": "Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:129.0) Gecko/20100101 Firefox/129.0",
|
"Accept": "image/avif,image/webp,image/png,image/svg+xml,image/*;q=0.8,*/*;q=0.5;" + Math.round(Math.random() * 1000),
|
||||||
"Accept": "image/avif,image/webp,image/png,image/svg+xml,image/*;q=0.8,*/*;q=0.5",
|
|
||||||
"Accept-Language": "en-US,en;q=0.5",
|
|
||||||
"Accept-Encoding": "gzip, deflate, br, zstd",
|
|
||||||
"DNT": "1",
|
|
||||||
"Connection": "keep-alive",
|
|
||||||
"Sec-Fetch-Dest": "image",
|
|
||||||
"Sec-Fetch-Mode": "no-cors",
|
|
||||||
"Sec-Fetch-Site": "same-origin",
|
|
||||||
"Priority": "i",
|
|
||||||
"Pragma": "no-cache",
|
|
||||||
"Cache-Control": "no-cache",
|
|
||||||
"TE": "trailers",
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
client.get(options, (res) => {
|
client.get(options, (res) => {
|
||||||
|
|||||||
@@ -6,7 +6,7 @@ const IMAGE_COUNT = 5;
|
|||||||
initImages(IMAGE_COUNT).then(() => {
|
initImages(IMAGE_COUNT).then(() => {
|
||||||
console.log('Downloaded initial images successfully');
|
console.log('Downloaded initial images successfully');
|
||||||
createVideo().then(() => {
|
createVideo().then(() => {
|
||||||
console.log('Generated final images successfully');
|
console.log('Generated video successfully');
|
||||||
});
|
});
|
||||||
|
|
||||||
});
|
});
|
||||||
@@ -14,5 +14,8 @@ initImages(IMAGE_COUNT).then(() => {
|
|||||||
setInterval(() => {
|
setInterval(() => {
|
||||||
updateImages(IMAGE_COUNT).then(() => {
|
updateImages(IMAGE_COUNT).then(() => {
|
||||||
console.log('Updated images successfully');
|
console.log('Updated images successfully');
|
||||||
|
createVideo().then(() => {
|
||||||
|
console.log('Regenerated video successfully');
|
||||||
|
});
|
||||||
});
|
});
|
||||||
}, 5 * 60 * 1000);
|
}, 5 * 60 * 1000);
|
||||||
|
|||||||
@@ -39,7 +39,7 @@ export async function createVideo() {
|
|||||||
await generateFinalImages();
|
await generateFinalImages();
|
||||||
//run the command ffmpeg -framerate 5 -i %d.png -c:v libx264 -r 30 output.mp4
|
//run the command ffmpeg -framerate 5 -i %d.png -c:v libx264 -r 30 output.mp4
|
||||||
return new Promise((resolve, reject) => {
|
return new Promise((resolve, reject) => {
|
||||||
exec('ffmpeg -framerate 5 -i images/final/%d.png -c:v libx264 -r 30 images/output.mp4', (err, stdout, stderr) => {
|
exec('ffmpeg -framerate 5 -i images/final/%d.png -c:v libx264 -r 30 out/output.mp4', (err, stdout, stderr) => {
|
||||||
if (err) {
|
if (err) {
|
||||||
reject(err);
|
reject(err);
|
||||||
return;
|
return;
|
||||||
|
|||||||
Reference in New Issue
Block a user