trmnl_preview 0.12.0 → 0.13.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/CHANGELOG.md +9 -0
- data/db/data/form_fields.yml +1 -0
- data/lib/trmnlp/commands/login.rb +2 -2
- data/lib/trmnlp/config/plugin.rb +1 -0
- data/lib/trmnlp/user_data_assembler.rb +7 -2
- data/lib/trmnlp/version.rb +1 -1
- data/web/public/index.js +9 -5
- metadata +1 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: ecba4b3a3029f83fccf8ec4efd0215f8a83a8d0d12f2bdaaeef01ee4647b7f8a
|
|
4
|
+
data.tar.gz: bdbca95517982906657d3b568446c8c525976d9cd0a128e2a96d7c923ff8b59b
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 7e599a894d8ef1fc3c3f89f22293284e188d26a563cc063bba5dbdee35865da6eac91ef64c27d1684f91e160e946433b52cf438ecd8f6c02f6cff5ccccbaba0e
|
|
7
|
+
data.tar.gz: aeb473789628ed40f5a68b14978dddb6ac1fbc49d32828a69c1a4de68abca941ba3288f6d5fac2be66f0c9f0ed4869389b5be8cf6c9d3ecb59db4a3dd0257ef0
|
data/CHANGELOG.md
CHANGED
|
@@ -1,6 +1,15 @@
|
|
|
1
1
|
|
|
2
2
|
# Changelog
|
|
3
3
|
|
|
4
|
+
## 0.13.1
|
|
5
|
+
|
|
6
|
+
- `lat_lon` is a known form field type, so `trmnlp lint`, `build` and `serve` no longer warn "unknown field_type: lat_lon" for a location field. The vendored list in `db/data/form_fields.yml` predated the hosted service adding it. (#129)
|
|
7
|
+
|
|
8
|
+
## 0.13.0
|
|
9
|
+
|
|
10
|
+
- `trmnlp login` now accepts the scoped API keys trmnl.com issues with a `trmnl_` prefix, as well as `user_` account keys. It used to refuse them with "Invalid API key; did you copy it from the right place?" before checking them with the server. A scoped key needs the profile capability to log in, read to list and pull, and content to push. With delete as well, a failed first push removes the plugin it created. (#132)
|
|
11
|
+
- The local preview now fills the `trmnl` fields the hosted service added: `trmnl.device.model`, `bit_depth`, `firmware_version`, `refresh_interval_seconds`, `sleep_mode_enabled`, `sleep_start_time` and `sleep_end_time`, and `trmnl.plugin_settings.refresh_interval_minutes`. The model and bit depth follow the device picker, with `og_plus` and 2 when nothing is picked. (#131)
|
|
12
|
+
|
|
4
13
|
## 0.12.0
|
|
5
14
|
|
|
6
15
|
- `required_ruby_version` is now `>= 4.0`, matching the Ruby version trmnlp actually needs. It has understated the real floor since 0.4.0: both `xdg` (Ruby 4.0 in the 10.x series pinned since 0.8.0) and `trmnl-liquid` (Ruby 4.0 since 0.5.0) require more than the gemspec claimed. RubyGems resolves against the declared value, so `gem install trmnl_preview` on an older Ruby did not fail. It quietly walked backwards to the newest version whose dependency tree resolved, reporting "Successfully installed" for a build up to twenty months old. On Ruby 3.4 that was 0.7.1, and on Ruby 3.3 and below it was 0.3.2, which predates the Thor CLI and offers only `serve`, `build` and `version`. Asking for the current version explicitly (`gem install trmnl_preview -v 0.11.0`) crashed RubyGems inside its own conflict reporting rather than explaining the problem. Installing on an unsupported Ruby now stops with "requires Ruby version >= 4.0".
|
data/db/data/form_fields.yml
CHANGED
|
@@ -17,8 +17,8 @@ module TRMNLP
|
|
|
17
17
|
api_key = prompt('API Key: ')
|
|
18
18
|
raise InvalidApiKey, 'API key cannot be empty' if api_key.empty?
|
|
19
19
|
|
|
20
|
-
# Only trmnl.com issues user_
|
|
21
|
-
if config.app.trmnl_host? && !api_key.start_with?('user_')
|
|
20
|
+
# Only trmnl.com issues user_ and trmnl_ prefixed keys; BYOS servers use their own token formats (e.g. Sanctum).
|
|
21
|
+
if config.app.trmnl_host? && !api_key.start_with?('user_', 'trmnl_')
|
|
22
22
|
raise InvalidApiKey,
|
|
23
23
|
'Invalid API key; did you copy it from the right place?'
|
|
24
24
|
end
|
data/lib/trmnlp/config/plugin.rb
CHANGED
|
@@ -29,7 +29,8 @@ module TRMNLP
|
|
|
29
29
|
end
|
|
30
30
|
|
|
31
31
|
def device_from_params(params)
|
|
32
|
-
{ 'width' => params[:width]&.to_i, 'height' => params[:height]&.to_i
|
|
32
|
+
{ 'width' => params[:width]&.to_i, 'height' => params[:height]&.to_i,
|
|
33
|
+
'model' => params[:model], 'bit_depth' => params[:bit_depth]&.to_i }.compact
|
|
33
34
|
end
|
|
34
35
|
|
|
35
36
|
private
|
|
@@ -86,13 +87,17 @@ module TRMNLP
|
|
|
86
87
|
{
|
|
87
88
|
'friendly_id' => 'ABC123', 'percent_charged' => 85.0, 'wifi_strength' => 90,
|
|
88
89
|
'height' => device['height'] || DEFAULT_DEVICE_HEIGHT,
|
|
89
|
-
'width' => device['width'] || DEFAULT_DEVICE_WIDTH
|
|
90
|
+
'width' => device['width'] || DEFAULT_DEVICE_WIDTH,
|
|
91
|
+
'model' => device['model'] || 'og_plus', 'bit_depth' => device['bit_depth'] || 2,
|
|
92
|
+
'firmware_version' => '1.6.3', 'refresh_interval_seconds' => 900,
|
|
93
|
+
'sleep_mode_enabled' => false, 'sleep_start_time' => 1320, 'sleep_end_time' => 480
|
|
90
94
|
}
|
|
91
95
|
end
|
|
92
96
|
|
|
93
97
|
def plugin_settings_namespace
|
|
94
98
|
{
|
|
95
99
|
'instance_name' => 'instance_name',
|
|
100
|
+
'refresh_interval_minutes' => config.plugin.refresh_interval,
|
|
96
101
|
'strategy' => config.plugin.strategy,
|
|
97
102
|
'dark_mode' => config.plugin.dark_mode,
|
|
98
103
|
'polling_headers' => config.plugin.polling_headers_encoded,
|
data/lib/trmnlp/version.rb
CHANGED
data/web/public/index.js
CHANGED
|
@@ -20,18 +20,22 @@ trmnlp.connectLiveRender = function () {
|
|
|
20
20
|
};
|
|
21
21
|
|
|
22
22
|
|
|
23
|
+
// trmnl.device values the picked model and palette decide.
|
|
24
|
+
trmnlp.deviceParams = function (state) {
|
|
25
|
+
const bitDepth = Math.ceil(Math.log2(state.palette?.grays || 2));
|
|
26
|
+
return new URLSearchParams({ width: state.width, height: state.height, model: state.model.name, bit_depth: bitDepth });
|
|
27
|
+
};
|
|
28
|
+
|
|
23
29
|
trmnlp.fetchPreview = function (pickerState) {
|
|
24
30
|
const state = pickerState || trmnlp.picker?.state;
|
|
25
31
|
const screenClasses = (state?.screenClasses || []).join(" ");
|
|
26
32
|
const encodedScreenClasses = encodeURIComponent(screenClasses);
|
|
27
33
|
let src = `/render/${trmnlp.view}.${trmnlp.formatSelect.value}?screen_classes=${encodedScreenClasses}`;
|
|
28
34
|
|
|
29
|
-
// Pass
|
|
35
|
+
// Pass the device for both HTML and PNG renders so trmnl.device.{width,height,model,bit_depth}
|
|
30
36
|
// in the Liquid context tracks the picker model selection.
|
|
31
37
|
if (state) {
|
|
32
|
-
|
|
33
|
-
const height = encodeURIComponent(state.height);
|
|
34
|
-
src += `&width=${width}&height=${height}`;
|
|
38
|
+
src += `&${trmnlp.deviceParams(state)}`;
|
|
35
39
|
}
|
|
36
40
|
|
|
37
41
|
// PNG-only: dark mode + color depth from palette
|
|
@@ -48,7 +52,7 @@ trmnlp.fetchPreview = function (pickerState) {
|
|
|
48
52
|
|
|
49
53
|
trmnlp.refreshUserData = async function (state) {
|
|
50
54
|
if (!state) return;
|
|
51
|
-
const params =
|
|
55
|
+
const params = trmnlp.deviceParams(state);
|
|
52
56
|
try {
|
|
53
57
|
const response = await fetch(`/data?${params}`);
|
|
54
58
|
if (!response.ok) return;
|