From 63e9e4cdc605e026037956e3ae018174bd0c0c17 Mon Sep 17 00:00:00 2001 From: Emilien Devos <4016501+unixfox@users.noreply.github.com> Date: Sat, 4 Nov 2023 18:38:55 +0100 Subject: [PATCH] also updating crystal version and shards --- .github/workflows/ci.yml | 2 +- Dockerfile | 6 +++--- shard.lock | 10 +++------- shard.yml | 7 ++++--- src/instances.cr | 2 +- 5 files changed, 12 insertions(+), 15 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index aaa67171..edcfee76 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -18,7 +18,7 @@ jobs: - name: Install Crystal uses: oprypin/install-crystal@v1 with: - crystal: 1.0.0 + crystal: 1.10.1 - name: Cache Shards uses: actions/cache@v2 diff --git a/Dockerfile b/Dockerfile index 2b3b239f..2b4b5542 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,12 +1,12 @@ -FROM docker.io/crystallang/crystal:1.0.0-alpine AS builder +FROM crystallang/crystal:1.10.1-alpine AS builder WORKDIR /app COPY ./shard.yml ./shard.yml RUN shards install COPY ./src/ ./src/ RUN crystal build ./src/instances.cr --release -FROM alpine:latest -RUN apk add --no-cache gc pcre libgcc +FROM alpine:3.18 +RUN apk add --no-cache gc pcre2 libgcc WORKDIR /app RUN addgroup -g 1000 -S invidious && \ adduser -u 1000 -S invidious -G invidious diff --git a/shard.lock b/shard.lock index c4cb889f..82d8d024 100644 --- a/shard.lock +++ b/shard.lock @@ -2,19 +2,15 @@ version: 2.0 shards: backtracer: git: https://github.com/sija/backtracer.cr.git - version: 1.2.1 + version: 1.2.2 exception_page: git: https://github.com/crystal-loot/exception_page.git - version: 0.2.0 + version: 0.3.1 kemal: git: https://github.com/kemalcr/kemal.git - version: 1.0.0+git.commit.218be2422172d330feb62c6a8abc7df5402fdb84 - - kilt: - git: https://github.com/jeromegn/kilt.git - version: 0.6.1 + version: 1.4.0 radix: git: https://github.com/luislavena/radix.git diff --git a/shard.yml b/shard.yml index 7599b586..ee5cab27 100644 --- a/shard.yml +++ b/shard.yml @@ -1,8 +1,9 @@ name: instances -version: 0.1.0 +version: 0.2.0 authors: - Omar Roth + - Invidious team targets: instances: @@ -11,8 +12,8 @@ targets: dependencies: kemal: github: kemalcr/kemal - branch: master + version: ~> 1.4.0 -crystal: 1.0.0 +crystal: 1.10.1 license: AGPLv3 diff --git a/src/instances.cr b/src/instances.cr index c885fd7b..ea24de05 100644 --- a/src/instances.cr +++ b/src/instances.cr @@ -160,7 +160,7 @@ SORT_PROCS = { "api" => ->(name : String, instance : Instance) { instance[:api] == nil ? 2 : instance[:api] ? 0 : 1 }, "users" => ->(name : String, instance : Instance) { -(instance[:stats]?.try &.["usage"]?.try &.["users"]["total"].as_i || 0) }, "version" => ->(name : String, instance : Instance) { instance[:stats]?.try &.["software"]?.try &.["version"].as_s.try &.split("-", 2)[0].split(".").map { |a| -a.to_i } || [0, 0, 0] }, - "playback" => ->(name : String, instance : Instance) { -(instance[:stats]?.try &.["playback"]?.try &.["ratio"]?.try { |ratio| ratio.as_f.to_i * 100 } || 100) }, + "playback" => ->(name : String, instance : Instance) { -(instance[:stats]?.try &.["playback"]?.try &.["ratio"]?.try { |ratio| ratio.as_f } || 0.0) }, } def sort_instances(instances, sort_by)