Finish the API endpoint for cover upload

This commit is contained in:
Alex Ling
2020-04-08 07:01:06 +00:00
parent fcf9d39047
commit 8262a163db
13 changed files with 268 additions and 73 deletions

View File

@@ -2,6 +2,7 @@ require "sqlite3"
require "crypto/bcrypt"
require "uuid"
require "base64"
require "./util"
def hash_password(pw)
Crypto::Bcrypt::Password.create(pw).to_s
@@ -11,10 +12,6 @@ def verify_password(hash, pw)
(Crypto::Bcrypt::Password.new hash).verify pw
end
def random_str
UUID.random.to_s.gsub "-", ""
end
class Storage
def initialize(@path : String, @logger : Logger)
dir = File.dirname path