tdiary 4.0.4 → 4.0.5
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/.travis.yml +2 -3
- data/ChangeLog +15 -0
- data/Gemfile +2 -2
- data/Gemfile.lock +53 -41
- data/doc/HOWTO-make-io.md +12 -85
- data/doc/INSTALL-paas.md +3 -3
- data/doc/INSTALL.md +6 -6
- data/misc/lib/fcgi_patch.rb +0 -1
- data/misc/migrate.rb +1 -1
- data/misc/paas/heroku/Gemfile +1 -0
- data/misc/plugin/amazon.rb +1 -1
- data/misc/plugin/calendar2.rb +0 -2
- data/misc/plugin/calendar3.rb +0 -1
- data/misc/plugin/category.rb +0 -6
- data/misc/plugin/counter.rb +1 -1
- data/misc/plugin/daily_theme.rb +1 -1
- data/misc/plugin/disp_referrer.rb +1 -1
- data/misc/plugin/edit_today.rb +1 -1
- data/misc/plugin/en/edit_today.rb +1 -1
- data/misc/plugin/en/hide-mail-field.rb +1 -1
- data/misc/plugin/en/weather.rb +3 -1
- data/misc/plugin/image.rb +3 -8
- data/misc/plugin/ja/edit_today.rb +1 -1
- data/misc/plugin/ja/hide-mail-field.rb +1 -1
- data/misc/plugin/ja/weather.rb +3 -0
- data/misc/plugin/list.rb +1 -1
- data/misc/plugin/makerss.rb +2 -3
- data/misc/plugin/my-ex.rb +1 -1
- data/misc/plugin/ping.rb +2 -2
- data/misc/plugin/recent_comment3.rb +1 -1
- data/misc/plugin/search-default.rb +1 -2
- data/misc/plugin/tlink.rb +1 -1
- data/misc/plugin/xmlrpc/xmlrpc.rb +13 -20
- data/package.json +4 -4
- data/plugin/00default.rb +1 -1
- data/plugin/05referer.rb +0 -1
- data/plugin/10spamfilter.rb +0 -12
- data/plugin/50sp.rb +1 -1
- data/plugin/60sf.rb +2 -2
- data/plugin/en/00default.rb +3 -4
- data/plugin/en/05referer.rb +0 -3
- data/plugin/ja/00default.rb +3 -5
- data/spec/plugin/bq_spec.rb +1 -1
- data/tdiary/base.rb +1 -1
- data/tdiary/compatible.rb +1 -1
- data/tdiary/core_ext.rb +1 -1
- data/tdiary/plugin.rb +1 -1
- data/tdiary/referer_manager.rb +1 -1
- data/tdiary/style/tdiary.rb +0 -1
- data/tdiary/style/wiki.rb +2 -1
- data/tdiary/version.rb +1 -1
- data/test/weather_test.rb +30 -0
- metadata +2 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA1:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 4642bf9547d4b0d837b9ad8ec9c5b8f4eba7ee90
|
|
4
|
+
data.tar.gz: 74b9c0a6377299a3d536248a063c356106032e7e
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: c47b2df47b11083280eeb6e7d1e87962052fcf0666308f1297bef22d9645a79cfcbceec02bb84ae0a8471bab989c99a4704fd2d68c26d1b474b86038836f741f
|
|
7
|
+
data.tar.gz: 7ce323d5452bc607759d6f986426946637fd7cff6ad59645cd69265ea52f1fb6d926b74c4a79ce9e16b2a069cac464bba8d142fa9e60f8d83626ef9361337418
|
data/.travis.yml
CHANGED
|
@@ -11,7 +11,7 @@ rvm:
|
|
|
11
11
|
cache: bundler
|
|
12
12
|
|
|
13
13
|
# ignored --deployment option
|
|
14
|
-
bundler_args: ""
|
|
14
|
+
bundler_args: "--without server"
|
|
15
15
|
|
|
16
16
|
before_install:
|
|
17
17
|
- "export DISPLAY=:99.0"
|
|
@@ -36,7 +36,6 @@ notifications:
|
|
|
36
36
|
|
|
37
37
|
matrix:
|
|
38
38
|
allow_failures:
|
|
39
|
-
# eventmachine cann't build with rb_thread_blocking_region
|
|
40
|
-
- rvm: ruby-head
|
|
41
39
|
# webrick mode is unstable results...
|
|
42
40
|
- env: TEST_MODE=webrick
|
|
41
|
+
- rvm: ruby-head
|
data/ChangeLog
CHANGED
|
@@ -1,3 +1,18 @@
|
|
|
1
|
+
2014-08-29 TADA Tadashi <t@tdtds.jp>
|
|
2
|
+
* release 4.0.5
|
|
3
|
+
|
|
4
|
+
2014-08-27 zunda <zunda at freeshell.org>
|
|
5
|
+
* plugin/weather.rb: Change Japanese translation for few clouds
|
|
6
|
+
|
|
7
|
+
2014-08-12 zunda <zunda at freeshell.org>
|
|
8
|
+
* plugin/weather.rb: Change Japanese translation for few clouds
|
|
9
|
+
|
|
10
|
+
2014-07-25 zunda <zunda at freeshell.org>
|
|
11
|
+
* plugin/weather.rb: Add a Japanese translation to Scattered Clouds
|
|
12
|
+
|
|
13
|
+
2014-06-14 zunda <zunda at freeshell.org>
|
|
14
|
+
* plugin/weather.rb: Add a translation for `few clouds'
|
|
15
|
+
|
|
1
16
|
2014-05-29 TADA Tadashi <t@tdtds.jp>
|
|
2
17
|
* release 4.0.4
|
|
3
18
|
|
data/Gemfile
CHANGED
data/Gemfile.lock
CHANGED
|
@@ -2,7 +2,10 @@ GEM
|
|
|
2
2
|
remote: https://rubygems.org/
|
|
3
3
|
specs:
|
|
4
4
|
addressable (2.3.6)
|
|
5
|
-
|
|
5
|
+
byebug (2.7.0)
|
|
6
|
+
columnize (~> 0.3)
|
|
7
|
+
debugger-linecache (~> 1.2)
|
|
8
|
+
capybara (2.4.1)
|
|
6
9
|
mime-types (>= 1.16)
|
|
7
10
|
nokogiri (>= 1.3.3)
|
|
8
11
|
rack (>= 1.0.0)
|
|
@@ -11,56 +14,63 @@ GEM
|
|
|
11
14
|
childprocess (0.5.3)
|
|
12
15
|
ffi (~> 1.0, >= 1.0.11)
|
|
13
16
|
coderay (1.1.0)
|
|
14
|
-
coffee-script (2.
|
|
17
|
+
coffee-script (2.3.0)
|
|
15
18
|
coffee-script-source
|
|
16
19
|
execjs
|
|
17
|
-
coffee-script-source (1.7.
|
|
18
|
-
|
|
20
|
+
coffee-script-source (1.7.1)
|
|
21
|
+
columnize (0.8.9)
|
|
22
|
+
coveralls (0.7.1)
|
|
19
23
|
multi_json (~> 1.3)
|
|
20
24
|
rest-client
|
|
21
25
|
simplecov (>= 0.7)
|
|
22
26
|
term-ansicolor
|
|
23
27
|
thor
|
|
24
28
|
daemons (1.1.9)
|
|
29
|
+
debugger-linecache (1.2.0)
|
|
25
30
|
diff-lcs (1.2.5)
|
|
26
|
-
docile (1.1.
|
|
31
|
+
docile (1.1.5)
|
|
27
32
|
eventmachine (1.0.3)
|
|
28
|
-
execjs (2.
|
|
33
|
+
execjs (2.2.1)
|
|
29
34
|
faraday (0.9.0)
|
|
30
35
|
multipart-post (>= 1.2, < 3)
|
|
31
|
-
fastimage (1.6.
|
|
36
|
+
fastimage (1.6.3)
|
|
32
37
|
addressable (~> 2.3, >= 2.3.5)
|
|
33
38
|
ffi (1.9.3)
|
|
34
39
|
hike (1.2.3)
|
|
35
40
|
hikidoc (0.1.0)
|
|
36
|
-
hub (1.12.
|
|
37
|
-
jasmine (2.0.
|
|
41
|
+
hub (1.12.2)
|
|
42
|
+
jasmine (2.0.2)
|
|
38
43
|
jasmine-core (~> 2.0.0)
|
|
39
44
|
phantomjs
|
|
40
45
|
rack (>= 1.2.1)
|
|
41
46
|
rake
|
|
42
|
-
jasmine-core (2.0.
|
|
47
|
+
jasmine-core (2.0.1)
|
|
43
48
|
launchy (2.4.2)
|
|
44
49
|
addressable (~> 2.3)
|
|
45
50
|
libv8 (3.16.14.3)
|
|
46
51
|
method_source (0.8.2)
|
|
47
|
-
mime-types (2.
|
|
52
|
+
mime-types (2.3)
|
|
48
53
|
mini_portile (0.6.0)
|
|
49
|
-
multi_json (1.10.
|
|
54
|
+
multi_json (1.10.1)
|
|
50
55
|
multipart-post (2.0.0)
|
|
51
|
-
|
|
56
|
+
netrc (0.7.7)
|
|
57
|
+
nokogiri (1.6.3.1)
|
|
52
58
|
mini_portile (= 0.6.0)
|
|
53
|
-
octokit (3.1
|
|
59
|
+
octokit (3.3.1)
|
|
54
60
|
sawyer (~> 0.5.3)
|
|
55
61
|
octorelease (0.0.6)
|
|
56
62
|
hub
|
|
57
63
|
octokit
|
|
58
|
-
phantomjs (1.9.7.
|
|
64
|
+
phantomjs (1.9.7.1)
|
|
59
65
|
pit (0.0.7)
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
66
|
+
power_assert (0.1.3)
|
|
67
|
+
pry (0.10.1)
|
|
68
|
+
coderay (~> 1.1.0)
|
|
69
|
+
method_source (~> 0.8.1)
|
|
63
70
|
slop (~> 3.4)
|
|
71
|
+
pry-byebug (1.3.3)
|
|
72
|
+
byebug (~> 2.7)
|
|
73
|
+
pry (~> 0.10)
|
|
64
74
|
rack (1.5.2)
|
|
65
75
|
rack-test (0.6.2)
|
|
66
76
|
rack (>= 1.0)
|
|
@@ -70,36 +80,37 @@ GEM
|
|
|
70
80
|
rake (10.3.2)
|
|
71
81
|
redcarpet (3.1.2)
|
|
72
82
|
ref (1.0.5)
|
|
73
|
-
rest-client (1.
|
|
74
|
-
mime-types (>= 1.16)
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
rspec-
|
|
78
|
-
rspec-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
83
|
+
rest-client (1.7.2)
|
|
84
|
+
mime-types (>= 1.16, < 3.0)
|
|
85
|
+
netrc (~> 0.7)
|
|
86
|
+
rspec (3.0.0)
|
|
87
|
+
rspec-core (~> 3.0.0)
|
|
88
|
+
rspec-expectations (~> 3.0.0)
|
|
89
|
+
rspec-mocks (~> 3.0.0)
|
|
90
|
+
rspec-core (3.0.4)
|
|
91
|
+
rspec-support (~> 3.0.0)
|
|
92
|
+
rspec-expectations (3.0.4)
|
|
82
93
|
diff-lcs (>= 1.2.0, < 2.0)
|
|
83
|
-
rspec-support (
|
|
84
|
-
rspec-mocks (3.0.
|
|
85
|
-
rspec-support (
|
|
86
|
-
rspec-support (3.0.
|
|
87
|
-
rubyzip (1.1.
|
|
88
|
-
sawyer (0.5.
|
|
94
|
+
rspec-support (~> 3.0.0)
|
|
95
|
+
rspec-mocks (3.0.4)
|
|
96
|
+
rspec-support (~> 3.0.0)
|
|
97
|
+
rspec-support (3.0.4)
|
|
98
|
+
rubyzip (1.1.6)
|
|
99
|
+
sawyer (0.5.5)
|
|
89
100
|
addressable (~> 2.3.5)
|
|
90
101
|
faraday (~> 0.8, < 0.10)
|
|
91
|
-
selenium-webdriver (2.
|
|
102
|
+
selenium-webdriver (2.42.0)
|
|
92
103
|
childprocess (>= 0.5.0)
|
|
93
104
|
multi_json (~> 1.0)
|
|
94
105
|
rubyzip (~> 1.0)
|
|
95
106
|
websocket (~> 1.0.4)
|
|
96
|
-
sequel (4.
|
|
97
|
-
simplecov (0.
|
|
107
|
+
sequel (4.13.0)
|
|
108
|
+
simplecov (0.9.0)
|
|
98
109
|
docile (~> 1.1.0)
|
|
99
110
|
multi_json
|
|
100
111
|
simplecov-html (~> 0.8.0)
|
|
101
112
|
simplecov-html (0.8.0)
|
|
102
|
-
slop (3.
|
|
113
|
+
slop (3.6.0)
|
|
103
114
|
sprockets (2.12.1)
|
|
104
115
|
hike (~> 1.2)
|
|
105
116
|
multi_json (~> 1.0)
|
|
@@ -108,7 +119,8 @@ GEM
|
|
|
108
119
|
sqlite3 (1.3.9)
|
|
109
120
|
term-ansicolor (1.3.0)
|
|
110
121
|
tins (~> 1.0)
|
|
111
|
-
test-unit (
|
|
122
|
+
test-unit (3.0.1)
|
|
123
|
+
power_assert
|
|
112
124
|
therubyracer (0.12.1)
|
|
113
125
|
libv8 (~> 3.16.14.0)
|
|
114
126
|
ref
|
|
@@ -118,7 +130,7 @@ GEM
|
|
|
118
130
|
rack (>= 1.0.0)
|
|
119
131
|
thor (0.19.1)
|
|
120
132
|
tilt (1.4.1)
|
|
121
|
-
tins (1.3.
|
|
133
|
+
tins (1.3.1)
|
|
122
134
|
websocket (1.0.7)
|
|
123
135
|
xpath (2.0.0)
|
|
124
136
|
nokogiri (~> 1.3)
|
|
@@ -136,12 +148,12 @@ DEPENDENCIES
|
|
|
136
148
|
launchy
|
|
137
149
|
octorelease
|
|
138
150
|
pit
|
|
139
|
-
pry
|
|
151
|
+
pry-byebug
|
|
140
152
|
rack
|
|
141
153
|
racksh
|
|
142
154
|
rake
|
|
143
155
|
redcarpet
|
|
144
|
-
rspec
|
|
156
|
+
rspec
|
|
145
157
|
selenium-webdriver
|
|
146
158
|
sequel
|
|
147
159
|
simplecov
|
data/doc/HOWTO-make-io.md
CHANGED
|
@@ -13,21 +13,24 @@ IOクラス
|
|
|
13
13
|
|
|
14
14
|
### IOBaseクラス
|
|
15
15
|
|
|
16
|
-
tdiary.rbにはTDiary::IOBaseというクラスが定義されており、これを継承 して独自のIOクラスを作成します。下記の例は、
|
|
16
|
+
tdiary.rbにはTDiary::IOBaseというクラスが定義されており、これを継承 して独自のIOクラスを作成します。下記の例は、Tdiary::IO::Hogeを定義しています。
|
|
17
17
|
|
|
18
18
|
```
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
19
|
+
module TDiary
|
|
20
|
+
module IO
|
|
21
|
+
class Hoge < Base
|
|
22
|
+
def calendar
|
|
23
|
+
.....
|
|
24
|
+
end
|
|
25
|
+
.....
|
|
26
|
+
end
|
|
22
27
|
end
|
|
23
|
-
|
|
24
|
-
.....
|
|
25
28
|
end
|
|
26
29
|
```
|
|
27
30
|
|
|
28
31
|
### 最低限実装すべきもの
|
|
29
32
|
|
|
30
|
-
|
|
33
|
+
TDiary::IO::BaseクラスにはIOクラスに共通ないくつかのメソッドがすでに実装してあ ります。これを継承したIOクラスでは、さらに以下のようなメソッドを実装 しなくてはいけません。
|
|
31
34
|
|
|
32
35
|
#### calendar
|
|
33
36
|
tDiaryに、日記が存在する年月を通知するためのメソッドです。実行時にtDiary から呼び出されます。
|
|
@@ -74,31 +77,6 @@ def trasaction( date )
|
|
|
74
77
|
end
|
|
75
78
|
```
|
|
76
79
|
|
|
77
|
-
#### diary\_factory( date, title, body, style = 'tDiary' )
|
|
78
|
-
diary\_factoryは、指定されたフォーマットの日記オブジェクトを生成して 返します。
|
|
79
|
-
|
|
80
|
-
引数dateは日付(Stringで8桁)を指定します。title、bodyはそれぞれ生成す る日記のタイトルと本文です(String)。styleは日記の記述形式を指定する 文字列で、diary\_factoryに依存します。
|
|
81
|
-
|
|
82
|
-
返り値はDiaryBaseをincludeした継承したクラスのオブジェクトです。
|
|
83
|
-
|
|
84
|
-
以下にdiary\_factoryの例を示します。
|
|
85
|
-
|
|
86
|
-
```
|
|
87
|
-
def diary_factory( date, title, body, style = 'tDiary' )
|
|
88
|
-
case style
|
|
89
|
-
when 'tDiary' DefaultDiary::new( date, title, body )
|
|
90
|
-
default raise StandardError, 'bad style'
|
|
91
|
-
end
|
|
92
|
-
end
|
|
93
|
-
```
|
|
94
|
-
|
|
95
|
-
もし、スタイルに対応したIOクラスを作るなら、initializeでload\_styleを 呼んだ上で、以下のようにstyled\_diary\_factoryを呼ぶだけで良いです。
|
|
96
|
-
|
|
97
|
-
```
|
|
98
|
-
def diary_factory( date, title, body, style = 'tDiary' )
|
|
99
|
-
styled_diary_factory( date, title, body, style )
|
|
100
|
-
end
|
|
101
|
-
```
|
|
102
80
|
|
|
103
81
|
日記データ
|
|
104
82
|
-----
|
|
@@ -145,43 +123,15 @@ end
|
|
|
145
123
|
もし、この日記データをスタイルとして設計するのであれば、IOクラスとは 分離して、別のファイルにする必要があります。この場合、スタイル名と ファイル名、日記データクラス名には強い依存性があります。「Hoge」という スタイルを作る場合、以下のように作る必要があります。
|
|
146
124
|
|
|
147
125
|
- スタイル名: Hoge
|
|
148
|
-
- ファイル名: hoge
|
|
149
|
-
- クラス名 : TDiary::HogeDiary (スタイル名.capitalize + 'Diary')
|
|
150
|
-
|
|
151
|
-
### DiaryBaseモジュール
|
|
152
|
-
|
|
153
|
-
tdiary.rbにはDiaryBaseというモジュールが定義されており、 日記データのクラスはこのモジュールをincludeしなければなりません。
|
|
154
|
-
|
|
155
|
-
下記の例はHogeDiaryにDiaryBaseをincludeしています。
|
|
156
|
-
|
|
157
|
-
```
|
|
158
|
-
class HogeDiary
|
|
159
|
-
include DiaryBase
|
|
160
|
-
.....
|
|
161
|
-
end
|
|
162
|
-
```
|
|
163
|
-
|
|
164
|
-
### CategorizableDiary/UncategorizableDiaryモジュール
|
|
165
|
-
|
|
166
|
-
tdiary.rbにはCategorizableDiaryとUncategorizableDiaryというモジュールが定義されています。 日記データのクラスは、カテゴリ機能に対応している場合はCategorizableDiaryモジュールを、 カテゴリ機能に対応していない場合はUncategorizableDiaryモジュールを includeしなければなりません。
|
|
167
|
-
|
|
168
|
-
下記の例はHogeDiaryにCategoriabeleDiaryをincludeしています。
|
|
169
|
-
|
|
170
|
-
```
|
|
171
|
-
class HogeDiary
|
|
172
|
-
include CategorizableDiary
|
|
173
|
-
.....
|
|
174
|
-
end
|
|
175
|
-
```
|
|
126
|
+
- ファイル名: style/hoge.rb
|
|
127
|
+
- クラス名 : TDiary::Style::HogeDiary (スタイル名.capitalize + 'Diary')
|
|
176
128
|
|
|
177
129
|
### 最低限実装すべきもの
|
|
178
130
|
|
|
179
131
|
DiaryBaseモジュールには日記データのクラスに必要な幾つかのメソッドが 定義されています。DiaryBaseで定義されているメソッド以外に 日記データのクラスが備えるべきメソッドは下記のものになります。 (ここでいうメソッドは Public Instance Method のことです。)
|
|
180
132
|
|
|
181
133
|
- initialize
|
|
182
|
-
- replace
|
|
183
134
|
- append
|
|
184
|
-
- each\_section
|
|
185
135
|
- to\_html
|
|
186
136
|
- to\_src
|
|
187
137
|
- style
|
|
@@ -197,7 +147,6 @@ DiaryBaseモジュールには日記データのクラスに必要な幾つか
|
|
|
197
147
|
|
|
198
148
|
```
|
|
199
149
|
class HogeDiary
|
|
200
|
-
include DiaryBase
|
|
201
150
|
.....
|
|
202
151
|
def initialize(date, title, body, modified = Time::now)
|
|
203
152
|
init_diary
|
|
@@ -207,16 +156,6 @@ class HogeDiary
|
|
|
207
156
|
end
|
|
208
157
|
```
|
|
209
158
|
|
|
210
|
-
#### replace(date, title, body)
|
|
211
|
-
日記データの日付をdateに、日記本文のソースをbodyに、タイトルをtitleに変更します。 dateはTimeオブジェクト、もしくは、日付をあらわす文字列('YYYYMMDD')です。 日付を表す文字列は具体的には下のようになります。
|
|
212
|
-
|
|
213
|
-
- '20020831'
|
|
214
|
-
- '20010101'
|
|
215
|
-
|
|
216
|
-
body, titleは文字列です。
|
|
217
|
-
|
|
218
|
-
日記本文が変更された場合、日記本文を解釈し直す必要があります。 解釈し直す時には日記データを構成するセクションも変更されます。
|
|
219
|
-
|
|
220
159
|
#### append(body, author = nil)
|
|
221
160
|
日記本文を追加します。bodyは追加される日記本文です。 authorは日記を記述した人の名前で、文字列です。 authorの引数はデフォルトでnilにしなければなりません。
|
|
222
161
|
|
|
@@ -239,18 +178,6 @@ class HogeDiary
|
|
|
239
178
|
end
|
|
240
179
|
```
|
|
241
180
|
|
|
242
|
-
#### to\_html(opt, mode = :HTML)
|
|
243
|
-
日記データをHTMLに変換します。引数optは設定ファイル(tdiary.conf)の内容の一部を 保持するHashオブジェクトです。引数modeはSymbolオブジェクトで、 現在は下記のいずれかです。
|
|
244
|
-
|
|
245
|
-
- :HTML
|
|
246
|
-
- :CHTML
|
|
247
|
-
|
|
248
|
-
想定しないmodeが指定された場合は、:HTMLが指定されたものとみなして下 さい。:HTMLの場合は通常のブラウザ用にHTMLに、:CHTMLの場合は携帯端末 用にcHTMLに変換しなければなりません。
|
|
249
|
-
|
|
250
|
-
optの内容によって、日記のリンク先を変更しなければならないので、注意 が必要です。
|
|
251
|
-
|
|
252
|
-
カテゴリ機能に対応した日記データのクラスでは、 各セクションのサブタイトル中のカテゴリ指定をcategory\_anchorプラグインの呼出しに変換して下さい。
|
|
253
|
-
|
|
254
181
|
#### to\_src
|
|
255
182
|
日記の本文を返します。
|
|
256
183
|
|
data/doc/INSTALL-paas.md
CHANGED
|
@@ -57,7 +57,7 @@ heroku コマンドを用いて Heroku でアプリケーションを作成し
|
|
|
57
57
|
日記更新時に必要となるユーザー名とパスワードを保存する .htpasswd ファイルを作成します。この情報は重要なので、外部には公開しないでください。
|
|
58
58
|
|
|
59
59
|
```
|
|
60
|
-
% bundle exec
|
|
60
|
+
% bundle exec bin/tdiary htpasswd
|
|
61
61
|
```
|
|
62
62
|
|
|
63
63
|
ここまでの変更内容を deploy ブランチにコミットし、Heroku にアプリケーションを転送します。
|
|
@@ -198,9 +198,9 @@ gem 'dalli'
|
|
|
198
198
|
tdiary.conf を以下のように変更します。
|
|
199
199
|
|
|
200
200
|
```
|
|
201
|
-
# require 'tdiary/
|
|
201
|
+
# require 'tdiary/cache/file'
|
|
202
202
|
# To use memcache addon
|
|
203
|
-
require 'tdiary/
|
|
203
|
+
require 'tdiary/cache/memcached'
|
|
204
204
|
```
|
|
205
205
|
|
|
206
206
|
この状態を Heroku に反映させます。
|
data/doc/INSTALL.md
CHANGED
|
@@ -33,20 +33,20 @@ tDiary は日記データのキャッシュを PStore ファイルとして保
|
|
|
33
33
|
|
|
34
34
|
```
|
|
35
35
|
# 以下の行をコメントアウト
|
|
36
|
-
# require 'tdiary/
|
|
37
|
-
require 'tdiary/
|
|
36
|
+
# require 'tdiary/cache/file'
|
|
37
|
+
require 'tdiary/cache/memcached'
|
|
38
38
|
require 'tdiary/io/default'
|
|
39
|
-
@io_class =
|
|
39
|
+
@io_class = TDiary::IO::Default
|
|
40
40
|
```
|
|
41
41
|
|
|
42
42
|
同様に redis を使用する場合は tdiary.conf を以下のように変更します。
|
|
43
43
|
|
|
44
44
|
```
|
|
45
45
|
# 以下の行をコメントアウト
|
|
46
|
-
# require 'tdiary/
|
|
47
|
-
require 'tdiary/
|
|
46
|
+
# require 'tdiary/cache/file'
|
|
47
|
+
require 'tdiary/cache/redis'
|
|
48
48
|
require 'tdiary/io/default'
|
|
49
|
-
@io_class =
|
|
49
|
+
@io_class = TDiary::IO::Default
|
|
50
50
|
```
|
|
51
51
|
|
|
52
52
|
#### CGIで設定できない項目
|
data/misc/lib/fcgi_patch.rb
CHANGED
data/misc/migrate.rb
CHANGED
data/misc/paas/heroku/Gemfile
CHANGED
data/misc/plugin/amazon.rb
CHANGED
|
@@ -170,7 +170,7 @@ def amazon_detail_html( item )
|
|
|
170
170
|
@conf['amazon.imgsize'] = size_orig
|
|
171
171
|
|
|
172
172
|
url = amazon_url( item )
|
|
173
|
-
|
|
173
|
+
<<-HTML
|
|
174
174
|
<a class="amazon-detail" href="#{url}"><span class="amazon-detail">
|
|
175
175
|
<img class="amazon-detail left" src="#{h image[:src]}"
|
|
176
176
|
height="#{h image[:height]}" width="#{h image[:width]}"
|
data/misc/plugin/calendar2.rb
CHANGED
data/misc/plugin/calendar3.rb
CHANGED
|
@@ -141,7 +141,6 @@ def calendar3
|
|
|
141
141
|
end
|
|
142
142
|
year = date.year
|
|
143
143
|
month = date.month
|
|
144
|
-
day = date.day
|
|
145
144
|
|
|
146
145
|
result << %Q|<span class="calendar-prev-month"><a href="#{h @index}#{anchor "%04d%02d" % Calendar3.prev_month(year, month)}"><<</a></span>\n|
|
|
147
146
|
result << %Q|<span class="calendar-current-month"><a href="#{h @index}#{anchor "%04d%02d" % [year, month]}">#{"%04d/%02d" % [year, month]}</a>/</span>\n|
|
data/misc/plugin/category.rb
CHANGED
|
@@ -105,8 +105,6 @@ end
|
|
|
105
105
|
|
|
106
106
|
def category_list_sections
|
|
107
107
|
info = Category::Info.new(@cgi, @years, @conf)
|
|
108
|
-
category = info.category
|
|
109
|
-
years = info.years
|
|
110
108
|
r = ''
|
|
111
109
|
|
|
112
110
|
raise ::TDiary::NotFound if @categorized.empty? and bot?
|
|
@@ -141,8 +139,6 @@ end
|
|
|
141
139
|
|
|
142
140
|
def category_list_sections_mobile
|
|
143
141
|
info = Category::Info.new(@cgi, @years, @conf)
|
|
144
|
-
category = info.category
|
|
145
|
-
years = info.years
|
|
146
142
|
r = ''
|
|
147
143
|
|
|
148
144
|
raise ::TDiary::NotFound if @categorized.empty? and bot?
|
|
@@ -496,7 +492,6 @@ class Cache
|
|
|
496
492
|
ym = "#{y}#{m}"
|
|
497
493
|
cgi.params['date'] = [ym]
|
|
498
494
|
m = TDiaryMonth.new(cgi, '', @conf)
|
|
499
|
-
sections = {}
|
|
500
495
|
m.diaries.each do |ymd, diary|
|
|
501
496
|
next if !diary.visible?
|
|
502
497
|
initial_replace_sections(diary)
|
|
@@ -699,7 +694,6 @@ end
|
|
|
699
694
|
|
|
700
695
|
if @mode == 'conf' || @mode == 'saveconf'
|
|
701
696
|
add_conf_proc( 'category', @category_conf_label, 'basic' ) do
|
|
702
|
-
cache = @category_cache
|
|
703
697
|
if @mode == 'saveconf'
|
|
704
698
|
if @cgi.valid?( 'category_initialize' )
|
|
705
699
|
@category_cache.recreate(@years)
|
data/misc/plugin/counter.rb
CHANGED
|
@@ -494,7 +494,7 @@ TOPLEVEL_CLASS
|
|
|
494
494
|
msg = @options["counter.kiriban_today_msg"] ? @options["counter.kiriban_today_msg"] : ""
|
|
495
495
|
ERB.new(msg.untaint).result(binding)
|
|
496
496
|
else
|
|
497
|
-
|
|
497
|
+
@options["counter.kiriban_nomatch_msg"] ? @options["counter.kiriban_nomatch_msg"] : ""
|
|
498
498
|
end
|
|
499
499
|
end
|
|
500
500
|
end
|
data/misc/plugin/daily_theme.rb
CHANGED
|
@@ -40,7 +40,7 @@ def daily_theme_conf_proc
|
|
|
40
40
|
# initialize Theme list
|
|
41
41
|
@conf['daily_theme.list'] = "default" unless @conf['daily_theme.list']
|
|
42
42
|
|
|
43
|
-
|
|
43
|
+
<<-HTML
|
|
44
44
|
<h3>#{@daily_theme_label}</h3>
|
|
45
45
|
<p>#{@daily_theme_label_desc}</p>
|
|
46
46
|
<p><textarea name="daily_theme.list" cols="70" rows="20">#{h( @conf['daily_theme.list'] )}</textarea></p>
|
data/misc/plugin/edit_today.rb
CHANGED
|
@@ -17,7 +17,7 @@ def edit_today_link( date, title )
|
|
|
17
17
|
edit_today_init
|
|
18
18
|
caption = @conf['edit_today.caption']
|
|
19
19
|
unless @cgi.mobile_agent?
|
|
20
|
-
|
|
20
|
+
<<-HTML
|
|
21
21
|
#{title}\n<span class="edit-today">
|
|
22
22
|
<a href="#{@update}?edit=true;#{date.strftime( 'year=%Y;month=%m;day=%d' )}" title="#{edit_today_edit_label( date )}" rel="nofollow">#{caption}</a>
|
|
23
23
|
</span>
|
|
@@ -7,7 +7,7 @@ def edit_today_edit_label( date )
|
|
|
7
7
|
end
|
|
8
8
|
|
|
9
9
|
def edit_today_conf_html
|
|
10
|
-
|
|
10
|
+
<<-HTML
|
|
11
11
|
<h3 class="subtitle">Link String</h3>
|
|
12
12
|
<p>Specify string to link to edit page. If you have image file, you can specify icon on this link.</p>
|
|
13
13
|
<p><input name="edit_today_caption" size="70" value="#{h @conf['edit_today.caption']}"></p>
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
@hide_mail_field_label_conf = 'Hide Mail Field'
|
|
4
4
|
|
|
5
5
|
def hide_mail_field_conf_html
|
|
6
|
-
|
|
6
|
+
<<-HTML
|
|
7
7
|
<h3>Description of TSUKKOMI</h3>
|
|
8
8
|
<p>Show messeges about hidden of E-mail field for your subscribers. This field is as same as in default spam filter preferences.<br>
|
|
9
9
|
<textarea name="comment_description" cols="60" rows="5">#{h comment_description}</textarea></p>
|
data/misc/plugin/en/weather.rb
CHANGED
data/misc/plugin/image.rb
CHANGED
|
@@ -86,7 +86,7 @@ def image( id, alt = 'image', thumbnail = nil, size = nil, place = 'photo' )
|
|
|
86
86
|
size = %Q| width="#{size.to_i}"|
|
|
87
87
|
end
|
|
88
88
|
elsif @image_maxwidth and not @conf.secure then
|
|
89
|
-
|
|
89
|
+
_, w, _ = image_info( "#{@image_dir}/#{image}".untaint )
|
|
90
90
|
if w > @image_maxwidth then
|
|
91
91
|
size = %Q[ width="#{h @image_maxwidth}"]
|
|
92
92
|
else
|
|
@@ -235,16 +235,11 @@ add_form_proc do |date|
|
|
|
235
235
|
images.each_with_index do |img,id|
|
|
236
236
|
next unless img
|
|
237
237
|
if @conf.secure then
|
|
238
|
-
|
|
238
|
+
img_w, img_h = nil, nil
|
|
239
239
|
else
|
|
240
|
-
|
|
240
|
+
_, img_w, img_h = image_info(File.join(@image_dir,img).untaint)
|
|
241
241
|
end
|
|
242
242
|
r << %Q[<td><img id="image-index-#{id}" class="image-img form" src="#{h @image_url}/#{h img}" alt="#{id}" width="#{h( (img_w && img_w > 160) ? 160 : (img_w ? img_w : 160) )}"></td>]
|
|
243
|
-
if @conf.secure then
|
|
244
|
-
img_info = ''
|
|
245
|
-
else
|
|
246
|
-
img_info = "#{File.size(File.join(@image_dir,img).untaint).to_s.reverse.gsub( /\d{3}/, '\0,' ).sub( /,$/, '' ).reverse} bytes"
|
|
247
|
-
end
|
|
248
243
|
img_info = ''
|
|
249
244
|
if img_w && img_h
|
|
250
245
|
img_info << %Q|<span class="image-width">#{img_w}</span> x <span class="image-height">#{img_h}</span>|
|
|
@@ -8,7 +8,7 @@ def edit_today_edit_label( date )
|
|
|
8
8
|
end
|
|
9
9
|
|
|
10
10
|
def edit_today_conf_html
|
|
11
|
-
|
|
11
|
+
<<-HTML
|
|
12
12
|
<h3 class="subtitle">リンク文字列</h3>
|
|
13
13
|
<p>編集ページへのリンクを示す文字列を指定します。画像が用意できれば、アイコンなども指定出来ます。</p>
|
|
14
14
|
<p><input name="edit_today_caption" size="70" value="#{h @conf['edit_today.caption']}"></p>
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
@hide_mail_field_label_conf = 'メール欄隠し'
|
|
5
5
|
|
|
6
6
|
def hide_mail_field_conf_html
|
|
7
|
-
|
|
7
|
+
<<-HTML
|
|
8
8
|
<h3>ツッコミの注意文</h3>
|
|
9
9
|
<p>ツッコミフォームの上に表示する注意文を設定します。メール欄が消えていることを読者にきちんと知らせましょう。この欄は標準spamフィルタの設定ページにあるものと同じものです。<br>
|
|
10
10
|
<textarea name="comment_description" cols="70" rows="5">#{h comment_description}</textarea><br>
|
data/misc/plugin/ja/weather.rb
CHANGED
|
@@ -239,6 +239,7 @@ class Weather
|
|
|
239
239
|
[%r[\s*\bclear\b\s*]i, '"快晴"'],
|
|
240
240
|
[%r[\s*\b(mostly |partly )?cloudy\b\s*]i, '"曇"'],
|
|
241
241
|
[%r[\s*\bbroken clouds\b\s*]i, '"曇"'],
|
|
242
|
+
[%r[\s*\bfew clouds\b\s*]i, '"晴"'],
|
|
242
243
|
[%r[\s*\bovercast( cloud deck)?\b\s*]i, '"曇"'],
|
|
243
244
|
[%r[\s*\blight snow showers?\b\s*]i, '"にわか雪"'],
|
|
244
245
|
[%r[\s*\blight snow\b\s*]i, '"小雪"'],
|
|
@@ -258,7 +259,9 @@ class Weather
|
|
|
258
259
|
[%r[\s*\blightning\b\s*]i, '"稲光"'],
|
|
259
260
|
[%r[\s*\bsand\b\s*]i, '"黄砂"'],
|
|
260
261
|
[%r[\s*\bcumulonimbus clouds\b\s*]i, '"積乱雲"'],
|
|
262
|
+
[%r[\s*\bscattered clouds\b\s*]i, '"ちぎれ雲"'],
|
|
261
263
|
[%r[\s*\bcumulus clouds\b\s*]i, '"積雲"'],
|
|
264
|
+
[%r[\Aunknown\z]i, '""'],
|
|
262
265
|
[%r[\s*\btowering\b\s*]i, '""'],
|
|
263
266
|
[%r[\s*\bobserved\b\s*]i, '""'],
|
|
264
267
|
[%r[\s*\bC\b\s*], '"℃"'],
|
data/misc/plugin/list.rb
CHANGED
data/misc/plugin/makerss.rb
CHANGED
|
@@ -287,7 +287,7 @@ def makerss_header( uri )
|
|
|
287
287
|
copyright += " <#{@conf.author_mail}>" if @conf.author_mail and not @conf.author_mail.empty?
|
|
288
288
|
copyright += ", copyright of comments by respective authors"
|
|
289
289
|
|
|
290
|
-
|
|
290
|
+
%Q[<?xml version="1.0" encoding="UTF-8"?>
|
|
291
291
|
<?xml-stylesheet href="rss.css" type="text/css"?>
|
|
292
292
|
<rdf:RDF xmlns="http://purl.org/rss/1.0/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:xhtml="http://www.w3.org/1999/xhtml" xml:lang="#{h @conf.html_lang}">
|
|
293
293
|
<channel rdf:about="#{h rdf_url}">
|
|
@@ -342,7 +342,6 @@ def makerss_body( uri, rdfsec )
|
|
|
342
342
|
|
|
343
343
|
@makerss_in_feed = true
|
|
344
344
|
subtitle = rdfsec.section.subtitle_to_html
|
|
345
|
-
sec_id = rdfsec.id[9,2].to_i
|
|
346
345
|
body_enter = body_enter_proc( date )
|
|
347
346
|
body = apply_plugin( rdfsec.section.body_to_html )
|
|
348
347
|
body_leave = body_leave_proc( date )
|
|
@@ -445,7 +444,7 @@ add_edit_proc do
|
|
|
445
444
|
else
|
|
446
445
|
''
|
|
447
446
|
end
|
|
448
|
-
|
|
447
|
+
<<-HTML
|
|
449
448
|
<div class="makerss"><label for="makerss_update">
|
|
450
449
|
<input type="checkbox" id="makerss_update" name="makerss_update" value="false"#{checked} tabindex="390">
|
|
451
450
|
#{@makerss_edit_label}
|
data/misc/plugin/my-ex.rb
CHANGED
|
@@ -43,7 +43,7 @@ def my( a, str, title = nil )
|
|
|
43
43
|
tb = nil
|
|
44
44
|
@diaries[date].each_visible_trackback( frag.to_i ) {|t, idx| tb = t}
|
|
45
45
|
if tb then
|
|
46
|
-
|
|
46
|
+
_, name, _, excerpt = tb.body.split( /\n/,4 )
|
|
47
47
|
title = h( "[#{name}] #{@conf.shorten( excerpt, @conf.comment_length )}" )
|
|
48
48
|
end
|
|
49
49
|
end
|
data/misc/plugin/ping.rb
CHANGED
|
@@ -64,7 +64,7 @@ def ping_conf_proc
|
|
|
64
64
|
@conf['ping.list'] = '' unless @conf['ping.list']
|
|
65
65
|
@conf['ping.timeout'] = '3' unless @conf['ping.timeout']
|
|
66
66
|
|
|
67
|
-
|
|
67
|
+
<<-HTML
|
|
68
68
|
<h3>#{@ping_label_list}</h3>
|
|
69
69
|
<p>#{@ping_label_list_desc}</p>
|
|
70
70
|
<p><textarea name="ping.list" cols="70" rows="5">#{h( @conf['ping.list'] )}</textarea></p>
|
|
@@ -82,7 +82,7 @@ def ping_edit_proc
|
|
|
82
82
|
if @mode == 'preview' then
|
|
83
83
|
checked = @cgi.params['plugin_ping_send'][0] == 'true' ? ' checked' : ''
|
|
84
84
|
end
|
|
85
|
-
|
|
85
|
+
<<-HTML
|
|
86
86
|
<div class="ping"><label for="plugin_ping_send">
|
|
87
87
|
<input type="checkbox" id="plugin_ping_send" name="plugin_ping_send" value="true"#{checked} tabindex="400">
|
|
88
88
|
#{@ping_label_send}
|
|
@@ -222,7 +222,7 @@ module DefaultIOSearch
|
|
|
222
222
|
end
|
|
223
223
|
|
|
224
224
|
def search_input_form( q )
|
|
225
|
-
|
|
225
|
+
<<-HTML
|
|
226
226
|
<form method="GET" action="#{@conf.index}"><div>
|
|
227
227
|
検索キーワード:
|
|
228
228
|
<input name="q" value="#{h q}">
|
|
@@ -237,7 +237,6 @@ def search_result
|
|
|
237
237
|
end
|
|
238
238
|
|
|
239
239
|
query = CGI::unescape( @cgi.params['q'][0] )
|
|
240
|
-
start = CGI::unescape( @cgi.params['start'][0] || '0' ).to_i
|
|
241
240
|
|
|
242
241
|
begin
|
|
243
242
|
patterns = DefaultIOSearch::setup_patterns(query)
|
data/misc/plugin/tlink.rb
CHANGED
|
@@ -75,7 +75,7 @@ def tlink_initialize
|
|
|
75
75
|
@tlink_path = dir + "/tlink.dat"
|
|
76
76
|
|
|
77
77
|
Dir.mkdir(dir, 0700) unless FileTest.exist?(dir)
|
|
78
|
-
|
|
78
|
+
PStore.new(@tlink_path).transaction do |db|
|
|
79
79
|
if (db.root?('tlinkdata')) then
|
|
80
80
|
@tlink_dic = db["tlinkdata"]
|
|
81
81
|
else
|
|
@@ -54,10 +54,9 @@ server.add_handler('blogger.newPost') do |appkey, blogid, username, password, co
|
|
|
54
54
|
@cgi.params['day'] = [postid[6..7]]
|
|
55
55
|
@cgi.params['body'] = [src]
|
|
56
56
|
@cgi.params['csrf_protection_key'] = [@conf.options['csrf_protection_key']]
|
|
57
|
-
|
|
58
|
-
body = tdiary.eval_rhtml
|
|
57
|
+
::TDiary::TDiaryReplace::new( @cgi, nil, @conf )
|
|
59
58
|
postid + "%02d" % index
|
|
60
|
-
rescue ::TDiary::ForceRedirect
|
|
59
|
+
rescue ::TDiary::ForceRedirect
|
|
61
60
|
postid + "%02d" % index
|
|
62
61
|
end
|
|
63
62
|
else
|
|
@@ -100,10 +99,9 @@ server.add_handler('blogger.editPost') do |appkey, postid, username, password, c
|
|
|
100
99
|
@cgi.params['day'] = [postid[6..7]]
|
|
101
100
|
@cgi.params['body'] = [src]
|
|
102
101
|
@cgi.params['csrf_protection_key'] = [@conf.options['csrf_protection_key']]
|
|
103
|
-
|
|
104
|
-
body = tdiary.eval_rhtml
|
|
102
|
+
::TDiary::TDiaryReplace::new( @cgi, nil, @conf )
|
|
105
103
|
true
|
|
106
|
-
rescue ::TDiary::ForceRedirect
|
|
104
|
+
rescue ::TDiary::ForceRedirect
|
|
107
105
|
true
|
|
108
106
|
rescue Exception
|
|
109
107
|
raise XMLRPC::FaultException.new(1,$!.to_s + "\n" + $!.backtrace.join("\n"))
|
|
@@ -136,10 +134,9 @@ server.add_handler('blogger.deletePost') do |appkey, postid, username, password|
|
|
|
136
134
|
@cgi.params['day'] = [postid[6..7]]
|
|
137
135
|
@cgi.params['body'] = [src]
|
|
138
136
|
@cgi.params['csrf_protection_key'] = [@conf.options['csrf_protection_key']]
|
|
139
|
-
|
|
140
|
-
body = tdiary.eval_rhtml
|
|
137
|
+
::TDiary::TDiaryReplace::new( @cgi, nil, @conf )
|
|
141
138
|
true
|
|
142
|
-
rescue ::TDiary::ForceRedirect
|
|
139
|
+
rescue ::TDiary::ForceRedirect
|
|
143
140
|
true
|
|
144
141
|
rescue Exception
|
|
145
142
|
raise XMLRPC::FaultException.new(1,$!.to_s + "\n" + $!.backtrace.join("\n"))
|
|
@@ -229,10 +226,9 @@ server.add_handler('metaWeblog.newPost') do |blogid, username, password, content
|
|
|
229
226
|
@cgi.params['day'] = [postid[6..7]]
|
|
230
227
|
@cgi.params['body'] = [src]
|
|
231
228
|
@cgi.params['csrf_protection_key'] = [@conf.options['csrf_protection_key']]
|
|
232
|
-
|
|
233
|
-
body = tdiary.eval_rhtml
|
|
229
|
+
::TDiary::TDiaryReplace::new( @cgi, nil, @conf )
|
|
234
230
|
postid + "%02d" % index
|
|
235
|
-
rescue ::TDiary::ForceRedirect
|
|
231
|
+
rescue ::TDiary::ForceRedirect
|
|
236
232
|
postid + "%02d" % index
|
|
237
233
|
end
|
|
238
234
|
end
|
|
@@ -271,10 +267,9 @@ server.add_handler('metaWeblog.editPost') do |postid, username, password, conten
|
|
|
271
267
|
@cgi.params['day'] = [postid[6..7]]
|
|
272
268
|
@cgi.params['body'] = [src]
|
|
273
269
|
@cgi.params['csrf_protection_key'] = [@conf.options['csrf_protection_key']]
|
|
274
|
-
|
|
275
|
-
body = tdiary.eval_rhtml
|
|
270
|
+
::TDiary::TDiaryReplace::new( @cgi, nil, @conf )
|
|
276
271
|
true
|
|
277
|
-
rescue ::TDiary::ForceRedirect
|
|
272
|
+
rescue ::TDiary::ForceRedirect
|
|
278
273
|
true
|
|
279
274
|
rescue Exception
|
|
280
275
|
raise XMLRPC::FaultException.new(1,$!.to_s + "\n" + $!.backtrace.join("\n"))
|
|
@@ -415,7 +410,6 @@ server.add_handler('mt.getCategoryList') do |blogid, username, password|
|
|
|
415
410
|
ym = "#{y}#{m}"
|
|
416
411
|
@cgi.params['date'] = [ym]
|
|
417
412
|
m = ::TDiary::TDiaryMonth.new(@cgi, '', @conf)
|
|
418
|
-
sections = {}
|
|
419
413
|
m.diaries.each do |ymd, diary|
|
|
420
414
|
next if !diary.visible?
|
|
421
415
|
diary.each_section do |s|
|
|
@@ -503,10 +497,9 @@ server.add_handler('mt.setPostCategories') do |postid, username, password, categ
|
|
|
503
497
|
@cgi.params['day'] = [postid[6..7]]
|
|
504
498
|
@cgi.params['body'] = [src]
|
|
505
499
|
@cgi.params['csrf_protection_key'] = [@conf.options['csrf_protection_key']]
|
|
506
|
-
|
|
507
|
-
body = tdiary.eval_rhtml
|
|
500
|
+
::TDiary::TDiaryReplace::new( @cgi, nil, @conf )
|
|
508
501
|
true
|
|
509
|
-
rescue ::TDiary::ForceRedirect
|
|
502
|
+
rescue ::TDiary::ForceRedirect
|
|
510
503
|
true
|
|
511
504
|
rescue Exception
|
|
512
505
|
raise XMLRPC::FaultException.new(1,$!.to_s + "\n" + $!.backtrace.join("\n"))
|
|
@@ -546,7 +539,7 @@ server.add_handler('mt.getTrackbackPings') do |postid|
|
|
|
546
539
|
result = []
|
|
547
540
|
date = Time::local( *postid.scan( /^(\d{4})(\d\d)(\d\d)(\d\d)$/ )[0] ) + 12*60*60
|
|
548
541
|
tdiary[date].each_visible_trackback(100) {|com,i|
|
|
549
|
-
url,
|
|
542
|
+
url, _, title, _ = com.body.split( /\n/,4 )
|
|
550
543
|
result << {
|
|
551
544
|
'pingURL' => url,
|
|
552
545
|
'pingIP' => '127.0.0.1',
|
data/package.json
CHANGED
|
@@ -21,9 +21,9 @@
|
|
|
21
21
|
},
|
|
22
22
|
"homepage": "https://github.com/tdiary/tdiary-core",
|
|
23
23
|
"devDependencies": {
|
|
24
|
-
"bower": "
|
|
25
|
-
"grunt": "
|
|
26
|
-
"grunt-cli": "
|
|
27
|
-
"grunt-bower-task": "
|
|
24
|
+
"bower": "*",
|
|
25
|
+
"grunt": "*",
|
|
26
|
+
"grunt-cli": "*",
|
|
27
|
+
"grunt-bower-task": "*"
|
|
28
28
|
}
|
|
29
29
|
}
|
data/plugin/00default.rb
CHANGED
|
@@ -472,7 +472,7 @@ def nyear_link( date, title )
|
|
|
472
472
|
d = date.strftime( '%d' )
|
|
473
473
|
years = @years.find_all {|year, months| months.include? m}
|
|
474
474
|
if years.length >= 2 then
|
|
475
|
-
%Q|#{title} <span class="nyear">[<a href="#{h @conf.index}#{anchor m + d}" title="#{h(nyear_diary_title
|
|
475
|
+
%Q|#{title} <span class="nyear">[<a href="#{h @conf.index}#{anchor m + d}" title="#{h(nyear_diary_title)}">#{nyear_diary_label}</a>]</span>|
|
|
476
476
|
else
|
|
477
477
|
title
|
|
478
478
|
end
|
data/plugin/05referer.rb
CHANGED
data/plugin/10spamfilter.rb
CHANGED
|
@@ -84,18 +84,6 @@ add_conf_proc( 'spamfilter', @spamfilter_label_conf, 'security' ) do
|
|
|
84
84
|
@conf['spamfilter.date_limit'] = nil
|
|
85
85
|
end
|
|
86
86
|
|
|
87
|
-
if @conf['spamfilter.filter_mode'].nil? || @conf['spamfilter.filter_mode']
|
|
88
|
-
filter_mode = true
|
|
89
|
-
else
|
|
90
|
-
filter_mode = false
|
|
91
|
-
end
|
|
92
|
-
|
|
93
|
-
if @conf['spamfilter.resolv_check_mode'].nil? || @conf['spamfilter.resolv_check_mode']
|
|
94
|
-
resolv_check_mode = true
|
|
95
|
-
else
|
|
96
|
-
resolv_check_mode = false
|
|
97
|
-
end
|
|
98
|
-
|
|
99
87
|
if @cgi.params['spamlookup.ip.list'] && @cgi.params['spamlookup.ip.list'][0]
|
|
100
88
|
@conf['spamlookup.ip.list'] = @cgi.params['spamlookup.ip.list'][0]
|
|
101
89
|
else
|
data/plugin/50sp.rb
CHANGED
|
@@ -119,7 +119,7 @@ end
|
|
|
119
119
|
# configuration menu
|
|
120
120
|
# options are updated when we are eval'ed
|
|
121
121
|
add_conf_proc( SP_PREFIX, @sp_label, 'basic' ) do
|
|
122
|
-
|
|
122
|
+
@sp_label_description + sp_list_plugins( @sp_opt )
|
|
123
123
|
end
|
|
124
124
|
|
|
125
125
|
# Finally, we can eval the selected plugins as tdiary.rb does
|
data/plugin/60sf.rb
CHANGED
|
@@ -116,7 +116,7 @@ end
|
|
|
116
116
|
# configuration menu
|
|
117
117
|
# options are updated when we are eval'ed
|
|
118
118
|
add_conf_proc( SF_PREFIX, @sf_label, 'security' ) do
|
|
119
|
-
|
|
119
|
+
@sf_label_description + sf_list_plugins( @sf_opt )
|
|
120
120
|
end
|
|
121
121
|
|
|
122
122
|
# Finally, we can eval the selected plugins as tdiary.rb does
|
|
@@ -127,7 +127,7 @@ if sf_option( 'selected' ) && !@sf_filters then
|
|
|
127
127
|
path = "#{dir}/#{filename}"
|
|
128
128
|
if File.readable?( path ) then
|
|
129
129
|
begin
|
|
130
|
-
require path
|
|
130
|
+
require File.expand_path( path )
|
|
131
131
|
@sf_filters << TDiary::Filter::const_get("#{File::basename(filename, ".rb").capitalize}Filter")::new(@cgi, @conf)
|
|
132
132
|
plugin_path = "#{dir}/plugin/#{filename}"
|
|
133
133
|
load_plugin(plugin_path) if File.readable?(plugin_path)
|
data/plugin/en/00default.rb
CHANGED
|
@@ -30,7 +30,7 @@ def title_tag
|
|
|
30
30
|
r << '(Preferences Changed)'
|
|
31
31
|
when 'nyear'
|
|
32
32
|
years = @diaries.keys.map {|ymd| ymd.sub(/^\d{4}/, "")}
|
|
33
|
-
r << "(#{years[0].sub( /^(\d\d)/, '\1-')}[#{nyear_diary_label
|
|
33
|
+
r << "(#{years[0].sub( /^(\d\d)/, '\1-')}[#{nyear_diary_label}])" if @date
|
|
34
34
|
end
|
|
35
35
|
r << '</title>'
|
|
36
36
|
end
|
|
@@ -89,8 +89,8 @@ def submit_label
|
|
|
89
89
|
end
|
|
90
90
|
def preview_label; 'Preview'; end
|
|
91
91
|
|
|
92
|
-
def nyear_diary_label
|
|
93
|
-
def nyear_diary_title
|
|
92
|
+
def nyear_diary_label; "my old days"; end
|
|
93
|
+
def nyear_diary_title; "same days in past"; end
|
|
94
94
|
|
|
95
95
|
|
|
96
96
|
#
|
|
@@ -300,7 +300,6 @@ add_conf_proc( 'csrf_protection', 'CSRF Protection', 'security' ) do
|
|
|
300
300
|
errstr = '<p class="message">No key specified. Configuration not saved.</p>'
|
|
301
301
|
end
|
|
302
302
|
csrf_protection_method = @conf.options['csrf_protection_method'] || 1
|
|
303
|
-
csrf_protection_key = @conf.options['csrf_protection_key'] || ''
|
|
304
303
|
<<-HTML
|
|
305
304
|
#{errstr}
|
|
306
305
|
<p>This page configures a protection scheme to prevent "cross-site request forgery" (CSRF) attacks.</p>
|
data/plugin/en/05referer.rb
CHANGED
|
@@ -13,9 +13,6 @@ def label_no_referer; "Today's Links Excluding List"; end
|
|
|
13
13
|
def label_only_volatile; "Volatile Links List"; end
|
|
14
14
|
def label_referer_table; "Today's Links Conversion Rule"; end
|
|
15
15
|
|
|
16
|
-
def nyear_diary_label(date, years); "my old days"; end
|
|
17
|
-
def nyear_diary_title(date, years); "same days in past"; end
|
|
18
|
-
|
|
19
16
|
add_conf_proc( 'referer', "Today's Link", 'referer' ) do
|
|
20
17
|
saveconf_referer
|
|
21
18
|
|
data/plugin/ja/00default.rb
CHANGED
|
@@ -29,8 +29,7 @@ def title_tag
|
|
|
29
29
|
when 'saveconf'
|
|
30
30
|
r << '(設定完了)'
|
|
31
31
|
when 'nyear'
|
|
32
|
-
|
|
33
|
-
r << "(#{h @cgi.params['date'][0].sub( /^(\d\d)/, '\1-')}[#{nyear_diary_label @date, years}])" if @date
|
|
32
|
+
r << "(#{h @cgi.params['date'][0].sub( /^(\d\d)/, '\1-')}[#{nyear_diary_label}])" if @date
|
|
34
33
|
end
|
|
35
34
|
r << '</title>'
|
|
36
35
|
end
|
|
@@ -124,8 +123,8 @@ def submit_label
|
|
|
124
123
|
end
|
|
125
124
|
def preview_label; 'プレビュー'; end
|
|
126
125
|
|
|
127
|
-
def nyear_diary_label
|
|
128
|
-
def nyear_diary_title
|
|
126
|
+
def nyear_diary_label; "長年日記"; end
|
|
127
|
+
def nyear_diary_title; "長年日記"; end
|
|
129
128
|
|
|
130
129
|
#
|
|
131
130
|
# labels (for mobile)
|
|
@@ -300,7 +299,6 @@ add_conf_proc( 'csrf_protection', 'CSRF(乗っ取り)対策', 'security' ) do
|
|
|
300
299
|
errstr = '<p class="message">鍵が空です。変更されませんでした。</p>'
|
|
301
300
|
end
|
|
302
301
|
csrf_protection_method = @conf.options['csrf_protection_method'] || 1
|
|
303
|
-
csrf_protection_key = @conf.options['csrf_protection_key'] || ''
|
|
304
302
|
<<-HTML
|
|
305
303
|
#{errstr}
|
|
306
304
|
<p>クロスサイト・リクエストフォージェリ(CSRF)の対策手法を設定します。</p>
|
data/spec/plugin/bq_spec.rb
CHANGED
data/tdiary/base.rb
CHANGED
|
@@ -125,7 +125,7 @@ module TDiary
|
|
|
125
125
|
|
|
126
126
|
begin
|
|
127
127
|
r = ERB.new(rhtml.untaint).result(binding)
|
|
128
|
-
rescue ::Encoding::CompatibilityError
|
|
128
|
+
rescue ::Encoding::CompatibilityError
|
|
129
129
|
# migration error on ruby 1.9 only 1st time, reload.
|
|
130
130
|
raise ForceRedirect.new(base_url)
|
|
131
131
|
end
|
data/tdiary/compatible.rb
CHANGED
|
@@ -33,7 +33,7 @@ class PStore
|
|
|
33
33
|
def transaction(*args, &block)
|
|
34
34
|
begin
|
|
35
35
|
compatible_transaction_original(*args, &block)
|
|
36
|
-
rescue PStoreRuby18Exception
|
|
36
|
+
rescue PStoreRuby18Exception
|
|
37
37
|
# first loaded the pstore file (it's created by Ruby-1.8)
|
|
38
38
|
# force convert ASCII_8BIT pstore data to UTF_8
|
|
39
39
|
file = open_and_lock_file(@filename, false)
|
data/tdiary/core_ext.rb
CHANGED
data/tdiary/plugin.rb
CHANGED
data/tdiary/referer_manager.rb
CHANGED
data/tdiary/style/tdiary.rb
CHANGED
data/tdiary/style/wiki.rb
CHANGED
|
@@ -11,6 +11,7 @@
|
|
|
11
11
|
# You can distribute this under GPL.
|
|
12
12
|
#
|
|
13
13
|
require 'hikidoc'
|
|
14
|
+
require 'uri'
|
|
14
15
|
|
|
15
16
|
module TDiary
|
|
16
17
|
module Style
|
|
@@ -102,7 +103,7 @@ module TDiary
|
|
|
102
103
|
if /^(\d{4}|\d{6}|\d{8}|\d{8}-\d+)[^\d]*?#?([pct]\d+)?$/ =~ u then
|
|
103
104
|
%Q[<%=my '#{$1}#{$2}', '#{escape_quote k}' %>]
|
|
104
105
|
elsif /:/ =~ u
|
|
105
|
-
scheme
|
|
106
|
+
scheme = URI( u ).scheme rescue nil # URI::InvalidURIError
|
|
106
107
|
if /\A(?:http|https|ftp|mailto)\z/ =~ scheme
|
|
107
108
|
u.sub!( /^\w+:/, '' ) if %r|://| !~ u and /^mailto:/ !~ u
|
|
108
109
|
%Q[<a href="#{u}">#{k}</a>]
|
data/tdiary/version.rb
CHANGED
data/test/weather_test.rb
CHANGED
|
@@ -150,6 +150,12 @@ class TestWeatherTranslaterJa < Test::Unit::TestCase
|
|
|
150
150
|
@plugin_class = TDiary::StubPlugin::new_plugin('misc/plugin/weather.rb', 'ja')
|
|
151
151
|
end
|
|
152
152
|
|
|
153
|
+
def test_translate_few_clouds
|
|
154
|
+
ja = @plugin_class::WeatherTranslator::S.new('Few clouds').\
|
|
155
|
+
translate(@plugin_class::Weather::Words_ja)
|
|
156
|
+
assert_equal('晴', ja)
|
|
157
|
+
end
|
|
158
|
+
|
|
153
159
|
def test_translate_broken_clouds
|
|
154
160
|
ja = @plugin_class::WeatherTranslator::S.new('broken clouds').\
|
|
155
161
|
translate(@plugin_class::Weather::Words_ja)
|
|
@@ -167,6 +173,30 @@ class TestWeatherTranslaterJa < Test::Unit::TestCase
|
|
|
167
173
|
translate(@plugin_class::Weather::Words_ja)
|
|
168
174
|
assert_equal('曇', ja)
|
|
169
175
|
end
|
|
176
|
+
|
|
177
|
+
def test_translate_scattered_clouds
|
|
178
|
+
ja = @plugin_class::WeatherTranslator::S.new('Scattered clouds').\
|
|
179
|
+
translate(@plugin_class::Weather::Words_ja)
|
|
180
|
+
assert_equal('ちぎれ雲', ja)
|
|
181
|
+
end
|
|
182
|
+
|
|
183
|
+
def test_translate_no_significant_weather
|
|
184
|
+
ja = @plugin_class::WeatherTranslator::S.new('Unknown').\
|
|
185
|
+
translate(@plugin_class::Weather::Words_ja)
|
|
186
|
+
assert_equal('', ja)
|
|
187
|
+
end
|
|
188
|
+
end
|
|
189
|
+
|
|
190
|
+
class TestWeatherTranslaterEn < Test::Unit::TestCase
|
|
191
|
+
def setup
|
|
192
|
+
@plugin_class = TDiary::StubPlugin::new_plugin('misc/plugin/weather.rb', 'en')
|
|
193
|
+
end
|
|
194
|
+
|
|
195
|
+
def test_translate_no_significant_weather
|
|
196
|
+
en = @plugin_class::WeatherTranslator::S.new('Unknown').\
|
|
197
|
+
translate(@plugin_class::Weather::Words_en)
|
|
198
|
+
assert_equal('', en)
|
|
199
|
+
end
|
|
170
200
|
end
|
|
171
201
|
|
|
172
202
|
# Stub for @conf
|
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: tdiary
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 4.0.
|
|
4
|
+
version: 4.0.5
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- TADA Tadashi
|
|
@@ -10,7 +10,7 @@ authors:
|
|
|
10
10
|
autorequire:
|
|
11
11
|
bindir: bin
|
|
12
12
|
cert_chain: []
|
|
13
|
-
date: 2014-
|
|
13
|
+
date: 2014-08-29 00:00:00.000000000 Z
|
|
14
14
|
dependencies:
|
|
15
15
|
- !ruby/object:Gem::Dependency
|
|
16
16
|
name: thor
|