Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Y
Ygopro Arena Web
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Locked Files
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Security & Compliance
Security & Compliance
Dependency List
License Compliance
Packages
Packages
List
Container Registry
Analytics
Analytics
CI / CD
Code Review
Insights
Issues
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
MyCard
Ygopro Arena Web
Commits
32987f78
Commit
32987f78
authored
Jun 30, 2012
by
神楽坂玲奈
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
在线大厅修复
parent
4eb9f0fb
Changes
7
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
284 additions
and
186 deletions
+284
-186
Rakefile
Rakefile
+2
-2
app/controllers/rooms_controller.rb
app/controllers/rooms_controller.rb
+42
-32
app/controllers/servers_controller.rb
app/controllers/servers_controller.rb
+6
-1
app/controllers/users_controller.rb
app/controllers/users_controller.rb
+2
-2
app/views/boards/index.html.erb
app/views/boards/index.html.erb
+120
-35
app/views/users/new.html.erb
app/views/users/new.html.erb
+110
-113
config/locales/zh-CN.yml
config/locales/zh-CN.yml
+2
-1
No files found.
Rakefile
View file @
32987f78
...
@@ -99,7 +99,7 @@ end
...
@@ -99,7 +99,7 @@ end
task
:refresh_user_pass
=>
:environment
do
task
:refresh_user_pass
=>
:environment
do
require
'cgi'
require
'cgi'
require
'open-uri'
require
'open-uri'
servers
=
Server
.
all
#where(:server_type => "ygopro")
servers
=
Server
.
where
(
:name
=>
:"ygopro-ocg"
)
#
all#where(:server_type => "ygopro")
users
=
[]
users
=
[]
User
.
all
.
each
do
|
user
|
User
.
all
.
each
do
|
user
|
if
user
.
password
.
nil?
if
user
.
password
.
nil?
...
@@ -115,7 +115,7 @@ task :refresh_user_pass => :environment do
...
@@ -115,7 +115,7 @@ task :refresh_user_pass => :environment do
out
=
"
#{
user
.
id
}
#{
user
.
name
}
"
out
=
"
#{
user
.
id
}
#{
user
.
name
}
"
servers
.
each
do
|
server
|
servers
.
each
do
|
server
|
url
=
server
.
register
.
gsub
/\{key\}|\{id\}|\{name\}|\{password\}|\{email\}/
,
'{key}'
=>
URI
.
encode_www_form_component
(
server
.
key
),
'{id}'
=>
URI
.
encode_www_form_component
(
user
.
id
),
'{name}'
=>
URI
.
encode_www_form_component
(
user
.
name
),
'{password}'
=>
URI
.
encode_www_form_component
(
user
.
password
),
'{email}'
=>
URI
.
encode_www_form_component
(
user
.
email
)
url
=
server
.
register
.
gsub
/\{key\}|\{id\}|\{name\}|\{password\}|\{email\}/
,
'{key}'
=>
URI
.
encode_www_form_component
(
server
.
key
),
'{id}'
=>
URI
.
encode_www_form_component
(
user
.
id
),
'{name}'
=>
URI
.
encode_www_form_component
(
user
.
name
),
'{password}'
=>
URI
.
encode_www_form_component
(
user
.
password
),
'{email}'
=>
URI
.
encode_www_form_component
(
user
.
email
)
open
(
url
){
|
f
|
out
<<
"
\t
"
+
f
.
read
}
rescue
p
$!
open
(
url
,
server
.
server_type
==
'ygopro'
?
'r:GBK'
:
'r'
){
|
f
|
out
<<
"
\t
"
+
f
.
read
.
encode
(
"UTF-8"
,
:undef
=>
:replace
,
:invalid
=>
:replace
)
}
rescue
p
$!
end
end
print
out
+
"
\n
"
print
out
+
"
\n
"
end
end
...
...
app/controllers/rooms_controller.rb
View file @
32987f78
#encoding: UTF-8
#encoding: UTF-8
class
RoomsController
<
ApplicationController
class
RoomsController
<
ApplicationController
require
'open-uri'
require
'open-uri'
layout
'losses'
layout
'losses'
def
index
def
index
@rooms
=
[]
@rooms
=
[]
@actions
=
[
"在线大厅"
]
@actions
=
[
"在线大厅"
]
respond_to
do
|
format
|
respond_to
do
|
format
|
format
.
html
# index.html.erb
format
.
html
# index.html.erb
format
.
json
do
format
.
json
do
Server
.
all
.
each_with_index
do
|
server
,
index
|
if
params
[
:server_id
]
open
(
"http://
#{
server
.
ip
}
:
#{
server
.
http_port
}
/?operation=getroomjson"
,
'r:GBK'
)
do
|
file
|
servers
=
Server
.
where
(
id:
params
[
:server_id
])
JSON
.
parse
(
file
.
read
.
encode
(
"UTF-8"
))[
"rooms"
].
each
do
|
r
|
else
room
=
{
id:
(
'A'
.
ord
+
index
).
chr
+
r
[
"roomid"
],
name:
r
[
"roomname"
],
status:
r
[
"istart"
].
to_sym
,
users:
[]}
servers
=
Server
.
where
(
server_type:
"ygopro"
)
r
[
"users"
].
each
do
|
u
|
end
if
u
[
"id"
]
==
"0"
servers
.
each_with_index
do
|
server
,
index
|
user
=
{
player:
u
[
"pos"
].
to_i
%
2
+
1
,
id:
0
,
name:
u
[
"name"
],
certified:
false
}
open
(
"
#{
server
.
index
}
/?operation=getroomjsondelphi"
)
do
|
file
|
else
JSON
.
parse
(
file
.
read
)[
"rooms"
].
each
do
|
r
|
user
=
User
.
find_by_name
(
u
[
"name"
])
room
=
{
id:
(
'A'
.
ord
+
index
).
chr
+
r
[
"roomid"
],
name:
decode
(
r
[
"roomname"
]),
status:
r
[
"istart"
].
to_sym
,
users:
[]}
user
=
{
player:
u
[
"pos"
].
to_i
%
2
+
1
,
id:
user
?
user
.
id
:
0
,
name:
u
[
"name"
],
certified:
true
}
r
[
"users"
].
each
do
|
u
|
end
if
u
[
"id"
]
==
"0"
room
[
:users
]
<<
user
user
=
{
player:
u
[
"pos"
].
to_i
%
2
+
1
,
id:
0
,
name:
decode
(
u
[
"name"
]),
certified:
false
}
end
else
@rooms
<<
room
user
=
User
.
find_by_name
(
u
[
"name"
])
end
user
=
{
player:
u
[
"pos"
].
to_i
%
2
+
1
,
id:
user
?
user
.
id
:
0
,
name:
decode
(
u
[
"name"
]),
certified:
true
}
end
end
end
room
[
:users
]
<<
user
render
json:
@rooms
end
end
@rooms
<<
room
end
end
end
end
end
end
render
json:
@rooms
end
end
end
private
def
decode
(
str
)
[
str
].
pack
(
'H*'
).
force_encoding
(
"UTF-16BE"
).
encode
(
"UTF-8"
,
:undef
=>
:replace
,
:invalid
=>
:replace
)
end
end
app/controllers/servers_controller.rb
View file @
32987f78
...
@@ -2,7 +2,12 @@ class ServersController < ApplicationController
...
@@ -2,7 +2,12 @@ class ServersController < ApplicationController
# GET /servers
# GET /servers
# GET /servers.json
# GET /servers.json
def
index
def
index
@servers
=
Server
.
all
if
params
[
:server_type
]
@servers
=
Server
.
where
(
server_type:
params
[
:server_type
])
else
@servers
=
Server
.
all
end
respond_to
do
|
format
|
respond_to
do
|
format
|
format
.
html
# index.html.erb
format
.
html
# index.html.erb
...
...
app/controllers/users_controller.rb
View file @
32987f78
...
@@ -70,7 +70,7 @@ class UsersController < ApplicationController
...
@@ -70,7 +70,7 @@ class UsersController < ApplicationController
if
!
@user
.
errors
.
any?
and
@user
.
save
if
!
@user
.
errors
.
any?
and
@user
.
save
remote_register
(
@user
,
@from
)
remote_register
(
@user
,
@from
)
session
[
:user_id
]
=
@user
.
id
session
[
:user_id
]
=
@user
.
id
format
.
html
{
redirect_to
(
params
[
:continue
].
blank?
?
@user
:
URI
.
escape
(
params
[
:continue
]
),
:notice
=>
'注册成功'
)
}
format
.
html
{
redirect_to
(
params
[
:continue
].
blank?
?
@user
:
params
[
:continue
].
gsub
(
/\{name\}|\{password\}/
,
'{name}'
=>
URI
.
encode_www_form_component
(
@user
.
name
),
'{password}'
=>
URI
.
encode_www_form_component
(
@user
.
password
)
),
:notice
=>
'注册成功'
)
}
format
.
xml
{
render
:xml
=>
@user
,
:status
=>
:created
,
:location
=>
@user
}
format
.
xml
{
render
:xml
=>
@user
,
:status
=>
:created
,
:location
=>
@user
}
else
else
format
.
html
{
render
:action
=>
"new"
}
format
.
html
{
render
:action
=>
"new"
}
...
@@ -139,7 +139,7 @@ class UsersController < ApplicationController
...
@@ -139,7 +139,7 @@ class UsersController < ApplicationController
session
[
:user_id
]
=
@user
.
id
session
[
:user_id
]
=
@user
.
id
@user
.
update_attribute
(
:lastloginip
,
request
.
remote_ip
)
@user
.
update_attribute
(
:lastloginip
,
request
.
remote_ip
)
remote_register
(
@user
)
remote_register
(
@user
)
format
.
html
{
redirect_to
(
params
[
:continue
].
blank?
?
@user
:
URI
.
escape
(
params
[
:continue
]
),
:notice
=>
'Login Successfully.'
)
}
format
.
html
{
redirect_to
(
params
[
:continue
].
blank?
?
@user
:
params
[
:continue
].
gsub
(
/\{name\}|\{password\}/
,
'{name}'
=>
URI
.
encode_www_form_component
(
@user
.
name
),
'{password}'
=>
URI
.
encode_www_form_component
(
@user
.
password
)
),
:notice
=>
'Login Successfully.'
)
}
format
.
json
{
render
json:
@user
}
format
.
json
{
render
json:
@user
}
else
else
@user
=
User
.
new
(
params
[
:user
])
@user
=
User
.
new
(
params
[
:user
])
...
...
app/views/boards/index.html.erb
View file @
32987f78
<div
id=
"wrap"
class=
"wrap s_clear"
>
<style>
<div
class=
"itemtitle s_clear"
>
.topic
{
<p
class=
"right boardcount"
>
float
:
left
;
<%=
t
'datetime.today'
%>
:
<em>
<%=
Post
.
today
.
count
%>
</em>
,
width
:
190px
;
<%=
t
'datetime.yesterday'
%>
:
<em>
<%=
Post
.
yesterday
.
count
%>
</em>
,
margin
:
2px
;
<%=
t
'stat.total'
%>
:
<em>
<%=
Post
.
count
%>
</em>
}
</p>
</div>
.posttop
{
<%=
render
@boards
%>
height
:
146px
;
overflow
:
hidden
;
<div
class=
"mainbox list"
>
}
<span
class=
"headactions"
>
<%=
image_tag
'common/collapsed_no.gif'
%>
</span>
<h3>
<%=
link_to
t
(
'forum.link'
),
links_path
%>
</h3>
.first
{
<div
id=
"forumlinks"
>
height
:
92px
;
<!--<div class="forumlinks">
}
<ul class="s_clear"><li><div class="forumlogo"><img src="http://www.touhou.cc/logo.gif" border="0" alt="东方幻想乡"></div><div class="forumcontent"><h5><a href="http://www.touhou.cc/bbs" target="_blank">东方幻想乡</a></h5><p>这里是幻想乡,一片充满生机和幸福的乐土.</p></div></li></ul>
</div>-->
<!--详细-->
.last
{
<div
class=
"forumimglink"
>
height
:
54px
;
<%=
render
@links
%>
}
</div>
<!--<div class="forumtxtlink">
.name
{
<ul class="s_clear">
//如何设置单行
<li><a href="http://www.sakuracountry.cn/" target="_blank" title="樱之国度">樱之国度</a></li><li><a href="http://www.awawh.com/bbs/" target="_blank" title="聚合网">聚合网</a></li><li><a href="http://www.thactclub.cn/bbs" target="_blank" title="TAC触手乡">TAC触手乡</a></li><li><a href="http://www.bilibili.us/" target="_blank" title="哔哩哔哩">哔哩哔哩</a></li><li><a href="http://www.moeloli.cn" target="_blank" title="萝莉学园">萝莉学园</a></li><li><a href="http://www.0ymt.net/" target="_blank" title="零乐漫坛">零乐漫坛</a></li><li><a href="http://www.fulifuli.org/" target="_blank" title="炮姐大逃杀">炮姐大逃杀</a></li><li><a href="http://www.hgacg.com/" target="_blank" title="后宫动漫论坛">后宫动漫论坛</a></li><li><a href="http://www.lv8n.com" target="_blank" title="中国本土同人联盟">中国本土同人联盟</a></li><li><a href="http://bbs.u17.com/" target="_blank" title="有妖气漫画论坛">有妖气漫画论坛</a></li><li><a href="http://www.touhou.cc/bbs/plugin.php?id=xh_forumlinks:forumlinks" target="_blank" title="点击申请">点击申请</a></li></ul>
}
</div>--><!--文字-->
</div>
#stat
{
</div>
float
:
right
;
clear
:
both
;
<div
class=
"mainbox list"
id=
"online"
>
}
<span
class=
"headactions"
><a
href=
"index.php?showoldetails=yes#online"
class=
"nobdr"
>
<%=
image_tag
'common/collapsed_yes.gif'
%>
</a></span>
.first
{
<h3>
overflow
:
hidden
;
<%=
render
'entries/onlineuser'
%>
}
</h3>
</div>
.topics
{
</div>
overflow
:
hidden
;
}
.avatar_small
{
float
:
left
;
}
</style>
<div
id=
"wrap"
class=
"wrap s_clear"
>
<div
id=
"stat"
>
<%=
t
'datetime.today'
%>
:
<em>
<%=
Post
.
today
.
count
%>
</em>
,
<%=
t
'datetime.yesterday'
%>
:
<em>
<%=
Post
.
yesterday
.
count
%>
</em>
,
<%=
t
'stat.total'
%>
:
<em>
<%=
Post
.
count
%>
</em>
</div>
<div>
最新帖子
</div>
<div
id=
"stream"
>
<ul
id=
"topics"
>
<%
Post
.
group
(
:topic_id
).
order
(
:created_at
).
reverse_order
.
limit
(
5
).
includes
(
:topic
).
each
do
|
post
|
%>
<li
class=
"topic"
>
<%
last_post
=
post
.
topic
.
posts
.
order
(
:id
).
last
%>
<div
class=
"post
<%=
' first'
if
last_post
!=
post
%>
"
>
<div
class=
"posttop"
>
<%=
image_tag
post
.
user
.
avatar
.
url
(
:small
),
width:
48
,
height:
48
,
class:
"avatar_small"
%>
<div>
<span
class=
"name"
>
<%=
link_to
post
.
topic
.
name
,
post
.
topic
%>
</span>
</div>
<div>
<span>
<%=
link_to
post
.
user
.
name
,
post
.
user
%>
</span>
<span>
<%=
distance_of_time_in_words_to_now
post
.
created_at
%>
<%=
t
'ago'
%>
</span>
</div>
<%=
post
.
content
%>
</div>
<div
class=
"postbottom"
>
</div>
</div>
<%
if
last_post
!=
post
%>
<%
post
=
last_post
%>
<div
class=
"post last"
>
<div
class=
"posttop last"
>
<%=
image_tag
post
.
user
.
avatar
.
url
(
:small
),
width:
48
,
height:
48
,
class:
"avatar_small"
%>
<div>
<span>
<%=
link_to
post
.
user
.
name
,
post
.
user
%>
</span>
<span>
<%=
distance_of_time_in_words_to_now
post
.
created_at
%>
<%=
t
'ago'
%>
</span>
</div>
<%=
post
.
content
%>
</div>
</div>
<%
end
%>
<span>
<%=
link_to
post
.
topic
.
category
.
name
,
post
.
topic
.
category
%>
</span>
<span>
回复:
<%=
post
.
topic
.
posts
.
count
%>
</span><span>
查看:
<%=
post
.
topic
.
viewnum
%>
</span>
</li>
<%
end
%>
</ul>
</div>
<div
class=
"itemtitle s_clear"
></div>
<%=
render
@boards
%>
<div
class=
"mainbox list"
>
<span
class=
"headactions"
>
<%=
image_tag
'common/collapsed_no.gif'
%>
</span>
<h3>
<%=
link_to
t
(
'forum.link'
),
links_path
%>
</h3>
<div
id=
"forumlinks"
>
<!--<div class="forumlinks">
<ul class="s_clear"><li><div class="forumlogo"><img src="http://www.touhou.cc/logo.gif" border="0" alt="东方幻想乡"></div><div class="forumcontent"><h5><a href="http://www.touhou.cc/bbs" target="_blank">东方幻想乡</a></h5><p>这里是幻想乡,一片充满生机和幸福的乐土.</p></div></li></ul>
</div>-->
<!--详细-->
<div
class=
"forumimglink"
>
<%=
render
@links
%>
</div>
<!--<div class="forumtxtlink">
<ul class="s_clear">
<li><a href="http://www.sakuracountry.cn/" target="_blank" title="樱之国度">樱之国度</a></li><li><a href="http://www.awawh.com/bbs/" target="_blank" title="聚合网">聚合网</a></li><li><a href="http://www.thactclub.cn/bbs" target="_blank" title="TAC触手乡">TAC触手乡</a></li><li><a href="http://www.bilibili.us/" target="_blank" title="哔哩哔哩">哔哩哔哩</a></li><li><a href="http://www.moeloli.cn" target="_blank" title="萝莉学园">萝莉学园</a></li><li><a href="http://www.0ymt.net/" target="_blank" title="零乐漫坛">零乐漫坛</a></li><li><a href="http://www.fulifuli.org/" target="_blank" title="炮姐大逃杀">炮姐大逃杀</a></li><li><a href="http://www.hgacg.com/" target="_blank" title="后宫动漫论坛">后宫动漫论坛</a></li><li><a href="http://www.lv8n.com" target="_blank" title="中国本土同人联盟">中国本土同人联盟</a></li><li><a href="http://bbs.u17.com/" target="_blank" title="有妖气漫画论坛">有妖气漫画论坛</a></li><li><a href="http://www.touhou.cc/bbs/plugin.php?id=xh_forumlinks:forumlinks" target="_blank" title="点击申请">点击申请</a></li></ul>
</div>--><!--文字-->
</div>
</div>
<div
class=
"mainbox list"
id=
"online"
>
<span
class=
"headactions"
><a
href=
"index.php?showoldetails=yes#online"
class=
"nobdr"
>
<%=
image_tag
'common/collapsed_yes.gif'
%>
</a></span>
<h3>
<%=
render
'entries/onlineuser'
%>
</h3>
</div>
</div>
app/views/users/new.html.erb
View file @
32987f78
This diff is collapsed.
Click to expand it.
config/locales/zh-CN.yml
View file @
32987f78
...
@@ -397,4 +397,5 @@ zh-CN:
...
@@ -397,4 +397,5 @@ zh-CN:
anonymous
:
"
匿名发帖"
anonymous
:
"
匿名发帖"
tournament
:
tournament
:
location
:
location
:
qun
:
"
QQ群"
qun
:
"
QQ群"
\ No newline at end of file
ago
:
"
前"
\ No newline at end of file
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment