10000 Releases Β· glanceapp/glance Β· GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Releases: glanceapp/glance

v0.7.13

22 Apr 22:19
Compare
Choose a tag to compare

New

  • [Custom API] Added parseLocalTime function, which works like parseTime, however in the absence of a timezone it uses the local timezone instead of UTC.
  • [Search widget] Added target property which is used when opening the search results in a new tab (thanks @Jacksaur)

Fixes

  • [Server stats widget] Fixed being unable to retrieve temperature sensors in some instances (thanks @anxdpanic)
  • [Reddit widget] Fixed the URL not being correctly escaped when using request-url-template (thanks @yurigiu)

v0.7.12

14 Apr 00:16
Compare
Choose a tag to compare

Fixed server crash in some configurations when a widget is provided with a single resource to fetch instead of multiple

v0.7.11

13 Apr 16:22
Compare
Choose a tag to compare

What's changed

  • [RSS widget] Duplicate post links will now be filtered out (thanks @HtFilia)
  • [Custom API widget] Added replaceMatches and unique functions (thanks @ralphocdol)
  • Added mountpoint:info CLI command
  • Added more details to the output of sensors:print CLI command

Fixes

  • [Twitch channels widget] Fixed live channels with 0 viewers getting incorrectly sorted lower than offline channels
  • [Server stats widget] Potential fix for missing mountpoint stats
  • Fixed the Yahoo finance test request in the diagnose CLI command

v0.7.10

09 Apr 23:51
Compare
Choose a tag to compare

What's Changed

  • Slightly increased the scale of everything on mobile to make things easier to tap on
  • Added sensors:print CLI command that lists all temperature sensors that Glance has access to
  • Bumped versions of dependencies

New Contributors

Full Changelog: v0.7.9...v0.7.10

v0.7.9

29 Mar 18:08
Compare
Choose a tag to compare

Another small release that's primarily focused around custom-api widget improvements.

Changed

You no longer need to convert numbers to float before doing math operations with them. When adding two integers together, the result will be an integer. Adding two floats together or an integer and a float will result in a float.

Before:

{{ (add (.JSON.Int "foo" | toFloat) (.JSON.Int "bar" | toFloat)) | toInt }}

Now:

{{ add (.JSON.Int "foo") (.JSON.Int "bar") }}

(this is consistent for all math operations, not just addition)

New

skip-json-validation and .JSONLines

- type: custom-api
  url: https://api.example.com
  skip-json-validation: true

Some API's return newline separated JSON objects instead of a single JSON array. This is not valid JSON, so the custom-api widget will fail to parse it. You can now set skip-json-validation to true to skip the validation step and parse the response as a list of JSON objects within your template.

{"name": "Steve", "age": 30}
{"name": "Alex", "age": 25}
{"name": "John", "age": 35}

You can then access the JSON objects using .JSONLines:

{{ range .JSONLines }}
  {{ .String "name" }}
{{ end }}

New functions

concat

{{ concat "foo" "bar" "baz" }}

will return foobarbaz.

(thanks @ralphocdol)

now

Returns the current time as a time.Time object.

{{ now }}
{{ now.Hour }}:{{ now.Minute }}:{{ now.Second }}
{{ now.Unix }}
2025-03-29 17:20:18.4905224 +0000 GMT m=+376.954385401
17:20:18
1743268818

This can also be used to convert time to your current timezone:

{{ $parsedTime := .JSON.String "date_created" | parseTime "rfc3339" }}
{{ $created := $parsedTime.In now.Location }}
{{ $created.Hour }}:{{ $created.Minute }}:{{ $created.Second }}

(thanks @not-first & @ralphocdol)

offsetNow

Returns the current time offset by a given amount:

{{ offsetNow "1h" }}
{{ now }}
{{ offsetNow "-1h" }}
2025-03-29 18:44:04.2719241 +0000 GMT m=+4178.324981601
2025-03-29 17:44:04.2719241 +0000 GMT m=+578.324981601
2025-03-29 16:44:04.2719241 +0000 GMT m=-3021.675018399

This can be used to check if something happened within a certain time frame:

{{ $created := .JSON.String "date_created" | parseTime "rfc3339" }}
{{ if ($created.After (offsetNow "-1h")) }}
  Created less than 1 hour ago
{{ end }}

Widget-Title-URL header for extension widget

The extension widget can now return a Widget-Title-URL header to set the link of the widget's title if it has not already been set by the user.

(thanks @not-first)

Fixes

  • The markets widget will now properly display prices of markets where the price is less than 0.01 (thanks @nsdont)

v0.7.8

26 Mar 19:59
Compare
Choose a tag to compare

The custom-api widget has received a lot of positive feedback since its introduction in v0.7.0. Many people have made and shared their own widgets over at the new community-widgets repository as well as the Discord server. This release includes many improvements based on feedback from the community that will make it even more capable and easier to use.

New

Insecure requests

You can now allow insecure requests (those to APIs behind a self-signed certificate) via a allow-insecure property:

- type: custom-api
  url: https://api.example.com
  allow-insecure: true

(thanks @ralphocdol)

Parameters

You can now specify query parameters via a parameters property:

- type: custom-api
  url: https://api.example.com
  parameters:
    foo: bar
    baz: qux

Note

Using the parameters property will override any query parameters specified in the URL.

(thanks @ralphocdol)

Request method and body

You can now specify the request method and body via the method, body-type and body properties:

- type: custom-api
  url: https://api.example.com
  method: POST
  body-type: json
  body:
    foo: bar
    baz: qux

If you set a body, the method will automatically be set to POST and the body-type will be set to json, so you don't have to specify them explicitly.

- type: custom-api
  url: https://api.example.com
  body-type: string
  body: |
    foo=bar&baz=qux

(thanks @not-first)

Subrequests

You can now make multiple requests in a single custom-api widget via a subrequests property:

- type: custom-api
  url: https://api.example.com
  subrequests:
    another-one:
      url: https://api.example.com/another-one
    and-another-one:
      url: https://api.example.com/and-another-one

Subrequests can take all of the same properties as the main request, such as: parameters, headers, method, body-type, body and allow-insecure.

To access the JSON of a subrequest, you can use .Subrequest "key":

<p>{{ (.Subrequest "another-one").JSON.String "foo" }}</p>

This can get cumbersome to write if you need to reference the subrequest in multiple places, so you can instead assign it to a variable:

{{ $anotherOne := .Subrequest "another-one" }}
<p>{{ $anotherOne.JSON.String "foo" }}</p>
<p>{{ $anotherOne.JSON.Int "bar" }}</p>

You can also access the response as you would on the main request:

{{ $andAnotherOne := .Subrequest "and-another-one" }}
<p>{{ $andAnotherOne.Response.StatusCode }}</p>

(thanks @ralphocdol)

New functions

trimPrefix

{"foo": "bazbar"}
<p>{{ .JSON.String "foo" | trimPrefix "baz" }}</p>
<p>bar</p>

trimSuffix

{"foo": "barbaz"}
<p>{{ .JSON.String "foo" | trimSuffix "baz" }}</p>
<p>bar</p>

trimSpace

{"foo": "  bar  "}
<p>{{ .JSON.String "foo" | trimSpace }}</p>
<p>bar</p>

replaceAll

{"foo": "barbazbar"}
<p>{{ .JSON.String "foo" | replaceAll "baz" "bar" }}</p>
<p>barbarbar</p>

findMatch

{"foo": "bar-123456-baz"}
<p>{{ .JSON.String "foo" | findMatch "\\d+" }}</p>

The pattern is a regular expression, although note that backslashes need to be escaped, so \d in a normal regular expression would be \\d here.

<p>123456</p>

findSubmatch

{"foo": "bar-unknown-value"}
<p>{{ .JSON.String "foo" | findSubmatch "bar-(.*)" }}</p>

The pattern is a regular expression, and only the first submatch is returned.

<p>unknown-value</p>

parseTime

{"foo": "2021-01-02T15:04:05Z"}
{{ $parsedTime := .JSON.String "foo" | parseTime "rfc3339" }}
<p>Year: {{ $parsedTime.Year }}</p>
<p>Month: {{ $parsedTime.Month }}</p>
<p>Day: {{ $parsedTime.Day }}</p>
<p>Hour: {{ $parsedTime.Hour }}</p>
<p>Minute: {{ $parsedTime.Minute }}</p>
<p>Second: {{ $parsedTime.Second }}</p>

Other accepted time formats are unix, rfc3339nano, datetime, dateonly or a custom format using Go's date formatting. The returned object is Go's time.Time.

<p>Year: 2021</p>
<p>Month: January</p>
<p>Day: 2</p>
<p>Hour: 15</p>
<p>Minute: 4</p>
<p>Second: 5</p>

toRelativeTime

{"foo": "2021-01-02T15:04:05Z"}
<p {{ .JSON.String "foo" | parseTime "rfc3339" | toRelativeTime }}></p>

Note

The return value of this function must be placed within a tag's attributes, not within its content.

<p data-dynamic-relative-time="1609602245"></p>

This will automatically be converted to 1d, 2h, etc. on the client side.

parseRelativeTime

This is just a shorthand for parsing time and converting it to relative time. Instead of:

<p {{ .JSON.String "foo" | parseTime "rfc3339" | toRelativeTime }}></p>

You can simply do:

<p {{ .JSON.String "foo" | parseRelativeTime "rfc3339" }}></p>

sortByString, sortByInt, sortByFloat, sortByTime

{"students": [
  {"name": "Bob", "age": 20},
  {"name": "Alice", "age": 30},
  {"name": "Charlie", "age": 10}
]}
{{ range .JSON.Array "students" | sortByString "name" "asc" }}
  <p>{{ .String "name" }}</p>
{{ end }}
<p>Alice</p>
<p>Bob</p>
<p>Charlie</p>

{{ range .JSON.Array "students" | sortByInt "age" "desc" }}
  <p>{{ .Int "age" }}</p>
{{ end }}
<p>30</p>
<p>20</p>
<p>10</p>

{"students": [
  {"name": "Bob", "gpa": 3.5},
  {"name": "Alice", "gpa": 4.0},
  {"name": "Charlie", "gpa": 2.0}
]}
{{ range .JSON.Array "students" | sortByFloat "gpa" "asc" }}
  <p>{{ .Float "gpa" }}</p>
{{ end }}
<p>2</p>
<p>3.5</p>
<p>4</p>

{"students": [
  {"name": "Bob", "dob": "2000-01-01"},
  {"name": "Alice", "dob": "1990-01-01"},
  {"name": "Charlie", "dob": "2010-01-01"}
]}
{{ range .JSON.Array "students" | sortByTime "dob" "dateonly" "asc"  }}
  <p>{{ .String "name" }}</p>
{{ end }}

Here, dateonly is the same format that you would use with parseTime.

<p>Alice</p>
<p>Bob</p>
<p>Charlie</p>

Other additions

Extension widget headers property

You can now specify headers in the extension widget:

- type: extension
  headers:
    Authorization: Bearer token

Fixes

  • Fixed being unable to parse an empty response body in the custom-api widget
  • Fixed always overriding query parameters in the extension widget, they will now only be overridden if the parameters property is set

v0.7.7

17 Mar 02:24
Compare
Choose a tag to compare

What's changed

  • Improved accessibility of the Docker containers widget (thanks @Lanie-Carmelo)
  • Reduced the contrast of calendar dates to better match the design language of other widgets
  • Added more info to error messages of DNS stats widget when using service: pihole-v6 to help with debugging issues
  • Changed the integer type in the Custom API widget to int from int64 so that you can now perform calculations on the result of the len function (thanks @titembaatar)

Fixed

  • Videos widget with style vertical-list not ope 10000 ning links in new tab (thanks @aliaghil)
  • DNS stats widget "Top blocked domains" in the UI having an additional triangle on the left on Safari (thanks @lukpep)

v0.7.6

15 Mar 19:43
Compare
Choose a tag to compare

Fixed an issue with the previous release for the DNS stats widget when using service: pihole-v6

v0.7.5

15 Mar 19:06
Compare
Choose a tag to compare

What's Changed

Added support for Pi-hole version 6 via:

- type: dns-stats
  service: pihole-v6
  url: ${PIHOLE_URL}
  password: ${PIHOLE_PASSWORD}

(thanks to @KallanX and @ralphocdol)

Where ${PIHOLE_PASSWORD} is either the admin dashboard password or the application password which can be created from:

Settings -> Web Interface / API -> Configure app password

v0.7.4

12 Mar 18:11
Compare
Choose a tag to compare

What's Changed

  • Made a number of accessibility improvements that should hopefully make Glance available to a wider audience

Fixed

  • Currency symbol not being properly set for some markets (thanks @hkrob)

New Contributors

0