Skip to content

Commit

Permalink
Update: Update 0.8.3
Browse files Browse the repository at this point in the history
  • Loading branch information
sevenc-nanashi committed Jun 29, 2024
1 parent c0a2b00 commit acc52db
Show file tree
Hide file tree
Showing 6 changed files with 34 additions and 12 deletions.
24 changes: 18 additions & 6 deletions backend/app/controllers/sonolus/asset_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -53,9 +53,13 @@ def show
name += ".#{params[:format]}" if params[:format].present?
item = Sonolus::AssetController.asset_get(type.delete_suffix("s"), name)
if item.nil?
render json: { error: "not_found", message: "Not Found" }, status: :not_found
render json: {
error: "not_found",
message: "Not Found"
},
status: :not_found
else
render json: { item:, description: "", sections: [] }
render json: { item:, description: "", leaderboards: [], sections: [] }
end
end

Expand All @@ -72,7 +76,11 @@ def generate
chart = Chart.find_by(name: params[:chart])
if chart.nil?
return(
render json: { code: "not_found", message: "Not Found" }, status: :not_found
render json: {
code: "not_found",
message: "Not Found"
},
status: :not_found
)
end
type = params[:type].to_sym
Expand Down Expand Up @@ -142,9 +150,9 @@ def generate

50.times do
if FileResource.exists?(chart_id: chart.id, kind: type) ||
$redis.with do |conn|
$redis.with { |conn|
conn.get("sonolus:generate:#{chart.id}:#{type}").nil?
end
}
break
end

Expand All @@ -161,7 +169,11 @@ def generate
allow_other_host: true
else
Rails.logger.info("Failed to generate #{type} for #{chart.name}")
render json: { code: "not_found", message: "Not Found" }, status: :not_found
render json: {
code: "not_found",
message: "Not Found"
},
status: :not_found
end
end
end
Expand Down
12 changes: 10 additions & 2 deletions backend/app/controllers/sonolus/info_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,16 @@ def info
render json: {
title:,
banner: banner("banner"),
hasMultiplayer: false,
hasAuthentication: true,
buttons: [
{ type: "authentication" },
{ type: "level" },
{ type: "replay" },
{ type: "skin" },
{ type: "background" },
{ type: "effect" },
{ type: "particle" },
{ type: "engine" }
],
description:
}
end
Expand Down
2 changes: 2 additions & 0 deletions backend/app/controllers/sonolus/levels_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -351,6 +351,7 @@ def show
render json: {
item: chart.to_sonolus,
hasCommunity: true,
leaderboards: [],
sections:
[
{
Expand Down Expand Up @@ -473,6 +474,7 @@ def background
chart.resources,
version: version_num
),
leaderboards: [],
description: "",
sections: [
{
Expand Down
2 changes: 1 addition & 1 deletion backend/app/controllers/sonolus_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -308,7 +308,7 @@ def authenticate
}
end

after_action { headers["Sonolus-Version"] = "0.8.2" }
after_action { headers["Sonolus-Version"] = "0.8.3" }

around_action do |_controller, action|
success = false
Expand Down
4 changes: 2 additions & 2 deletions backend/config/routes.rb
Original file line number Diff line number Diff line change
Expand Up @@ -66,8 +66,8 @@
get "/levels/chcy-sys-like-on-:name", to: "sonolus/like#to_on"
get "/levels/chcy-sys-like-off-:name", to: "sonolus/like#to_off"
get "/levels/chcy-:name", to: "sonolus/levels#show"
get "/levels/chcy-:name/community", to: "sonolus/levels#community"
post "/levels/chcy-:name/community", to: "sonolus/levels#post_community"
get "/levels/chcy-:name/community/info", to: "sonolus/levels#community"
post "/levels/chcy-:name/community/submit", to: "sonolus/levels#post_community"
post "/authenticate", to: "sonolus#authenticate"

scope "/assets" do
Expand Down
2 changes: 1 addition & 1 deletion docker-compose.dev.yml
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ services:
- prod

postgres:
image: postgres:latest
image: postgres:15
environment:
POSTGRES_USER: ${POSTGRES_USER}
POSTGRES_PASSWORD: ${POSTGRES_PASSWORD}
Expand Down

0 comments on commit acc52db

Please sign in to comment.