From d465d8925f932fb17300f6b4354cc67b0472ff64 Mon Sep 17 00:00:00 2001 From: Adrian Salceanu Date: Thu, 2 Apr 2020 19:46:52 +0200 Subject: [PATCH] bug fixes --- src/Generator.jl | 12 +++++++++++- src/genie_module.jl | 14 +++++++++----- src/renderers/Html.jl | 2 +- 3 files changed, 21 insertions(+), 7 deletions(-) diff --git a/src/Generator.jl b/src/Generator.jl index 38aa50c1c..947d13dcd 100755 --- a/src/Generator.jl +++ b/src/Generator.jl @@ -396,7 +396,17 @@ function newapp(path::String = "."; autostart::Bool = true, fullstack::Bool = fa write_app_custom_files(path, app_path) - Sys.iswindows() ? setup_windows_bin_files(app_path) : setup_nix_bin_files(app_path) + try + setup_windows_bin_files(app_path) + catch ex + @error ex + end + + try + setup_nix_bin_files(app_path) + catch ex + @error ex + end @info "Done! New app created at $(abspath(path))" diff --git a/src/genie_module.jl b/src/genie_module.jl index 168908270..dd738e5f7 100644 --- a/src/genie_module.jl +++ b/src/genie_module.jl @@ -213,14 +213,18 @@ function secret_token(; context::Union{Module,Nothing} = nothing) :: String if isdefined(context, :SECRET_TOKEN) && ! isempty(context.SECRET_TOKEN) context.SECRET_TOKEN else - @warn "SECRET_TOKEN not configured - please make sure that you have a valid secrets.jl file. + @warn " + SECRET_TOKEN not configured - please make sure that you have a valid secrets.jl file. You can generate a new secrets.jl file with a random SECRET_TOKEN using Genie.Generator.write_secrets_file() - or use the included /app/config/secrets.jl.example file as a model." + or use the included /app/config/secrets.jl.example file as a model. - st = Generator.secret_token() - Core.eval(@__MODULE__, Meta.parse("""const SECRET_TOKEN = "$st" """)) + SECRET_TOKEN is used for hashing and encrypting/decrypting sensitive data in Genie. + I'm now setting up a random SECRET_TOKEN which will be used for this session only. + Data that is encoded with this SECRET_TOKEN will potentially be lost + upon restarting the application (like for example the HTTP sessions data). + " - st + SECRET_TOKEN = Generator.secret_token() end end diff --git a/src/renderers/Html.jl b/src/renderers/Html.jl index 9e6777e5e..f3a90ce00 100644 --- a/src/renderers/Html.jl +++ b/src/renderers/Html.jl @@ -96,7 +96,7 @@ function normal_element(_::Nothing, __::Any) :: HTMLString "" end function normal_element(children::Vector{T} where T, elem::Any, args::Vector{T} where T) :: HTMLString - normal_element(join([f() for f in children]), elem, args) + normal_element(join([(isa(f, Function) ? f() : string(f)) for f in children]), elem, args) end