Compare commits

..
1 Commits
Author SHA1 Message Date
shmyga ad94deb9b7 ci(action): add setup composite action
test / test (push) Failing after 39s
2026-09-26 15:39:27 +03:00
42 changed files with 111 additions and 246 deletions
+32
View File
@@ -0,0 +1,32 @@
name: "Setup"
description: "Setup project"
inputs:
python-version:
default: "3.14"
runs:
using: "composite"
steps:
- id: setup-python
uses: actions/setup-python@v7
with:
python-version: ${{ inputs.python-version }}
cache: "pip"
- run: |
pip install project-manager \
--index-url https://git.shmyga.ru/api/packages/InfernalGames/pypi/simple/ \
--extra-index-url https://pypi.org/simple
- run: pm setup:config -vv
# setup python venv
- run: pip install poetry
- id: cache-venv
uses: actions/cache@v6
with:
path: .venv
key: venv-${{ runner.os }}-python-${{ steps.setup-python.outputs.python-version }}-${{ hashFiles('**/poetry.lock') }}
- if: steps.cache-venv.outputs.cache-hit != 'true'
run: pm setup:python -vv
+42
View File
@@ -0,0 +1,42 @@
name: build
on:
push:
tags: ["*"]
jobs:
build:
runs-on: ubuntu-latest
steps:
# repo
- name: Check out repository
uses: actions/checkout@v7
# python
- name: Set up python
id: setup-python
uses: actions/setup-python@v7
with:
python-version: "3.14"
cache: "pip"
# project-manager
- name: Install Project Manager
run: |
pip install project-manager \
--index-url https://git.shmyga.ru/api/packages/InfernalGames/pypi/simple/ \
--extra-index-url https://pypi.org/simple
# setup
- name: Setup config
run: pm setup:config -vv
# build
- name: Build docker
run: pm build:docker -vv
# login docker
- name: Login to Docker Hub
uses: docker/login-action@v4
with:
registry: git.shmyga.ru
username: ${{ vars.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
# pubish
- name: Publish docker
run: pm publish:docker -vv
-22
View File
@@ -1,22 +0,0 @@
name: deploy
on:
workflow_run:
workflows: [release]
types: [completed]
jobs:
deploy:
if: ${{ github.event.workflow_run.conclusion == 'success' }}
runs-on: ubuntu-latest
steps:
- uses: appleboy/ssh-action@v1
with:
host: ${{ secrets.DEPLOY_HOST }}
username: ${{ secrets.DEPLOY_USERNAME }}
key: ${{ secrets.DEPLOY_KEY }}
passphrase: ${{ secrets.DEPLOY_PASSPHRASE }}
script: |
cd /opt/gallery
docker compose pull
docker compose up -d
-20
View File
@@ -1,20 +0,0 @@
name: release
on:
push:
tags:
- "[0-9]+.[0-9]+.[0-9]+"
jobs:
release:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v7
- uses: https://git.shmyga.ru/InfernalGames/project-manager@master
- run: pm build:docker -vv
- uses: docker/login-action@v4
with:
registry: git.shmyga.ru
username: ${{ vars.PUBLISH_USERNAME }}
password: ${{ secrets.PUBLISH_TOKEN }}
- run: pm publish:docker -vv
+1 -3
View File
@@ -7,8 +7,6 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v7
- uses: https://git.shmyga.ru/InfernalGames/project-manager@master
with:
setup-python: true
- uses: ./.gitea/actions/setup
- run: pm lint -vv
- run: pm test -vv
+1 -1
View File
@@ -27,7 +27,7 @@ FROM python:3.14-slim
ENV PLAYWRIGHT_BROWSERS_PATH="/opt/playwright-browsers"
RUN --mount=type=cache,target=/var/cache/apt,sharing=locked \
--mount=type=cache,target=/var/lib/apt,sharing=locked \
pip install playwright==1.62 && \
pip install playwright && \
playwright install --with-deps chromium
ENV PATH="/app/.venv/bin:$PATH"
-2
View File
@@ -1,7 +1,5 @@
# API Gallery
[![test](https://git.shmyga.ru/InfernalGames/gallery/actions/workflows/test.yaml/badge.svg?branch=master)](https://git.shmyga.ru/InfernalGames/gallery/actions?workflow=test.yaml)
Currently implemented APIs:
- Weather forecast
@@ -14,7 +14,7 @@
<script type="module"
src="/static/gallery.js?v={{version}}"></script>
<link rel="icon"
href="/static/favicon.ico?v={{version}}"
href="/favicon.ico?v={{version}}"
type="image/x-icon">
{% endblock %}
</head>
+11 -23
View File
@@ -1,3 +1,4 @@
import datetime
from pathlib import Path
from urllib import parse
@@ -12,7 +13,9 @@ from gallery.easel.depends.schedule import (
ScheduleApiDepends,
ScheduleGroupChannelsDepends,
)
from gallery.sketch.bundle import ApiBundle
from gallery.sketch.schedule.api import ScheduleApi
from gallery.sketch.schedule.model import Schedule
from ..common.utils.template import build_templates
from .filters import timedelta_format
@@ -49,6 +52,12 @@ async def get_schedule_index(request: AppRequest, provider: str | None = None, q
)
async def _get_group_schedule(api: ApiBundle, channels: list[tuple[str, str]], date: datetime.date) -> list[Schedule]:
return [
await api.get_api(ScheduleApi, provider).get_schedule(channel_id, date) for provider, channel_id in channels
]
@router.get("/group/{group_id}", response_class=RedirectResponse)
async def get_group_default(group_id: str):
return RedirectResponse(f"{parse.quote(group_id)}/today")
@@ -63,16 +72,7 @@ async def get_group(request: AppRequest, channels: ScheduleGroupChannelsDepends,
return templates.TemplateResponse(
request=request,
name="group.html",
context={
"responses": responses,
"api_route": "/".join(
[
"/api/schedule/group",
request.path_params["group_id"],
request.path_params["date"],
]
),
},
context={"responses": responses},
)
@@ -87,17 +87,5 @@ async def get_channel(request: AppRequest, schedule_api: ScheduleApiDepends, cha
return templates.TemplateResponse(
request=request,
name="channel.html",
context={
"response": response,
"api_route": (
"/".join(
[
"/api/schedule",
request.path_params["provider"],
request.path_params["channel"],
request.path_params["date"],
]
)
),
},
context={"response": response},
)
@@ -10,9 +10,6 @@ locale=request.state.language)}}
{% block header %}
<app-link href="/schedule"
icon="tv">{{_("TV program")}}</app-link>
<app-link target="_blank"
href="{{ api_route }}"
icon="filetype-json"></app-link>
{% endblock %}
{% block content %}
@@ -47,17 +44,9 @@ locale=request.state.language)}}
{% for value in response.values %}
<tr class="{{'d-none' if (live and not value.live) else 'table-success' if (not live and value.live) else ''}}">
<td>
<span>{{value.start.strftime('%H:%M')}}</span>&nbsp;<span class="small ms-1">({{(value.end - value.start) |
timedelta_format}})</span>
</td>
<td>
{% if value.category %}
<schedule-icon icon="{{value.category}}"
data-bs-toggle="tooltip"
data-bs-title="{{value.category}}"></schedule-icon>
{% endif %}
<span>{{value.label}}</span>
<span>{{value.start.strftime('%H:%M')}}</span>&nbsp;<span class="small ms-1">({{(value.end - value.start) | timedelta_format}})</span>
</td>
<td>{{value.label}}</td>
</tr>
{% endfor %}
</tbody>
@@ -9,9 +9,6 @@
{% block header %}
<app-link href="/schedule"
icon="tv">{{_("TV program")}}</app-link>
<app-link target="_blank"
href="{{ api_route }}"
icon="filetype-json"></app-link>
{% endblock %}
{% block content %}
@@ -53,14 +50,7 @@
<span>{{value.start.strftime('%H:%M')}}</span>&nbsp;<span class="small ms-1">({{(value.end - value.start) |
timedelta_format}})</span>
</td>
<td>
{% if value.category %}
<schedule-icon icon="{{value.category}}"
data-bs-toggle="tooltip"
data-bs-title="{{value.category}}"></schedule-icon>
{% endif %}
<span>{{value.label}}</span>
</td>
<td>{{value.label}}</td>
</tr>
{% endfor %}
</tbody>
+1 -20
View File
@@ -3,7 +3,6 @@ from typing import Literal
from fastapi import APIRouter
from fastapi.responses import HTMLResponse, RedirectResponse
from starlette.datastructures import URL
from gallery.easel.core import AppRequest
from gallery.easel.depends.api import api_resolver
@@ -37,18 +36,7 @@ def build_weather_response(request: AppRequest, response: WeatherResponse):
return templates.TemplateResponse(
request=request,
name="weather.html",
context={
"response": response,
"api_route": "/".join(
[
"/api/weather",
request.path_params["provider"],
request.path_params["location"],
response.period,
request.path_params.get("date") or request.path_params.get("days") or "",
]
),
},
context={"response": response},
)
@@ -80,13 +68,6 @@ async def get_weather_days(request: AppRequest, weather_api: WeatherApiDepends,
return build_weather_response(request, response)
# TODO: tag mode route deprecated, used in tizen app
@router.get("/{provider}/{location}/tag/days-{days}", response_class=RedirectResponse)
async def get_tag_days(request: AppRequest, days: int):
url = URL(path=f"../days/{days}", query=request.url.query)
return RedirectResponse(url)
# TODO: tag mode route deprecated, used in tizen app
@router.get("/{provider}/{location}/{mode:str}/{date}", response_class=HTMLResponse)
async def get_weather_day(
@@ -7,9 +7,6 @@ locale=request.state.language)}}{% endblock %}
{% block header %}
<app-link href="/weather"
icon="brightness-high">{{_("Weather")}}</app-link>
<app-link target="_blank"
href="{{ api_route }}"
icon="filetype-json"></app-link>
{% endblock %}
{% block content %}
+1 -4
View File
@@ -6,7 +6,6 @@ from typing import Any
from gallery.sketch.parse.core import ParsedContext, Parser
from gallery.sketch.parse.json import JSONContextParser
from gallery.sketch.schedule.model import Channel, Schedule, ScheduleValue
from gallery.sketch.schedule.parse.category import CATEGORY_PARSER
from . import PROVIDER
@@ -29,7 +28,6 @@ class MatchTVScheduleParser(JSONContextParser[ScheduleData, Schedule]):
def extract(self, data: ParsedContext[ScheduleData, Any]) -> Schedule:
channel_data = data.data["result"]["channels"][0]
channel = Channel(id=channel_data["alias"], name=channel_data["name"], provider=PROVIDER)
default_category = CATEGORY_PARSER.parse(channel.name)
values = []
start = datetime.datetime.combine(data.context.date, datetime.time.min)
end = start + datetime.timedelta(days=1, hours=6)
@@ -43,8 +41,7 @@ class MatchTVScheduleParser(JSONContextParser[ScheduleData, Schedule]):
start += datetime.timedelta(days=1)
item_date += datetime.timedelta(days=1)
live = "Прямая трансляция" in title
category = CATEGORY_PARSER.parse(title) or default_category
value = ScheduleValue(start=item_date, end=end, label=title, category=category, live=live)
value = ScheduleValue(start=item_date, end=end, label=title, live=live)
values.append(value)
if prev_value is not None:
prev_value.end = item_date
+1 -2
View File
@@ -29,7 +29,6 @@ class YandexTVApi(ScheduleApi):
return self.channel_parser.parse(data)
async def get_schedule(self, channel_id: str, date: datetime.date) -> Schedule:
channel_path_part = "channel" if "-" in channel_id else "channels"
endpoint = f"{self.lr}/{channel_path_part}/{channel_id}?date={date:%Y-%m-%d}"
endpoint = f"{self.lr}/channel/{channel_id}?date={date:%Y-%m-%d}"
data = await self.source.request(endpoint)
return self.schedule_parser.parse(ScheduleData(date, channel_id, data))
+2 -4
View File
@@ -5,11 +5,10 @@ from typing import Any
from bs4 import Tag
from gallery.sketch.parse.core import ParsedContext, ParseError
from gallery.sketch.parse.html import HTMLContextParser
from gallery.sketch.parse.json import JSONParser
from gallery.sketch.schedule.model import Channel, Schedule, ScheduleValue
from gallery.sketch.schedule.parse.category import CATEGORY_PARSER
from ...sketch.parse.html import HTMLContextParser
from . import PROVIDER
@@ -38,8 +37,7 @@ class YandexTVScheduleParser(HTMLContextParser[ScheduleData, Schedule]):
current_day += datetime.timedelta(days=1)
item_date += datetime.timedelta(days=1)
live = item.select_one(".channel-schedule__info .icon_live") is not None
category = CATEGORY_PARSER.parse(title)
value = ScheduleValue(start=item_date, end=end, label=title, category=category, live=live)
value = ScheduleValue(start=item_date, end=end, label=title, live=live)
values.append(value)
if prev_value is not None:
prev_value.end = item_date
-28
View File
@@ -1,28 +0,0 @@
from gallery.sketch.parse.core import Parser
class CategoryParser(Parser[str, str | None]):
CATEGORY_MAP = {
"гандбол": "handball",
"хоккей": "hockey",
"бильярд": "billiards",
"волейбол": "volleyball",
"футбол": "soccer",
"футзал": "futsal",
"баскетбол": "basketball",
"плавание": "swimming",
"автоспорт": "motorsport",
"регби": "rugby",
"велоспорт": "cycling",
"гимнастика": "gymnastics",
}
def parse(self, data: str) -> str | None:
data = data.lower()
for k, v in self.CATEGORY_MAP.items():
if k in data:
return v
return None
CATEGORY_PARSER = CategoryParser()
+9 -9
View File
@@ -1,16 +1,16 @@
[project]
name = "gallery"
description = ""
version = "0.10.6"
version = "0.10.1"
readme = "README.md"
authors = [{ name = "shmyga", email = "shmyga.z@gmail.com" }]
requires-python = ">=3.14,<4.0"
requires-python = '>=3.14,<4.0'
dependencies = [
"aiohttp (>=3.14,<4.0)",
"beautifulsoup4 (>=4.15,<5.0)",
"dateparser (>=1.4,<2.0)",
"pydantic (>=2.13,<3.0)",
"aiocache[redis] (>=0.12,<0.13)",
'aiohttp (>=3.14,<4.0)',
'beautifulsoup4 (>=4.15,<5.0)',
'dateparser (>=1.4,<2.0)',
'pydantic (>=2.13,<3.0)',
'aiocache[redis] (>=0.12,<0.13)',
"playwright (>=1.62.0,<2.0.0)",
]
@@ -30,10 +30,10 @@ gallery = "gallery.main:run"
[tool.poetry]
packages = [{ include = "gallery" }]
requires-poetry = ">=2.0.0,<3.0.0"
requires-poetry = '>=2.0.0,<3.0.0'
[build-system]
requires = ["poetry-core (>=2.0.0,<3.0.0)"]
requires = ['poetry-core (>=2.0.0,<3.0.0)']
build-backend = "poetry.core.masonry.api"
[tool.black]
+2 -2
View File
@@ -1,12 +1,12 @@
{
"name": "gallery",
"version": "0.10.6",
"version": "0.10.1",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "gallery",
"version": "0.10.6",
"version": "0.10.1",
"license": "ISC",
"dependencies": {
"@popperjs/core": "^2.11.8",
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "gallery",
"version": "0.10.6",
"version": "0.10.1",
"type": "module",
"scripts": {
"build": "webpack --mode production",
Binary file not shown.

Before

Width:  |  Height:  |  Size: 15 KiB

+2 -4
View File
@@ -4,7 +4,5 @@ import "./app/common/tooltips";
import "./app/components/app-link";
import "./app/schedule";
import "./app/weather";
import { init as scheduleIconsInit } from "./lib/schedule-icons";
import { init as weatherIconsInit } from "./lib/weather-icons";
weatherIconsInit("/static/weather-icons/icons");
scheduleIconsInit("/static/schedule-icons/icons");
import { init } from "./lib/weather-icons";
init("/static/weather-icons/icons");
-3
View File
@@ -48,7 +48,4 @@
&.bi-cast {
mask-image: url(bootstrap-icons/icons/cast.svg);
}
&.bi-filetype-json {
mask-image: url(bootstrap-icons/icons/filetype-json.svg);
}
}
@@ -1 +0,0 @@
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M2.34,14.63C2.94,14.41 3.56,14.3 4.22,14.3C5.56,14.3 6.73,14.72 7.73,15.56L4.59,18.7C3.53,17.5 2.78,16.13 2.34,14.63M15.56,9.8C17.53,11.27 19.66,11.63 21.94,10.88C21.97,11.09 22,11.47 22,12C22,13.03 21.75,14.18 21.28,15.45C20.81,16.71 20.23,17.73 19.55,18.5L13.22,12.19L15.56,9.8M8.77,16.64C9.83,18.17 10.05,19.84 9.42,21.66C8,21.25 6.73,20.61 5.67,19.73L8.77,16.64M12.19,13.22L18.5,19.55C16.33,21.45 13.78,22.25 10.88,21.94C11.09,21.28 11.2,20.56 11.2,19.78C11.2,19.16 11.06,18.43 10.78,17.6C10.5,16.77 10.17,16.09 9.8,15.56L12.19,13.22M8.81,14.5C7.88,13.67 6.8,13.15 5.58,12.91C4.36,12.68 3.19,12.75 2.06,13.13C2.03,12.91 2,12.53 2,12C2,10.97 2.25,9.82 2.72,8.55C3.19,7.29 3.77,6.27 4.45,5.5L11.11,12.19L8.81,14.5M15.56,7.73C14.22,6.08 13.91,4.28 14.63,2.34C15.25,2.5 15.96,2.8 16.76,3.26C17.55,3.71 18.2,4.16 18.7,4.59L15.56,7.73M21.66,9.38C21.06,9.59 20.44,9.7 19.78,9.7C18.69,9.7 17.64,9.38 16.64,8.72L19.73,5.67C20.61,6.77 21.25,8 21.66,9.38M12.19,11.11L5.5,4.45C7.67,2.55 10.22,1.75 13.13,2.06C12.91,2.72 12.8,3.44 12.8,4.22C12.8,4.94 12.96,5.75 13.29,6.66C13.62,7.56 14,8.28 14.5,8.81L12.19,11.11Z" /></svg>

Before

Width:  |  Height:  |  Size: 1.2 KiB

@@ -1 +0,0 @@
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M11,13H13V15H11M11,9H13V11H11M11,17H13A2,2 0 0,0 15,15V13.5A1.5,1.5 0 0,0 13.5,12A1.5,1.5 0 0,0 15,10.5V9A2,2 0 0,0 13,7H11A2,2 0 0,0 9,9V10.5A1.5,1.5 0 0,0 10.5,12A1.5,1.5 0 0,0 9,13.5V15A2,2 0 0,0 11,17M12,1C5.92,1 1,5.92 1,12C1,18.08 5.92,23 12,23C18.08,23 23,18.08 23,12C23,5.92 18.08,1 12,1M12,19A7,7 0 0,1 5,12A7,7 0 0,1 12,5A7,7 0 0,1 19,12A7,7 0 0,1 12,19Z" /></svg>

Before

Width:  |  Height:  |  Size: 443 B

@@ -1 +0,0 @@
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M5,20.5A3.5,3.5 0 0,1 1.5,17A3.5,3.5 0 0,1 5,13.5A3.5,3.5 0 0,1 8.5,17A3.5,3.5 0 0,1 5,20.5M5,12A5,5 0 0,0 0,17A5,5 0 0,0 5,22A5,5 0 0,0 10,17A5,5 0 0,0 5,12M14.8,10H19V8.2H15.8L13.86,4.93C13.57,4.43 13,4.1 12.4,4.1C11.93,4.1 11.5,4.29 11.2,4.6L7.5,8.29C7.19,8.6 7,9 7,9.5C7,10.13 7.33,10.66 7.85,10.97L11.2,13V18H13V11.5L10.75,9.85L13.07,7.5M19,20.5A3.5,3.5 0 0,1 15.5,17A3.5,3.5 0 0,1 19,13.5A3.5,3.5 0 0,1 22.5,17A3.5,3.5 0 0,1 19,20.5M19,12A5,5 0 0,0 14,17A5,5 0 0,0 19,22A5,5 0 0,0 24,17A5,5 0 0,0 19,12M16,4.8C17,4.8 17.8,4 17.8,3C17.8,2 17,1.2 16,1.2C15,1.2 14.2,2 14.2,3C14.2,4 15,4.8 16,4.8Z" /></svg>

Before

Width:  |  Height:  |  Size: 679 B

@@ -1 +0,0 @@
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M16.93 17.12L16.13 15.76L17.59 11.39L19 10.92L20 11.67C20 11.7 20 11.75 20 11.81C20 11.88 20.03 11.94 20.03 12C20.03 13.97 19.37 15.71 18.06 17.21L16.93 17.12M9.75 15L8.38 10.97L12 8.43L15.62 10.97L14.25 15H9.75M12 20.03C11.12 20.03 10.29 19.89 9.5 19.61L8.81 18.1L9.47 17H14.58L15.19 18.1L14.5 19.61C13.71 19.89 12.88 20.03 12 20.03M5.94 17.21C5.41 16.59 4.95 15.76 4.56 14.75C4.17 13.73 3.97 12.81 3.97 12C3.97 11.94 4 11.88 4 11.81C4 11.75 4 11.7 4 11.67L5 10.92L6.41 11.39L7.87 15.76L7.07 17.12L5.94 17.21M11 5.29V6.69L7 9.46L5.66 9.04L5.24 7.68C5.68 7 6.33 6.32 7.19 5.66S8.87 4.57 9.65 4.35L11 5.29M14.35 4.35C15.13 4.57 15.95 5 16.81 5.66C17.67 6.32 18.32 7 18.76 7.68L18.34 9.04L17 9.47L13 6.7V5.29L14.35 4.35M4.93 4.93C3 6.89 2 9.25 2 12S3 17.11 4.93 19.07 9.25 22 12 22 17.11 21 19.07 19.07 22 14.75 22 12 21 6.89 19.07 4.93 14.75 2 12 2 6.89 3 4.93 4.93Z" /></svg>

Before

Width:  |  Height:  |  Size: 944 B

@@ -1 +0,0 @@
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M4 6C4 4.9 4.9 4 6 4S8 4.9 8 6 7.1 8 6 8 4 7.1 4 6M1 9H7L14 4L15.31 5.5L11.14 8.5H14L21.8 4L23 5.4L14.5 12L14 22H12L11.5 12L8 11H1V9Z" /></svg>

Before

Width:  |  Height:  |  Size: 212 B

@@ -1 +0,0 @@
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M15.83 10.43A6.93 6.93 0 0 1 18.39 14.86A6.64 6.64 0 0 1 17.5 19.5L15.78 18.5A5 5 0 0 0 16.44 16A5.22 5.22 0 0 0 15.46 13.06L9.18 23.93L7.44 22.95L10.44 17.75L8.71 16.76L7.21 19.34L5.5 18.36L10.63 9.45A7 7 0 0 1 8.8 5.46A6.91 6.91 0 0 1 9.69 1.1L11.43 2.13A4.84 4.84 0 0 0 10.91 5.9A4.74 4.74 0 0 0 13.21 8.93M16 5A2 2 0 1 0 18 7A2 2 0 0 0 16 5M13.5 1A1.5 1.5 0 1 0 15 2.5A1.5 1.5 0 0 0 13.5 1Z" /></svg>

Before

Width:  |  Height:  |  Size: 473 B

@@ -1 +0,0 @@
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M12,5C6.5,5 2,6.57 2,8.5C2,10.43 6.5,12 12,12C17.5,12 22,10.43 22,8.5C22,6.57 17.5,5 12,5M2,11.76V16.5C2,18.43 6.5,20 12,20C17.5,20 22,18.43 22,16.5V11.76C21.33,12.22 20.58,12.57 19.73,12.86C17.62,13.6 14.95,14 12,14C9.05,14 6.38,13.6 4.27,12.86C3.42,12.57 2.67,12.22 2,11.76Z" /></svg>

Before

Width:  |  Height:  |  Size: 355 B

@@ -1 +0,0 @@
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M12,16A3,3 0 0,1 9,13C9,11.88 9.61,10.9 10.5,10.39L20.21,4.77L14.68,14.35C14.18,15.33 13.17,16 12,16M12,3C13.81,3 15.5,3.5 16.97,4.32L14.87,5.53C14,5.19 13,5 12,5A8,8 0 0,0 4,13C4,15.21 4.89,17.21 6.34,18.65H6.35C6.74,19.04 6.74,19.67 6.35,20.06C5.96,20.45 5.32,20.45 4.93,20.07V20.07C3.12,18.26 2,15.76 2,13A10,10 0 0,1 12,3M22,13C22,15.76 20.88,18.26 19.07,20.07V20.07C18.68,20.45 18.05,20.45 17.66,20.06C17.27,19.67 17.27,19.04 17.66,18.65V18.65C19.11,17.2 20,15.21 20,13C20,12 19.81,11 19.46,10.1L20.67,8C21.5,9.5 22,11.18 22,13Z" /></svg>

Before

Width:  |  Height:  |  Size: 612 B

@@ -1 +0,0 @@
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M16.22,16.22C18.25,14.19 19.33,11.5 19.45,8.2C18.36,10.61 16.81,12.81 14.81,14.81C12.81,16.81 10.61,18.36 8.2,19.45C11.5,19.36 14.16,18.28 16.22,16.22M7.78,7.78C5.75,9.81 4.67,12.5 4.55,15.8C5,14.8 5.7,13.65 6.61,12.35C7.5,11.05 8.38,10 9.19,9.19C11.19,7.19 13.39,5.64 15.8,4.55C12.5,4.64 9.84,5.72 7.78,7.78M20.5,3.5C21,4.05 21.34,5.11 21.47,6.7C21.59,8.3 21.35,10.16 20.74,12.3C20.13,14.45 19.11,16.23 17.67,17.67C16.36,19 14.8,19.95 13,20.55C11.21,21.16 9.44,21.47 7.69,21.47C5.56,21.47 4.17,21.14 3.5,20.5C3,19.95 2.66,18.89 2.53,17.3C2.41,15.7 2.65,13.84 3.26,11.7C3.87,9.55 4.89,7.77 6.33,6.33C7.64,5 9.2,4.05 11,3.45C12.79,2.84 14.56,2.53 16.31,2.53C18.44,2.53 19.83,2.86 20.5,3.5Z" /></svg>

Before

Width:  |  Height:  |  Size: 767 B

@@ -1 +0,0 @@
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M16.93 17.12L16.13 15.76L17.59 11.39L19 10.92L20 11.67C20 11.7 20 11.75 20 11.81C20 11.88 20.03 11.94 20.03 12C20.03 13.97 19.37 15.71 18.06 17.21L16.93 17.12M9.75 15L8.38 10.97L12 8.43L15.62 10.97L14.25 15H9.75M12 20.03C11.12 20.03 10.29 19.89 9.5 19.61L8.81 18.1L9.47 17H14.58L15.19 18.1L14.5 19.61C13.71 19.89 12.88 20.03 12 20.03M5.94 17.21C5.41 16.59 4.95 15.76 4.56 14.75C4.17 13.73 3.97 12.81 3.97 12C3.97 11.94 4 11.88 4 11.81C4 11.75 4 11.7 4 11.67L5 10.92L6.41 11.39L7.87 15.76L7.07 17.12L5.94 17.21M11 5.29V6.69L7 9.46L5.66 9.04L5.24 7.68C5.68 7 6.33 6.32 7.19 5.66S8.87 4.57 9.65 4.35L11 5.29M14.35 4.35C15.13 4.57 15.95 5 16.81 5.66C17.67 6.32 18.32 7 18.76 7.68L18.34 9.04L17 9.47L13 6.7V5.29L14.35 4.35M4.93 4.93C3 6.89 2 9.25 2 12S3 17.11 4.93 19.07 9.25 22 12 22 17.11 21 19.07 19.07 22 14.75 22 12 21 6.89 19.07 4.93 14.75 2 12 2 6.89 3 4.93 4.93Z" /></svg>

Before

Width:  |  Height:  |  Size: 944 B

@@ -1 +0,0 @@
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M2,15C3.67,14.25 5.33,13.5 7,13.17V5A3,3 0 0,1 10,2C11.31,2 12.42,2.83 12.83,4H10A1,1 0 0,0 9,5V6H14V5A3,3 0 0,1 17,2C18.31,2 19.42,2.83 19.83,4H17A1,1 0 0,0 16,5V14.94C18,14.62 20,13 22,13V15C19.78,15 17.56,17 15.33,17C13.11,17 10.89,15 8.67,15C6.44,15 4.22,16 2,17V15M14,8H9V10H14V8M14,12H9V13C10.67,13.16 12.33,14.31 14,14.79V12M2,19C4.22,18 6.44,17 8.67,17C10.89,17 13.11,19 15.33,19C17.56,19 19.78,17 22,17V19C19.78,19 17.56,21 15.33,21C13.11,21 10.89,19 8.67,19C6.44,19 4.22,20 2,21V19Z" /></svg>

Before

Width:  |  Height:  |  Size: 571 B

@@ -1 +0,0 @@
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M19.04 4.85C17.34 3.2 15.33 2.25 13 2V5.62L22 10.8C21.72 8.5 20.73 6.5 19.04 4.85M12 22C15.44 22 18.16 20.62 20.17 17.86L17.06 16L8.07 21.2C9.32 21.73 10.64 22 12 22M13 11.41L21.15 16.07C21.59 15.13 21.88 14.14 22 13.11L13 7.93V11.41M3.88 17.81C4.54 18.72 5.26 19.46 6.05 20L15.04 14.9L12 13.15L3.88 17.81M11.04 2C10 2.09 9 2.36 8 2.8V13.15L11.04 11.41V2M2 12C2 13.39 2.3 14.77 2.89 16.12L6 14.28V4C3.33 6 2 8.65 2 12Z" /></svg>

Before

Width:  |  Height:  |  Size: 497 B

-6
View File
@@ -1,6 +0,0 @@
import { ScheduleIconElement } from "./schedule-icons";
export const init = (iconsPath: string) => {
ScheduleIconElement.iconsPath = iconsPath;
customElements.define("schedule-icon", ScheduleIconElement);
};
@@ -1,19 +0,0 @@
schedule-icon {
display: inline-block;
text-transform: none;
line-height: 1;
vertical-align: 0.125em;
width: 1em;
height: 1em;
mask-size: contain;
mask-position: 50%;
mask-repeat: no-repeat;
color: currentColor;
> svg {
path {
fill: currentColor;
}
}
}
@@ -1,19 +0,0 @@
export class ScheduleIconElement extends HTMLElement {
static iconsPath = "./icons";
static observedAttributes = ["icon"];
constructor() {
super();
const icon = this.getAttribute("icon");
if (icon) {
this.icon = icon;
}
}
set icon(value: string) {
const src = `${ScheduleIconElement.iconsPath}/${value}.svg`;
fetch(src)
.then((response) => (response.ok ? response.text() : ""))
.then((data) => (this.innerHTML = data));
}
}
@@ -11,6 +11,7 @@ export class WeatherIconElement extends HTMLElement {
}
set icon(value: string) {
console.log('!', WeatherIconElement.iconsPath);
const src = `${WeatherIconElement.iconsPath}/wi-${value}.svg`;
fetch(src)
.then((response) => response.text())
-1
View File
@@ -2,7 +2,6 @@
@import "./lib/bootstrap";
@import "./lib/bootstrap-icons";
@import "./lib/weather-icons";
@import "./lib/schedule-icons/sass/schedule-icons.scss";
@import "./styles/weather.scss";
@import "./styles/app";
-13
View File
@@ -56,22 +56,14 @@ const config: webpack.Configuration = {
new MiniCssExtractPlugin({ filename: `${packageInfo.name}.css` }),
new CopyPlugin({
patterns: [
// weather icons
{
from: "./src/lib/weather-icons/icons/*.svg",
to: "weather-icons/icons/[name][ext]",
},
// schedule icons
{
from: "./src/lib/schedule-icons/icons/*.svg",
to: "schedule-icons/icons/[name][ext]",
},
// bootstrap icons
{
from: "./node_modules/bootstrap-icons/icons/*.svg",
to: "bootstrap-icons/icons/[name][ext]",
},
// flag icons
{
from: "./node_modules/flag-icons/flags/1x1/*.svg",
to: "flag-icons/flags/1x1/[name][ext]",
@@ -80,11 +72,6 @@ const config: webpack.Configuration = {
from: "./node_modules/flag-icons/flags/4x3/*.svg",
to: "flag-icons/flags/4x3/[name][ext]",
},
// favicon
{
from: "./src/favicon.ico",
to: "favicon.ico",
},
],
}),
],