trmnl_preview 0.15.0 → 0.16.0

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.
Files changed (68) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +16 -0
  3. data/README.md +11 -0
  4. data/db/data/and_x_more.yml +86 -0
  5. data/db/data/locales/cs.yml +339 -0
  6. data/db/data/locales/da.yml +339 -0
  7. data/db/data/locales/de-AT.yml +341 -0
  8. data/db/data/locales/de.yml +341 -0
  9. data/db/data/locales/en-AU.yml +79 -0
  10. data/db/data/locales/en-GB.yml +79 -0
  11. data/db/data/locales/en.yml +341 -0
  12. data/db/data/locales/es-ES.yml +341 -0
  13. data/db/data/locales/fr.yml +339 -0
  14. data/db/data/locales/he.yml +339 -0
  15. data/db/data/locales/hu.yml +339 -0
  16. data/db/data/locales/id.yml +339 -0
  17. data/db/data/locales/is.yml +339 -0
  18. data/db/data/locales/it.yml +341 -0
  19. data/db/data/locales/ja.yml +342 -0
  20. data/db/data/locales/ko.yml +337 -0
  21. data/db/data/locales/lt.yml +340 -0
  22. data/db/data/locales/nl.yml +339 -0
  23. data/db/data/locales/no.yml +4 -0
  24. data/db/data/locales/pl.yml +342 -0
  25. data/db/data/locales/pt-BR.yml +340 -0
  26. data/db/data/locales/raw.yml +256 -0
  27. data/db/data/locales/ro.yml +339 -0
  28. data/db/data/locales/ru.yml +342 -0
  29. data/db/data/locales/sk.yml +339 -0
  30. data/db/data/locales/sv.yml +340 -0
  31. data/db/data/locales/uk.yml +339 -0
  32. data/db/data/locales/zh-CN.yml +338 -0
  33. data/db/data/locales/zh-HK.yml +338 -0
  34. data/lib/trmnlp/app.rb +5 -4
  35. data/lib/trmnlp/async_callback.rb +75 -0
  36. data/lib/trmnlp/commands/serve.rb +3 -0
  37. data/lib/trmnlp/config/plugin.rb +52 -12
  38. data/lib/trmnlp/config/project.rb +14 -4
  39. data/lib/trmnlp/context.rb +17 -2
  40. data/lib/trmnlp/firefox_driver.rb +0 -3
  41. data/lib/trmnlp/framework_version.rb +9 -0
  42. data/lib/trmnlp/image_quantizer.rb +28 -15
  43. data/lib/trmnlp/lint/checks/no_custom_filters.rb +27 -0
  44. data/lib/trmnlp/lint/diagnostic.rb +5 -0
  45. data/lib/trmnlp/lint/source.rb +6 -0
  46. data/lib/trmnlp/lint.rb +3 -1
  47. data/lib/trmnlp/merged_plugin_locals.rb +57 -0
  48. data/lib/trmnlp/outbound_request.rb +99 -0
  49. data/lib/trmnlp/paths.rb +11 -6
  50. data/lib/trmnlp/poller.rb +83 -44
  51. data/lib/trmnlp/rails_helpers.rb +41 -0
  52. data/lib/trmnlp/renderer.rb +37 -11
  53. data/lib/trmnlp/screen_generator.rb +14 -2
  54. data/lib/trmnlp/screenshot.rb +29 -4
  55. data/lib/trmnlp/select_field_choices.rb +25 -0
  56. data/lib/trmnlp/transform_pipeline.rb +47 -6
  57. data/lib/trmnlp/transform_state.rb +48 -0
  58. data/lib/trmnlp/user_data_assembler.rb +63 -25
  59. data/lib/trmnlp/version.rb +1 -1
  60. data/lib/trmnlp/watcher.rb +2 -1
  61. data/lib/trmnlp/webhook_payload.rb +74 -0
  62. data/lib/trmnlp/webhook_receiver.rb +78 -0
  63. data/lib/trmnlp.rb +1 -1
  64. data/trmnl_preview.gemspec +1 -0
  65. data/web/public/index.js +18 -6
  66. data/web/views/index.erb +7 -0
  67. data/web/views/render_html.erb +36 -0
  68. metadata +54 -1
@@ -0,0 +1,338 @@
1
+ # Mirrored from trmnl-i18n custom_plugins and rails-i18n date, time, number.
2
+ # Refresh with `rake i18n:sync[trmnl_i18n_path,rails_i18n_path]` — do not edit manually.
3
+ zh-CN:
4
+ custom_plugins:
5
+ today: 今天
6
+ tomorrow: 明天
7
+ updated: 已更新
8
+ activity: 活动
9
+ done: 完成
10
+ due: 到期
11
+ deutsche_bahn_departures:
12
+ departures: 出港
13
+ time: 时间
14
+ line: 线
15
+ destination: 目的地
16
+ platform: 平台
17
+ delay: 延迟
18
+ train: 火车
19
+ on_time: 准时
20
+ cancelled: 取消
21
+ minutes: 分
22
+ refreshed: 已刷新
23
+ simple_calendar:
24
+ title: 日历
25
+ ym_format: "%Y年%-m月"
26
+ chinese_korean:
27
+ leap_format: 闰%{month_label}
28
+ leap_format_short: 闰%{month_label}
29
+ ym_format: ", %{heavenly_stem}%{earthly_branch}%{zodiac_animal}年%{leap_month_label}"
30
+ month_labels:
31
+ -
32
+ - 正月
33
+ - 二月
34
+ - 三月
35
+ - 四月
36
+ - 五月
37
+ - 六月
38
+ - 七月
39
+ - 八月
40
+ - 九月
41
+ - 十月
42
+ - 十一月
43
+ - 腊月
44
+ date_labels:
45
+ -
46
+ - 初一
47
+ - 初二
48
+ - 初三
49
+ - 初四
50
+ - 初五
51
+ - 初六
52
+ - 初七
53
+ - 初八
54
+ - 初九
55
+ - 初十
56
+ - 十一
57
+ - 十二
58
+ - 十三
59
+ - 十四
60
+ - 十五
61
+ - 十六
62
+ - 十七
63
+ - 十八
64
+ - 十九
65
+ - 二十
66
+ - 廿一
67
+ - 廿二
68
+ - 廿三
69
+ - 廿四
70
+ - 廿五
71
+ - 廿六
72
+ - 廿七
73
+ - 廿八
74
+ - 廿九
75
+ - 三十
76
+ heavenly_stems:
77
+ - 甲
78
+ - 乙
79
+ - 丙
80
+ - 丁
81
+ - 戊
82
+ - 己
83
+ - 庚
84
+ - 辛
85
+ - 壬
86
+ - 癸
87
+ earthly_branches:
88
+ - 子
89
+ - 丑
90
+ - 寅
91
+ - 卯
92
+ - 辰
93
+ - 巳
94
+ - 午
95
+ - 未
96
+ - 申
97
+ - 酉
98
+ - 戌
99
+ - 亥
100
+ zodiac_animals:
101
+ - 鼠
102
+ - 牛
103
+ - 虎
104
+ - 兔
105
+ - 龙
106
+ - 蛇
107
+ - 马
108
+ - 羊
109
+ - 猴
110
+ - 鸡
111
+ - 狗
112
+ - 猪
113
+ solar_terms:
114
+ - 小寒
115
+ - 大寒
116
+ - 立春
117
+ - 雨水
118
+ - 惊蛰
119
+ - 春分
120
+ - 清明
121
+ - 谷雨
122
+ - 立夏
123
+ - 小满
124
+ - 芒种
125
+ - 夏至
126
+ - 小暑
127
+ - 大暑
128
+ - 立秋
129
+ - 处暑
130
+ - 白露
131
+ - 秋分
132
+ - 寒露
133
+ - 霜降
134
+ - 立冬
135
+ - 小雪
136
+ - 大雪
137
+ - 冬至
138
+ japanese:
139
+ rokuyo_terms:
140
+ - 先胜
141
+ - 友引
142
+ - 先负
143
+ - 佛灭
144
+ - 大安
145
+ - 赤口
146
+ nengo:
147
+ reiwa: 令和
148
+ ym_format: "%Y年 (%{nengo}%{alt_year}年) %-m月"
149
+ year_1: 元
150
+ hebrew:
151
+ ym_format: ", %{month_label} %{alt_year}"
152
+ month_labels:
153
+ - Nisan
154
+ - Iyar
155
+ - Sivan
156
+ - Tamuz
157
+ - Av
158
+ - Elul
159
+ - Tishri
160
+ - Heshvan
161
+ - Kislev
162
+ - Tevet
163
+ - Shevat
164
+ - Adar
165
+ - Adar I
166
+ - Adar II
167
+ month_labels_abbr:
168
+ - Nis
169
+ - Iya
170
+ - Siv
171
+ - Tam
172
+ - Av
173
+ - Elu
174
+ - Tis
175
+ - Hes
176
+ - Kis
177
+ - Tev
178
+ - Shv
179
+ - Ada
180
+ - Ad1
181
+ - Ad2
182
+ hijri:
183
+ ym_format: ", %{month_label} %{alt_year}"
184
+ month_labels:
185
+ -
186
+ - Muharram
187
+ - Safar
188
+ - Rabiʻ I
189
+ - Rabiʻ II
190
+ - Jumada I
191
+ - Jumada II
192
+ - Rajab
193
+ - Shaʻban
194
+ - Ramadan
195
+ - Shawwal
196
+ - Dhuʻl-Qiʻdah
197
+ - Dhuʻl-Hijjah
198
+ bengali:
199
+ ym_format: ", %{month_label} %{alt_year}"
200
+ month_labels:
201
+ -
202
+ - Boishakh
203
+ - Joishtho
204
+ - Asharh
205
+ - Srabon
206
+ - Bhadro
207
+ - Ashwin
208
+ - Kartika
209
+ - Ogrohayon
210
+ - Poush
211
+ - Magh
212
+ - Falgun
213
+ - Choitro
214
+ indian:
215
+ ym_format: ", %{month_label} %{alt_year}"
216
+ month_labels:
217
+ -
218
+ - Chaitra
219
+ - Vaisakha
220
+ - Jyaistha
221
+ - Asadha
222
+ - Sravana
223
+ - Bhadra
224
+ - Asvina
225
+ - Kartika
226
+ - Agrahayana
227
+ - Pausa
228
+ - Magha
229
+ - Phalguna
230
+ public_recipe_stats:
231
+ connections: "{$value :number} 个连接"
232
+ forks: "{$value :number} 个分支"
233
+ installs: "{$value :number} 个安装"
234
+ and_more: 及其他 {$value :number} 项
235
+ error_keyword_title: "「{$keyword}」未匹配到任何结果。"
236
+ error_keyword_subtitle: 请尝试搜索其他关键词。
237
+ error_new_title: 未找到新配方。
238
+ error_new_subtitle: 这种情况不应该发生。
239
+ error_self_title: 您尚未发布任何配方。
240
+ error_self_subtitle: 了解如何发布您的第一个配方:https://help.trmnl.com/en/articles/9510536-private-plugins
241
+ error_author_id_title: '用户 #{$authorId} 尚未发布任何配方。'
242
+ error_author_id_subtitle: 未找到与此 ID 关联的配方。
243
+ error_recipe_ids_title: 未找到配方 ID。
244
+ error_recipe_ids_subtitle: 添加配方 ID 以开始。
245
+ horizontal_world_clock:
246
+ name: 世界时钟
247
+ language_learning_sentences:
248
+ from_to: "{$from :langName}到{$to :langNameList}"
249
+ custom_next_holiday:
250
+ next_holiday: 下一个节日
251
+ today_and_next: ".input {$nextDays :number} .match $nextDays 1 {{ {#mainLabel}今天是{/mainLabel}{#br/}{#mainValue}{$name}{/mainValue}{#br/}{#subLabel}明天是{$nextName}。{/subLabel}
252
+ }} 2 {{ {#mainLabel}今天是{/mainLabel}{#br/}{#mainValue}{$name}{/mainValue}{#br/}{#subLabel}后天是{$nextName}。{/subLabel}
253
+ }} * {{ {#mainLabel}今天是{/mainLabel}{#br/}{#mainValue}{$name}{/mainValue}{#br/}{#subLabel}距离下一个节日{$nextName}还有
254
+ {$nextDays} 天。{/subLabel} }}"
255
+ today_only: "{#mainLabel}今天是{/mainLabel}{#br/}{#mainValue}{$name}{/mainValue}"
256
+ next_only: ".input {$nextDays :number} .match $nextDays 1 {{ {#mainLabel}明天是{/mainLabel}{#br/}{#mainValue}{$nextName}{/mainValue}
257
+ }} 2 {{ {#mainLabel}后天是{/mainLabel}{#br/}{#mainValue}{$nextName}{/mainValue}
258
+ }} * {{ {#mainLabel}距离{/mainLabel}{#br/}{#mainValue}{$nextName}{/mainValue}{#br/}{#mainLabel}还有
259
+ {/mainLabel}{#mainValue}{$nextDays}{/mainValue}{#mainLabel} 天{/mainLabel}
260
+ }}"
261
+ no_holidays: "{#subLabel}已添加的节日已全部结束。{/subLabel}"
262
+ sun_chart: Sun Chart
263
+ date:
264
+ abbr_day_names:
265
+ - 周日
266
+ - 周一
267
+ - 周二
268
+ - 周三
269
+ - 周四
270
+ - 周五
271
+ - 周六
272
+ abbr_month_names:
273
+ -
274
+ - 1月
275
+ - 2月
276
+ - 3月
277
+ - 4月
278
+ - 5月
279
+ - 6月
280
+ - 7月
281
+ - 8月
282
+ - 9月
283
+ - 10月
284
+ - 11月
285
+ - 12月
286
+ day_names:
287
+ - 星期日
288
+ - 星期一
289
+ - 星期二
290
+ - 星期三
291
+ - 星期四
292
+ - 星期五
293
+ - 星期六
294
+ formats:
295
+ default: "%Y-%m-%d"
296
+ long: "%Y年%m月%d日"
297
+ short: "%m月%d日"
298
+ month_names:
299
+ -
300
+ - 一月
301
+ - 二月
302
+ - 三月
303
+ - 四月
304
+ - 五月
305
+ - 六月
306
+ - 七月
307
+ - 八月
308
+ - 九月
309
+ - 十月
310
+ - 十一月
311
+ - 十二月
312
+ order:
313
+ - :year
314
+ - :month
315
+ - :day
316
+ time:
317
+ am: 上午
318
+ formats:
319
+ default: "%Y年%m月%d日 %A %H:%M:%S %Z"
320
+ long: "%Y年%m月%d日 %H:%M"
321
+ short: "%m月%d日 %H:%M"
322
+ pm: 下午
323
+ number:
324
+ currency:
325
+ format:
326
+ delimiter: ","
327
+ format: "%u %n"
328
+ precision: 2
329
+ separator: "."
330
+ significant: false
331
+ strip_insignificant_zeros: false
332
+ unit: CN¥
333
+ format:
334
+ delimiter: ","
335
+ precision: 3
336
+ separator: "."
337
+ significant: false
338
+ strip_insignificant_zeros: false
@@ -0,0 +1,338 @@
1
+ # Mirrored from trmnl-i18n custom_plugins and rails-i18n date, time, number.
2
+ # Refresh with `rake i18n:sync[trmnl_i18n_path,rails_i18n_path]` — do not edit manually.
3
+ zh-HK:
4
+ custom_plugins:
5
+ today: 今日
6
+ tomorrow: 明日
7
+ updated: 更新
8
+ activity: 活動
9
+ done: 完成
10
+ due: 限期
11
+ deutsche_bahn_departures:
12
+ departures: 出發
13
+ time: 時間
14
+ line: 路綫
15
+ destination: 目的地
16
+ platform: 月台
17
+ delay: 延遲
18
+ train: 列車
19
+ on_time: 準時
20
+ cancelled: 已取消
21
+ minutes: 分
22
+ refreshed: 更新時間
23
+ simple_calendar:
24
+ title: 日曆
25
+ ym_format: "%Y年%-m月"
26
+ chinese_korean:
27
+ leap_format: 閏%{month_label}
28
+ leap_format_short: 閏%{month_label}
29
+ ym_format: ", %{heavenly_stem}%{earthly_branch}%{zodiac_animal}年%{leap_month_label}"
30
+ month_labels:
31
+ -
32
+ - 正月
33
+ - 二月
34
+ - 三月
35
+ - 四月
36
+ - 五月
37
+ - 六月
38
+ - 七月
39
+ - 八月
40
+ - 九月
41
+ - 十月
42
+ - 十一月
43
+ - 十二月
44
+ date_labels:
45
+ -
46
+ - 初一
47
+ - 初二
48
+ - 初三
49
+ - 初四
50
+ - 初五
51
+ - 初六
52
+ - 初七
53
+ - 初八
54
+ - 初九
55
+ - 初十
56
+ - 十一
57
+ - 十二
58
+ - 十三
59
+ - 十四
60
+ - 十五
61
+ - 十六
62
+ - 十七
63
+ - 十八
64
+ - 十九
65
+ - 二十
66
+ - 廿一
67
+ - 廿二
68
+ - 廿三
69
+ - 廿四
70
+ - 廿五
71
+ - 廿六
72
+ - 廿七
73
+ - 廿八
74
+ - 廿九
75
+ - 三十
76
+ heavenly_stems:
77
+ - 甲
78
+ - 乙
79
+ - 丙
80
+ - 丁
81
+ - 戊
82
+ - 己
83
+ - 庚
84
+ - 辛
85
+ - 壬
86
+ - 癸
87
+ earthly_branches:
88
+ - 子
89
+ - 丑
90
+ - 寅
91
+ - 卯
92
+ - 辰
93
+ - 巳
94
+ - 午
95
+ - 未
96
+ - 申
97
+ - 酉
98
+ - 戌
99
+ - 亥
100
+ zodiac_animals:
101
+ - 鼠
102
+ - 牛
103
+ - 虎
104
+ - 兔
105
+ - 龍
106
+ - 蛇
107
+ - 馬
108
+ - 羊
109
+ - 猴
110
+ - 雞
111
+ - 狗
112
+ - 豬
113
+ solar_terms:
114
+ - 小寒
115
+ - 大寒
116
+ - 立春
117
+ - 雨水
118
+ - 驚蟄
119
+ - 春分
120
+ - 清明
121
+ - 穀雨
122
+ - 立夏
123
+ - 小滿
124
+ - 芒種
125
+ - 夏至
126
+ - 小暑
127
+ - 大暑
128
+ - 立秋
129
+ - 處暑
130
+ - 白露
131
+ - 秋分
132
+ - 寒露
133
+ - 霜降
134
+ - 立冬
135
+ - 小雪
136
+ - 大雪
137
+ - 冬至
138
+ japanese:
139
+ rokuyo_terms:
140
+ - 先勝
141
+ - 友引
142
+ - 先負
143
+ - 佛滅
144
+ - 大安
145
+ - 赤口
146
+ nengo:
147
+ reiwa: 令和
148
+ ym_format: "%Y年 (%{nengo}%{alt_year}年) %-m月"
149
+ year_1: 元
150
+ hebrew:
151
+ ym_format: ", %{month_label} %{alt_year}"
152
+ month_labels:
153
+ - Nisan
154
+ - Iyar
155
+ - Sivan
156
+ - Tamuz
157
+ - Av
158
+ - Elul
159
+ - Tishri
160
+ - Heshvan
161
+ - Kislev
162
+ - Tevet
163
+ - Shevat
164
+ - Adar
165
+ - Adar I
166
+ - Adar II
167
+ month_labels_abbr:
168
+ - Nis
169
+ - Iya
170
+ - Siv
171
+ - Tam
172
+ - Av
173
+ - Elu
174
+ - Tis
175
+ - Hes
176
+ - Kis
177
+ - Tev
178
+ - Shv
179
+ - Ada
180
+ - Ad1
181
+ - Ad2
182
+ hijri:
183
+ ym_format: ", %{month_label} %{alt_year}"
184
+ month_labels:
185
+ -
186
+ - Muharram
187
+ - Safar
188
+ - Rabiʻ I
189
+ - Rabiʻ II
190
+ - Jumada I
191
+ - Jumada II
192
+ - Rajab
193
+ - Shaʻban
194
+ - Ramadan
195
+ - Shawwal
196
+ - Dhuʻl-Qiʻdah
197
+ - Dhuʻl-Hijjah
198
+ bengali:
199
+ ym_format: ", %{month_label} %{alt_year}"
200
+ month_labels:
201
+ -
202
+ - Boishakh
203
+ - Joishtho
204
+ - Asharh
205
+ - Srabon
206
+ - Bhadro
207
+ - Ashwin
208
+ - Kartika
209
+ - Ogrohayon
210
+ - Poush
211
+ - Magh
212
+ - Falgun
213
+ - Choitro
214
+ indian:
215
+ ym_format: ", %{month_label} %{alt_year}"
216
+ month_labels:
217
+ -
218
+ - Chaitra
219
+ - Vaisakha
220
+ - Jyaistha
221
+ - Asadha
222
+ - Sravana
223
+ - Bhadra
224
+ - Asvina
225
+ - Kartika
226
+ - Agrahayana
227
+ - Pausa
228
+ - Magha
229
+ - Phalguna
230
+ public_recipe_stats:
231
+ connections: "{$value :number} 個連接"
232
+ forks: "{$value :number} 個分叉"
233
+ installs: ".input {$value :number} .match $value zero {{No install}} one {{{$value
234
+ :number} install}} * {{{$value :number} installs}}"
235
+ and_more: 還有 {$value :number} 個
236
+ error_keyword_title: "“{$keyword}” did not match any result."
237
+ error_keyword_subtitle: Try searching for something else.
238
+ error_new_title: No new recipe is found.
239
+ error_new_subtitle: This shouldn’t happen.
240
+ error_self_title: You did not publish any recipe.
241
+ error_self_subtitle: Learn how to publish your first one at https://help.trmnl.com/en/articles/9510536-private-plugins
242
+ error_author_id_title: 'User #{$authorId} did not publish any recipe.'
243
+ error_author_id_subtitle: No recipe is found associated with this ID.
244
+ error_recipe_ids_title: No recipe ID is found.
245
+ error_recipe_ids_subtitle: Add a recipe ID to get started.
246
+ horizontal_world_clock:
247
+ name: World clock
248
+ language_learning_sentences:
249
+ from_to: "{$from :langName} to {$to :langNameList}"
250
+ custom_next_holiday:
251
+ next_holiday: 下一個假期
252
+ today_and_next: ".input {$nextDays :number} .match $nextDays 1 {{ {#mainLabel}今日是{/mainLabel}{#br/}{#mainValue}{$name}{/mainValue}{#br/}{#subLabel}明日是{$nextName}。{/subLabel}
253
+ }} 2 {{ {#mainLabel}今日是{/mainLabel}{#br/}{#mainValue}{$name}{/mainValue}{#br/}{#subLabel}後日是{$nextName}。{/subLabel}
254
+ }} * {{ {#mainLabel}今日是{/mainLabel}{#br/}{#mainValue}{$name}{/mainValue}{#br/}{#subLabel}距離下一個假期{$nextName}還有
255
+ {$nextDays} 日。{/subLabel} }}"
256
+ today_only: "{#mainLabel}今日是{/mainLabel}{#br/}{#mainValue}{$name}{/mainValue}"
257
+ next_only: ".input {$nextDays :number} .match $nextDays 1 {{ {#mainLabel}明日是{/mainLabel}{#br/}{#mainValue}{$nextName}{/mainValue}
258
+ }} 2 {{ {#mainLabel}後日是{/mainLabel}{#br/}{#mainValue}{$nextName}{/mainValue}
259
+ }} * {{ {#mainValue}{$nextName}{/mainValue}{#br/}{#mainLabel}還有 {/mainLabel}{#mainValue}{$nextDays}{/mainValue}{#mainLabel}
260
+ 日{/mainLabel} }}"
261
+ no_holidays: "{#subLabel}已添加的假期已全部結束。{/subLabel}"
262
+ sun_chart: Sun Chart
263
+ date:
264
+ abbr_day_names:
265
+ - 週日
266
+ - 週一
267
+ - 週二
268
+ - 週三
269
+ - 週四
270
+ - 週五
271
+ - 週六
272
+ abbr_month_names:
273
+ -
274
+ - 1月
275
+ - 2月
276
+ - 3月
277
+ - 4月
278
+ - 5月
279
+ - 6月
280
+ - 7月
281
+ - 8月
282
+ - 9月
283
+ - 10月
284
+ - 11月
285
+ - 12月
286
+ day_names:
287
+ - 星期日
288
+ - 星期一
289
+ - 星期二
290
+ - 星期三
291
+ - 星期四
292
+ - 星期五
293
+ - 星期六
294
+ formats:
295
+ default: "%Y-%m-%d"
296
+ long: "%Y年%m月%d日"
297
+ short: "%m月%d日"
298
+ month_names:
299
+ -
300
+ - 一月
301
+ - 二月
302
+ - 三月
303
+ - 四月
304
+ - 五月
305
+ - 六月
306
+ - 七月
307
+ - 八月
308
+ - 九月
309
+ - 十月
310
+ - 十一月
311
+ - 十二月
312
+ order:
313
+ - :year
314
+ - :month
315
+ - :day
316
+ time:
317
+ am: 上午
318
+ formats:
319
+ default: "%Y年%m月%d日 %A %H:%M:%S %Z"
320
+ long: "%Y年%m月%d日 %H:%M"
321
+ short: "%m月%d日 %H:%M"
322
+ pm: 下午
323
+ number:
324
+ currency:
325
+ format:
326
+ delimiter: ","
327
+ format: "%u %n"
328
+ precision: 2
329
+ separator: "."
330
+ significant: false
331
+ strip_insignificant_zeros: false
332
+ unit: HK$
333
+ format:
334
+ delimiter: ","
335
+ precision: 3
336
+ separator: "."
337
+ significant: false
338
+ strip_insignificant_zeros: false
data/lib/trmnlp/app.rb CHANGED
@@ -73,10 +73,9 @@ module TRMNLP
73
73
  end
74
74
  end
75
75
 
76
- post '/webhook' do
77
- @poller.put_webhook(request.body.read)
78
- 'OK'
79
- end
76
+ post('/webhook') { halt_with_json(*@context.webhook_receiver.call(request.body.read, params.to_h)) }
77
+
78
+ post('/callback') { halt_with_json(*@context.async_callback.call(request.body.read, params['v'])) }
80
79
 
81
80
  get '/' do
82
81
  redirect '/full'
@@ -231,6 +230,8 @@ module TRMNLP
231
230
 
232
231
  private
233
232
 
233
+ def halt_with_json(status_code, body) = halt(status_code, { 'content-type' => 'application/json' }, body.to_json)
234
+
234
235
  # Validates the incoming custom-fields payload, raising InvalidCustomFields
235
236
  # (reported to the user as a 400) on bad input. JSON.parse only yields
236
237
  # strings, numbers, booleans, nil, arrays, and hashes — all of which