Compare commits

...

19 Commits

Author SHA1 Message Date
Matt Walsh
ccd4ffa48c 5.9.11 2023-08-14 21:32:08 -05:00
Matt Walsh
2c9e15bed0 fix full screen vertical and radar 2023-08-14 21:31:58 -05:00
Matt Walsh
2c31484e99 capture dist 2023-06-28 10:23:22 -05:00
Matt Walsh
0e457881c7 5.9.10 2023-06-28 10:21:30 -05:00
Matt Walsh
56d6a68e9a Merge pull request #27 from blackchip-org/time-refresh
Fix time flickering when frame is first displayed
2023-06-28 10:18:29 -05:00
Mike McGann
6b5ac04498 fix time flickering when frame is first displayed 2023-06-27 16:06:45 -04:00
Matt Walsh
465fa5a99b capture dist 2023-05-31 23:12:34 -05:00
Matt Walsh
9c0d42c5c4 5.9.9 2023-05-31 23:11:30 -05:00
Matt Walsh
07ad5141a4 fix radar timestamp sorting 2023-05-31 23:11:12 -05:00
Matt Walsh
2c010a9a32 switch from css zoom to transform-scale 2023-05-31 22:57:36 -05:00
Matt Walsh
3b050073ed Merge pull request #26 from N7KnightOne/patch-1
Fixed Copy Commands
2023-05-31 21:11:19 -05:00
N7KnightOne
2953dc993c Fixed copy commands
In a Dockerfile, when using COPY with more than one source file, the destination must be a directory and end with a /. Or, you can specify each file that needs to be copied.
2023-05-31 15:53:50 -07:00
Matt Walsh
f481c5cfeb Merge pull request #23 from rmitchellscott/docker
Add Docker build
2023-04-22 21:26:41 -05:00
Mitchell Scott
5da4a50a96 Revert "Pin Node to v16."
This reverts commit d850165752.
2023-04-19 16:04:05 -06:00
Mitchell Scott
d5cce14fc2 Add workflow permissions for image build 2023-04-17 09:31:53 -06:00
Mitchell Scott
d850165752 Pin Node to v16. Workaround for netbymatt/ws4kp#24 2023-04-16 14:20:59 -06:00
Mitchell Scott
2d0af7a143 Swap to netbymatt GHCR 2023-04-13 16:35:54 -06:00
Mitchell Scott
146a3fda76 Tweak Dockerfile for better caching 2023-04-13 15:46:27 -06:00
Mitchell Scott
e1083c83ae Add dockerfile and build 2023-04-13 11:43:52 -06:00
19 changed files with 93 additions and 24 deletions

3
.dockerignore Normal file
View File

@@ -0,0 +1,3 @@
.git/
Dockerfile
.vscode/

47
.github/workflows/build-docker.yaml vendored Normal file
View File

@@ -0,0 +1,47 @@
name: build-docker
on: push
jobs:
build:
name: Build Image
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
steps:
- name: Checkout
uses: actions/checkout@v3
- id: short-sha
uses: benjlevesque/short-sha@v1.2
- name: Docker meta
id: meta
uses: docker/metadata-action@v4
with:
images: |
ghcr.io/netbymatt/ws4kp
tags: |
type=raw,priority=1000,value=latest,enable=${{ github.ref == 'refs/heads/main' }}
type=ref,event=branch
${{ steps.short-sha.outputs.sha }}
- name: Set up QEMU
uses: docker/setup-qemu-action@v2
- name: Set up Buildx
uses: docker/setup-buildx-action@v2
- name: Login to GitHub Container Registry
uses: docker/login-action@v2
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Build and Push
id: docker_build
uses: docker/build-push-action@v3
with:
context: .
pull: true
push: ${{ github.ref == 'refs/heads/main' }}
platforms: linux/amd64,linux/arm/v7,linux/arm64/v8
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
cache-from: type=gha
cache-to: type=gha,mode=max

10
Dockerfile Normal file
View File

@@ -0,0 +1,10 @@
FROM node:18-alpine
WORKDIR /app
COPY package.json .
COPY package-lock.json .
RUN npm ci
COPY . .
CMD ["node", "index.js"]

View File

@@ -19,12 +19,18 @@ This project is based on the work of [Mike Battaglia](https://github.com/vbguyny
## Run Your WeatherStar
There are a lot of CORS considerations and issues with api.weather.gov that are easiest to deal with by running a local server to see this in action (or use the live link above). You'll need Node.js >12.0 to run the local server.
To run via Node locally:
```
git clone https://github.com/netbymatt/ws4kp.git
cd ws4kp
npm i
node index.js
```
To run via Docker:
```
docker run -p 8080:8080 ghcr.io/netbymatt/ws4kp
```
Open your web browser: http://localhost:8080/
## Updates in 5.0

2
dist/index.html vendored

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

4
package-lock.json generated
View File

@@ -1,12 +1,12 @@
{
"name": "ws4kp",
"version": "5.9.8",
"version": "5.9.11",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "ws4kp",
"version": "5.9.8",
"version": "5.9.11",
"license": "MIT",
"devDependencies": {
"del": "^6.0.0",

View File

@@ -1,6 +1,6 @@
{
"name": "ws4kp",
"version": "5.9.8",
"version": "5.9.11",
"description": "Welcome to the WeatherStar 4000+ project page!",
"main": "index.js",
"scripts": {

View File

@@ -274,9 +274,9 @@ const resize = () => {
const scale = Math.min(widthZoomPercent, heightZoomPercent);
if (scale < 1.0 || document.fullscreenElement) {
document.querySelector('#container').style.zoom = scale;
document.querySelector('#container').style.transform = `scale(${scale})`;
} else {
document.querySelector('#container').style.zoom = 1;
document.querySelector('#container').style.transform = 'unset';
}
};

View File

@@ -91,7 +91,7 @@ class Radar extends WeatherDisplay {
const anchors = xmlDoc.querySelectorAll('a');
const urls = [];
Array.from(anchors).forEach((elem) => {
if (elem.innerHTML?.includes('.png') && elem.innerHTML?.includes('n0r_')) {
if (elem.innerHTML?.match(/n0r_\d{12}\.png/)) {
urls.push(elem.href);
}
});
@@ -99,7 +99,8 @@ class Radar extends WeatherDisplay {
});
// get the last few images
const sortedPngs = pngs.sort((a, b) => (Date(a) < Date(b) ? -1 : 1));
const timestampRegex = /_(\d{12})\.png/;
const sortedPngs = pngs.sort((a, b) => (a.match(timestampRegex)[1] < b.match(timestampRegex)[1] ? -1 : 1));
const urls = sortedPngs.slice(-(this.dopplerRadarImageMax));
// calculate offsets and sizes
@@ -215,7 +216,7 @@ class Radar extends WeatherDisplay {
// get image offset calculation
// is slides slightly because of scaling so we have to take a measurement from the rendered page
const actualFrameHeight = this.elem.querySelector('.frame').getBoundingClientRect().height;
const actualFrameHeight = this.elem.querySelector('.frame').scrollHeight;
// scroll to image
this.elem.querySelector('.scroll-area').style.top = `${-this.screenIndex * actualFrameHeight}px`;

View File

@@ -167,9 +167,7 @@ class RegionalForecast extends WeatherDisplay {
// draw the map
const scale = 640 / (offsetXY.x * 2);
const map = this.elem.querySelector('.map');
map.style.zoom = scale;
map.style.top = `-${sourceXY.y}px`;
map.style.left = `-${sourceXY.x}px`;
map.style.transform = `scale(${scale}) translate(-${sourceXY.x}px, -${sourceXY.y}px)`;
const cities = data.map((city) => {
const fill = {};

View File

@@ -151,6 +151,7 @@ class WeatherDisplay {
drawCanvas() {
// clean up the first-run flag in screen index
if (this.screenIndex < 0) this.screenIndex = 0;
if (this.okToDrawCurrentDateTime) this.drawCurrentDateTime();
}
finishDraw() {
@@ -159,14 +160,13 @@ class WeatherDisplay {
this.drawCurrentDateTime();
// auto clock refresh
if (!this.dateTimeInterval) {
setInterval(() => this.drawCurrentDateTime(), 100);
// only draw if canvas is active to conserve battery
setInterval(() => this.active && this.drawCurrentDateTime(), 100);
}
}
}
drawCurrentDateTime() {
// only draw if canvas is active to conserve battery
if (!this.active) return;
// Get the current date and time.
const now = DateTime.local().setZone(timeZone());

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@@ -95,8 +95,9 @@ body {
}
}
}
.autocomplete-suggestions {
background-color: #ffffff;
border: 1px solid #000000;
@@ -282,8 +283,9 @@ body {
position: relative;
width: 640px;
height: 480px;
overflow: hidden;
// overflow: hidden;
background-image: url(../images/BackGround1_1.png);
transform-origin: 0 0;
}
@@ -291,6 +293,7 @@ body {
background-image: none;
width: unset;
height: unset;
transform-origin: unset;
}
#loading {
@@ -373,7 +376,7 @@ body {
}
#divTwcBottom img {
zoom: 75%;
transform: scale(0.75);
}
#divTwc:fullscreen {

View File

@@ -12,6 +12,7 @@
.map {
position: absolute;
transform-origin: 0 0;
}
.location {

View File

@@ -115,7 +115,7 @@
<div id="radar-html" class="weather-display">
<%- include('partials/radar.ejs') %>
</div>
<div id="hazards-html" class="weather-display show">
<div id="hazards-html" class="weather-display">
<%- include('partials/hazards.ejs') %>
</div>
</div>