trmnl_preview 0.8.7 → 0.8.9
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/README.md +2 -1
- data/lib/trmnlp/cli.rb +6 -1
- data/lib/trmnlp/commands/list.rb +1 -1
- data/lib/trmnlp/commands/login.rb +26 -16
- data/lib/trmnlp/config/app.rb +7 -0
- data/lib/trmnlp/version.rb +1 -1
- 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: 04ad9007c6a3cc5b8d3c724ec349b204c977f861fc41cb637428fba48c715b89
|
|
4
|
+
data.tar.gz: ebc4873c90c6effcfc356ff13e38eb9b63d7547af14b85dc62eb84bb48145893
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: c43c02691942bcea76563ce97d2b7e55f3327d207747a930374f750ad4edd257f8ed5b5edb94424ec008c3d0047735df33cb51399d44023a28522169613c6148
|
|
7
|
+
data.tar.gz: 125935ffec1af3606b4a1f6e0d7687137349f25f2da0da1f03e989ad598c25b34cf56f23964ab5d16f448632307b858744bd3d7547c5babda94bb8e1bb828ba7
|
data/CHANGELOG.md
CHANGED
|
@@ -1,6 +1,15 @@
|
|
|
1
1
|
|
|
2
2
|
# Changelog
|
|
3
3
|
|
|
4
|
+
## 0.8.9
|
|
5
|
+
|
|
6
|
+
- Fixed `trmnlp serve` binding to localhost under Podman, which left the dev server unreachable through published ports. Container detection only looked for `/.dockerenv`, which Docker writes but Podman does not, so `serve` fell back to `127.0.0.1`. It now also checks for `/run/.containerenv`, which Podman writes, so the automatic `0.0.0.0` bind works for both runtimes. (#112)
|
|
7
|
+
|
|
8
|
+
## 0.8.8
|
|
9
|
+
|
|
10
|
+
- Added a `--server` flag to `trmnlp login` so commands like `trmnlp push` can target a self-hosted (BYOS) server. The chosen URL is saved as `base_url`, and the `user_` API key prefix is only required for trmnl.com; BYOS servers accept their own token formats. A scheme-less `--server` value (such as `localhost:3000`) no longer crashes the host check. (#113)
|
|
11
|
+
- `trmnlp list` now shows plugins with a nil `plugin_id`, which BYOS servers like LaraPaper return. (#113)
|
|
12
|
+
|
|
4
13
|
## 0.8.7
|
|
5
14
|
|
|
6
15
|
- Fixed `.trmnlp.yml` `variables` overrides under the `trmnl` namespace being dropped. The assembler re-applied the pre-override namespace after the transform, clobbering user overrides like `trmnl.user.time_zone`. (#110)
|
data/README.md
CHANGED
|
@@ -206,7 +206,8 @@ docker run \
|
|
|
206
206
|
--pull always \
|
|
207
207
|
--publish 4567:4567 \
|
|
208
208
|
--volume "$(pwd):/plugin" \
|
|
209
|
-
trmnl/trmnlp serve
|
|
209
|
+
trmnl/trmnlp serve \
|
|
210
|
+
--bind 0.0.0.0
|
|
210
211
|
```
|
|
211
212
|
|
|
212
213
|
`--pull always` checks the registry on every run and pulls a newer image if one exists, so you don't have to remember to `docker pull` after each release.
|
data/lib/trmnlp/cli.rb
CHANGED
|
@@ -16,7 +16,11 @@ module TRMNLP
|
|
|
16
16
|
|
|
17
17
|
def self.exit_on_failure? = true
|
|
18
18
|
|
|
19
|
-
|
|
19
|
+
# Docker writes /.dockerenv; Podman writes /run/.containerenv. Either means we're
|
|
20
|
+
# in a container, where binding to localhost makes the dev server unreachable via
|
|
21
|
+
# published ports, so we bind to all interfaces instead.
|
|
22
|
+
def self.in_container? = File.exist?('/.dockerenv') || File.exist?('/run/.containerenv')
|
|
23
|
+
def self.default_bind = in_container? ? '0.0.0.0' : '127.0.0.1'
|
|
20
24
|
|
|
21
25
|
desc 'build', 'Generate static HTML files'
|
|
22
26
|
method_option :png, type: :boolean, default: false, desc: 'Also render a PNG per view'
|
|
@@ -28,6 +32,7 @@ module TRMNLP
|
|
|
28
32
|
end
|
|
29
33
|
|
|
30
34
|
desc 'login', 'Authenticate with TRMNL server'
|
|
35
|
+
method_option :server, type: :string, aliases: '-s', desc: 'Server URL (default: https://trmnl.com)'
|
|
31
36
|
def login
|
|
32
37
|
Commands::Login.run(options)
|
|
33
38
|
end
|
data/lib/trmnlp/commands/list.rb
CHANGED
|
@@ -16,7 +16,7 @@ module TRMNLP
|
|
|
16
16
|
api = APIClient.new(config)
|
|
17
17
|
response = api.get_plugin_settings
|
|
18
18
|
plugins = (response || [])
|
|
19
|
-
.select { |p| p['plugin_id'] == PRIVATE_PLUGIN_ID }
|
|
19
|
+
.select { |p| p['plugin_id'].nil? || p['plugin_id'] == PRIVATE_PLUGIN_ID }
|
|
20
20
|
.sort_by { |p| (p['name'] || '').downcase }
|
|
21
21
|
|
|
22
22
|
if plugins.empty?
|
|
@@ -6,36 +6,46 @@ require_relative '../api_client'
|
|
|
6
6
|
module TRMNLP
|
|
7
7
|
module Commands
|
|
8
8
|
class Login < Base
|
|
9
|
-
Options = Data.define(:dir, :quiet)
|
|
9
|
+
Options = Data.define(:dir, :quiet, :server)
|
|
10
10
|
|
|
11
11
|
def call
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
reporter.info "Currently authenticated as: #{anonymous_key}"
|
|
15
|
-
confirm = prompt('You are already authenticated. Do you want to re-authenticate? (y/N): ')
|
|
16
|
-
return unless confirm.strip.downcase == 'y'
|
|
17
|
-
end
|
|
12
|
+
config.app.base_url = options.server if options.server
|
|
13
|
+
return unless confirm_reauthentication?
|
|
18
14
|
|
|
19
15
|
reporter.info "Please visit #{config.app.account_uri} to grab your API key, then paste it here."
|
|
20
16
|
|
|
21
17
|
api_key = prompt('API Key: ')
|
|
22
18
|
raise InvalidApiKey, 'API key cannot be empty' if api_key.empty?
|
|
23
|
-
|
|
19
|
+
|
|
20
|
+
# Only trmnl.com issues user_-prefixed keys; BYOS servers use their own token formats (e.g. Sanctum).
|
|
21
|
+
if config.app.trmnl_host? && !api_key.start_with?('user_')
|
|
24
22
|
raise InvalidApiKey,
|
|
25
23
|
'Invalid API key; did you copy it from the right place?'
|
|
26
24
|
end
|
|
27
25
|
|
|
28
26
|
config.app.api_key = api_key
|
|
27
|
+
save_credentials
|
|
28
|
+
end
|
|
29
|
+
|
|
30
|
+
private
|
|
29
31
|
|
|
32
|
+
def confirm_reauthentication?
|
|
33
|
+
return true unless config.app.logged_in?
|
|
34
|
+
|
|
35
|
+
anonymous_key = config.app.api_key[0..10] + ('*' * (config.app.api_key.length - 11))
|
|
36
|
+
reporter.info "Currently authenticated as: #{anonymous_key}"
|
|
37
|
+
confirm = prompt('You are already authenticated. Do you want to re-authenticate? (y/N): ')
|
|
38
|
+
confirm.strip.downcase == 'y'
|
|
39
|
+
end
|
|
40
|
+
|
|
41
|
+
def save_credentials
|
|
30
42
|
api_client = APIClient.new(config)
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
raise AuthenticationFailed, "Authentication failed; changes were not saved.\n#{e.message}"
|
|
38
|
-
end
|
|
43
|
+
user_info = api_client.get_me
|
|
44
|
+
reporter.info "Authenticated as #{user_info['name']} (#{user_info['email']})"
|
|
45
|
+
config.app.save
|
|
46
|
+
reporter.info "Saved changes to #{paths.app_config}"
|
|
47
|
+
rescue StandardError => e
|
|
48
|
+
raise AuthenticationFailed, "Authentication failed; changes were not saved.\n#{e.message}"
|
|
39
49
|
end
|
|
40
50
|
end
|
|
41
51
|
end
|
data/lib/trmnlp/config/app.rb
CHANGED
|
@@ -30,8 +30,15 @@ module TRMNLP
|
|
|
30
30
|
@config['api_key'] = key
|
|
31
31
|
end
|
|
32
32
|
|
|
33
|
+
def base_url=(url)
|
|
34
|
+
@config['base_url'] = url
|
|
35
|
+
end
|
|
36
|
+
|
|
33
37
|
def base_uri = URI.parse(@config['base_url'] || 'https://trmnl.com')
|
|
34
38
|
|
|
39
|
+
# Scheme-less base_urls (e.g. "localhost:3000") parse to a nil host, so guard before matching.
|
|
40
|
+
def trmnl_host? = !!base_uri.host&.end_with?('trmnl.com')
|
|
41
|
+
|
|
35
42
|
def api_uri = URI.join(base_uri, '/api')
|
|
36
43
|
|
|
37
44
|
def account_uri = URI.join(base_uri, '/account')
|
data/lib/trmnlp/version.rb
CHANGED