Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Crystal next support #358

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion shard.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ authors:
- Nick Franken <<[email protected]>>
- Benoit de Chezelles <<[email protected]>>

crystal: 0.23.1
crystal: 0.24.0

license: MIT

Expand Down
2 changes: 1 addition & 1 deletion src/amber.cr
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ require "http"
require "logger"
require "json"
require "colorize"
require "secure_random"
require "random/secure"
require "kilt"
require "kilt/slang"
require "redis"
Expand Down
2 changes: 1 addition & 1 deletion src/amber/cli/commands/run.cr
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ module Amber::CLI
puts colorize("💎 Crystalization complete!", :dark_gray)
Process.run(
"PORT=#{options.p} AMBER_ENV=#{options.e} ./app",
shell: true, output: true, error: true
shell: true, output: Process::Redirect::Inherit, error: Process::Redirect::Inherit
)
end
end
Expand Down
2 changes: 1 addition & 1 deletion src/amber/cli/templates/app/.amber_secret_key.ecr
Original file line number Diff line number Diff line change
@@ -1 +1 @@
<%= SecureRandom.urlsafe_base64(32) %>
<%= Random::Secure.urlsafe_base64(32) %>
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
secret_key_base: <%= SecureRandom.urlsafe_base64(32) %>
secret_key_base: <%= Random::Secure.urlsafe_base64(32) %>
port: 3000
name: <%= @name %>
log: "::Logger.new(STDOUT)"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
secret_key_base: <%= SecureRandom.urlsafe_base64(32) %>
secret_key_base: <%= Random::Secure.urlsafe_base64(32) %>
port: 80
name: <%= @name %>
log: "::Logger.new(STDOUT)"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
secret_key_base: <%= SecureRandom.urlsafe_base64(32) %>
secret_key_base: <%= Random::Secure.urlsafe_base64(32) %>
port: 3000
name: <%= @name %>
log: "::Logger.new(STDOUT)"
Expand Down
2 changes: 1 addition & 1 deletion src/amber/cli/templates/template.cr
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
require "teeplate"
require "secure_random"
require "random/secure"
require "./helpers.cr"
require "./app"
require "./migration"
Expand Down
2 changes: 1 addition & 1 deletion src/amber/router/cookies.cr
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ module Amber::Router
property host : String?
property secure : Bool = false

def initialize(@host = nil, @secret = SecureRandom.urlsafe_base64(32), @secure = false)
def initialize(@host = nil, @secret = Random::Secure.urlsafe_base64(32), @secure = false)
@cookies = {} of String => String
@set_cookies = {} of String => HTTP::Cookie
@delete_cookies = {} of String => HTTP::Cookie
Expand Down
4 changes: 2 additions & 2 deletions src/amber/router/pipe/csrf.cr
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
require "secure_random"
require "random/secure"

module Amber
module Pipe
Expand Down Expand Up @@ -27,7 +27,7 @@ module Amber
end

def self.token(context)
context.session[CSRF_KEY] ||= SecureRandom.urlsafe_base64(32)
context.session[CSRF_KEY] ||= Random::Secure.urlsafe_base64(32)
end

def self.tag(context)
Expand Down
2 changes: 1 addition & 1 deletion src/amber/router/pipe/static.cr
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ module Amber
end
elsif request_headers.includes_word?("Accept-Encoding", "deflate") && config.is_a?(Hash) && config["gzip"]? == true && filesize > minsize && Support::MimeTypes.zip_types(file_path)
env.response.headers["Content-Encoding"] = "deflate"
Flate::Writer.new(env.response) do |deflate|
Flate::Writer.open(env.response) do |deflate|
IO.copy(file, deflate)
end
else
Expand Down
2 changes: 1 addition & 1 deletion src/amber/router/session/cookie_store.cr
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ module Amber::Router::Session
end

def id
session["id"] ||= SecureRandom.uuid
session["id"] ||= Random::Secure.uuid
end

def changed?
Expand Down
2 changes: 1 addition & 1 deletion src/amber/router/session/redis_store.cr
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ module Amber::Router::Session
end

def id
@id ||= SecureRandom.uuid
@id ||= Random::Secure.uuid
end

def changed?
Expand Down
4 changes: 2 additions & 2 deletions src/amber/scripts/environment_loader.cr
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
require "yaml"
require "secure_random"
require "random/secure"
require "../support/message_encryptor"

environment = ARGV[0]? || ENV["AMBER_ENV"]? || "development"
Expand Down Expand Up @@ -43,7 +43,7 @@ str = String.build do |s|
s.puts %(@@redis_url = "#{settings["redis_url"]? || "redis://localhost:6379"}")
s.puts %(@@port = #{settings["port"]? || 3000})
s.puts %(@@host = "#{settings["host"]? || "127.0.0.1"}")
s.puts %(@@secret_key_base = "#{settings["secret_key_base"]? || SecureRandom.urlsafe_base64(32)}")
s.puts %(@@secret_key_base = "#{settings["secret_key_base"]? || Random::Secure.urlsafe_base64(32)}")

unless settings["ssl_key_file"]?.to_s.empty?
s.puts %(@@ssl_key_file = "#{settings["ssl_key_file"]?}")
Expand Down
2 changes: 1 addition & 1 deletion src/amber/websockets/client_socket.cr
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ module Amber
end

def initialize(@socket, @context)
@id = SecureRandom.uuid
@id = Random::Secure.uuid
@subscription_manager = SubscriptionManager.new
@raw_params = @context.params
@params = Amber::Validators::Params.new(@raw_params)
Expand Down