tensaku 0.3.0 → 0.3.2
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 +15 -0
- data/README.md +4 -0
- data/lib/tensaku/endpoints.rb +1 -1
- data/lib/tensaku/guard.rb +12 -3
- data/lib/tensaku/notes/target.rb +2 -2
- data/lib/tensaku/railtie.rb +4 -1
- data/lib/tensaku/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: 92fbd2ab82b537296cc2edb2cbc618159a7dea15d583bf78393302d0d6c27e01
|
|
4
|
+
data.tar.gz: 3074f2f9c8f83a8a36a0bc6d74e5ec5c545426266c7d48a477d66794b549ea5b
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: abd981956fb9faecaa18b43e49bdb69cb32c5a16b4ab8d10dceb8c4a5ca6e18d4ef672b63f29e9360eb630765d8cebc1024fa148a8f5de2de64135e2c115addd
|
|
7
|
+
data.tar.gz: 33aabacb80683ae4ad743883017353402189f4390204e14047316a12880c40ea3f8e044d20e3d3c3be59189840c0be62764b1132ef218fd91a4bbd188c6df082
|
data/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,20 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 0.3.2 (2026-11-15)
|
|
4
|
+
|
|
5
|
+
- A note on translated text is saved again. It failed with `NoMethodError: undefined method '[]'`
|
|
6
|
+
for `Tensaku::Source::Locale::Entry`.
|
|
7
|
+
|
|
8
|
+
## 0.3.1 (2026-11-15)
|
|
9
|
+
|
|
10
|
+
- Tensaku works on a phone or another device paired with [Parcela](https://parcela.run) and reached
|
|
11
|
+
through Parcela's proxy. Parcela's proxy is the one proxy Tensaku trusts to forward another client:
|
|
12
|
+
a request from loopback whose `Parcela-Device-Secret` header equals the `PARCELA_PROXY_SECRET`
|
|
13
|
+
Parcela gives the server gets the overlay and the endpoints. The Host and Origin checks and the boot
|
|
14
|
+
token still apply. Any other request forwarded from another machine is still refused.
|
|
15
|
+
- An app that doesn't load Active Model boots in development again. Since 0.2.3 it failed with
|
|
16
|
+
`uninitialized constant ActiveModel`.
|
|
17
|
+
|
|
3
18
|
## 0.3.0 (2026-11-15)
|
|
4
19
|
|
|
5
20
|
### Notes
|
data/README.md
CHANGED
|
@@ -54,6 +54,10 @@ Ask your agent to do your Tensaku notes, and it works through the open ones. Ask
|
|
|
54
54
|
|
|
55
55
|
The agent marks a note `working`, asks a question back, declines it, or resolves it with a reply. Each change shows on the note's pin. A green pin means the change is ready for you to check.
|
|
56
56
|
|
|
57
|
+
## Use it from a phone
|
|
58
|
+
|
|
59
|
+
Tensaku answers only requests from your computer, with one exception: a device paired with [Parcela](https://parcela.run) and reached through Parcela's proxy. Parcela gives the server a secret in `PARCELA_PROXY_SECRET`, removes any `Parcela-Device-Secret` header a client sends, and sets it to that secret only on a paired device's request. Tensaku trusts a request from loopback that carries the matching secret. The page's Host must still be a local name or one in `config.hosts`, and anything that reads source or writes still needs the boot token Tensaku puts in the page. No other proxy is trusted.
|
|
60
|
+
|
|
57
61
|
## Documentation
|
|
58
62
|
|
|
59
63
|
The documentation site is [tensaku.lostcoords.com](https://tensaku.lostcoords.com). Its pages are Markdown files in `docs/app/views/pages/`.
|
data/lib/tensaku/endpoints.rb
CHANGED
|
@@ -202,7 +202,7 @@ module Tensaku
|
|
|
202
202
|
end
|
|
203
203
|
|
|
204
204
|
def script(request)
|
|
205
|
-
raise Forbidden, "Tensaku only answers requests from this machine" unless Guard.
|
|
205
|
+
raise Forbidden, "Tensaku only answers requests from this machine or a device paired with Parcela" unless Guard.local_client?(request)
|
|
206
206
|
|
|
207
207
|
[ 200, { "content-type" => "text/javascript; charset=utf-8", "cache-control" => "no-cache" }, [ File.read(ASSET) ] ]
|
|
208
208
|
end
|
data/lib/tensaku/guard.rb
CHANGED
|
@@ -7,14 +7,23 @@ module Tensaku
|
|
|
7
7
|
# "From this machine" means a loopback peer address, no proxy header naming another client, a Host
|
|
8
8
|
# that is a local name (or one the app lists in config.hosts), and no Origin from another site. The
|
|
9
9
|
# Host check stops DNS rebinding: a page on another domain that resolves to 127.0.0.1.
|
|
10
|
+
#
|
|
11
|
+
# One proxy is trusted to forward other clients: Parcela, for devices paired with it. Its proxy
|
|
12
|
+
# connects from loopback, strips client-sent Parcela-Device headers, and on a paired device's request
|
|
13
|
+
# sends Parcela-Device-Secret equal to the PARCELA_PROXY_SECRET it gave this process.
|
|
10
14
|
module Guard
|
|
11
15
|
LOOPBACK = [ IPAddr.new("127.0.0.0/8"), IPAddr.new("::1/128") ].freeze
|
|
12
16
|
FORWARDED = %w[HTTP_X_FORWARDED_FOR HTTP_X_REAL_IP HTTP_FORWARDED HTTP_CLIENT_IP HTTP_TRUE_CLIENT_IP HTTP_CF_CONNECTING_IP].freeze
|
|
13
17
|
|
|
14
18
|
module_function
|
|
15
19
|
|
|
16
|
-
def
|
|
17
|
-
loopback_address?(request.get_header("REMOTE_ADDR")) && !forwarded_from_elsewhere?(request)
|
|
20
|
+
def local_client?(request)
|
|
21
|
+
loopback_address?(request.get_header("REMOTE_ADDR")) && (!forwarded_from_elsewhere?(request) || parcela_device?(request))
|
|
22
|
+
end
|
|
23
|
+
|
|
24
|
+
def parcela_device?(request)
|
|
25
|
+
secret = ENV["PARCELA_PROXY_SECRET"].to_s
|
|
26
|
+
!secret.empty? && secure_compare(request.get_header("HTTP_PARCELA_DEVICE_SECRET").to_s, secret)
|
|
18
27
|
end
|
|
19
28
|
|
|
20
29
|
# Whether the request came from this machine and from a page of this app, not another site.
|
|
@@ -34,7 +43,7 @@ module Tensaku
|
|
|
34
43
|
|
|
35
44
|
# Every endpoint but the script adds the token on top of this.
|
|
36
45
|
def check_local_client!(request)
|
|
37
|
-
raise Forbidden, "Tensaku only answers requests from this machine" unless
|
|
46
|
+
raise Forbidden, "Tensaku only answers requests from this machine or a device paired with Parcela" unless local_client?(request)
|
|
38
47
|
|
|
39
48
|
origin = request.get_header("HTTP_ORIGIN")
|
|
40
49
|
raise Forbidden, "Cross-origin requests are refused" if origin && !local_url?(origin)
|
data/lib/tensaku/notes/target.rb
CHANGED
|
@@ -32,8 +32,8 @@ module Tensaku
|
|
|
32
32
|
target["key"] = raw["key"].to_s
|
|
33
33
|
target["locale"] = raw["locale"].to_s
|
|
34
34
|
if (entry = Source::Locale.find(target["locale"], target["key"]))
|
|
35
|
-
target["file"] = entry
|
|
36
|
-
target["range"] = entry
|
|
35
|
+
target["file"] = entry.file
|
|
36
|
+
target["range"] = entry.line.to_s
|
|
37
37
|
end
|
|
38
38
|
end
|
|
39
39
|
|
data/lib/tensaku/railtie.rb
CHANGED
|
@@ -45,7 +45,10 @@ module Tensaku
|
|
|
45
45
|
|
|
46
46
|
config.after_initialize do
|
|
47
47
|
I18n.backend.extend(Tensaku::I18nMarkers::Backend) unless I18n.backend.is_a?(Tensaku::I18nMarkers::Backend)
|
|
48
|
-
|
|
48
|
+
# An app without Active Model, such as one that loads only Action Controller, has no model strings.
|
|
49
|
+
if defined?(ActiveModel::Type::String)
|
|
50
|
+
[ ActiveModel::Type::ImmutableString, ActiveModel::Type::String ].each { it.prepend(Tensaku::I18nMarkers::ModelStrings) }
|
|
51
|
+
end
|
|
49
52
|
|
|
50
53
|
if (warning = Tensaku::Caches.fragment_cache_warning)
|
|
51
54
|
Rails.logger.warn("[Tensaku] #{warning}")
|
data/lib/tensaku/version.rb
CHANGED