User: Gravatar stuff & more bugs

master
E. Almqvist 3 years ago
parent 5dd0f5af1c
commit 30ac747373
  1. 1
      src/Gemfile
  2. 2
      src/Gemfile.lock
  3. 3
      src/app.rb
  4. 9
      src/db_models.rb
  5. 1
      src/func.rb
  6. 2
      src/misc/subtitles.txt
  7. 2
      src/views/layout.slim
  8. 21
      src/views/stylesheets/style.sass

@ -13,3 +13,4 @@ gem "slim"
gem "sassc"
gem "colorize"
gem "bcrypt"
gem "gravatar"

@ -4,6 +4,7 @@ GEM
bcrypt (3.1.16)
colorize (0.8.1)
ffi (1.15.5)
gravatar (1.0)
multi_json (1.15.0)
mustermann (1.1.1)
ruby2_keywords (>= 0.0.1)
@ -39,6 +40,7 @@ PLATFORMS
DEPENDENCIES
bcrypt
colorize
gravatar
sassc
sinatra
sinatra-reloader

@ -9,6 +9,7 @@ require "sqlite3"
require "sassc"
require "colorize"
require "bcrypt"
require "gravatar"
require_relative "config.rb"
require_relative "debug.rb"
@ -69,7 +70,7 @@ post "/login" do
session[:error_msg] = ret
redirect "/login"
else
session[:user] = User.new(ret)
session[:user] = User.new ret
redirect "/"
end
end

@ -12,6 +12,15 @@ class User < EntityModel
@reputation = user_info["reputation"]
end
def self.get_avatar
gravatar = Gravatar.src @email
if gravatar then
return gravatar
else
return @avatar_url
end
end
# Find user by ID, returns multiple results if multiple IDs exist
# (which wont happen since IDs are unique)
def self.find_by_id(id)

@ -12,4 +12,3 @@ end
def serve(template, info={})
slim( template, locals: {info: init_info(info)} )
end

@ -1,6 +1,6 @@
V2FpdCwgbW9uZXkgaGFzIG5vIHZhbHVlPyEK
No such place like 127.0.0.1!
Fourty-two? That's not much for an answer...
Fourty-two...
I would just like to interject for a moment...
68747470733a2f2f777963682e6465762f6369706865722e747874
CSRF? No, I do not think so.

@ -22,7 +22,7 @@ html lang="en"
- else
li
a href="/profile" target="_self"
img.avatar src=session[:user].avatar_url alt="Your avatar"
img.avatar src="#{session[:user].get_avatar}" alt="Your avatar"
.content-container
==yield

@ -3,6 +3,7 @@
$font_stack: "Space Mono", monospace
$bg_clr: #272a34
$bg_alt_clr: #232730
$bg_dark_clr: #21242e
$fg_clr: #fff
$fg_alt_clr: #eee
$fg_error: #f77
@ -34,14 +35,15 @@ body
height: 100%
header
background-color: $bg_clr
// border-bottom: 1px solid $shadow_clr
padding: .1rem .8rem .4rem .8rem
height: 55px
background-color: $bg_dark_clr
//border-bottom: 1px solid $shadow_clr
padding: .1rem .8rem .1rem .8rem
white-space: nowrap
div
display: flex
max-width: 80rem
max-width: 70rem
margin: 0 auto
#logo_container
@ -54,11 +56,10 @@ body
h1
margin: 0
opacity: .8
font-size: 2rem
font-size: 1.2rem
font-weight: bold
h2
padding-left: 6px
margin: 0
opacity: .2
font-size: .8rem
@ -69,7 +70,8 @@ body
display: flex
align-items: center
margin: 0 0 0 auto
padding: 8px
padding: 8px
padding-right: 0
ul
margin: 0
@ -102,8 +104,9 @@ label.error_msg
font-weight: bold
img.avatar
width: 3.4rem
height: 3.4rem
background: $shadow_clr
width: 2.15rem
height: auto
border-radius: 50%
border: 2px solid $shadow_clr
transition: border .2s

Loading…
Cancel
Save