diff --git a/r2/r2/controllers/api.py b/r2/r2/controllers/api.py
index 3262a1fe3..255f29ca7 100644
--- a/r2/r2/controllers/api.py
+++ b/r2/r2/controllers/api.py
@@ -260,9 +260,18 @@ class ApiController(RedditController):
form.redirect(path)
- @validatedForm(VUser(),
- url = VSanitizedUrl(['url']))
+ @validatedForm(VRatelimit(rate_ip = True,
+ rate_user = True,
+ prefix = 'fetchtitle_'),
+ VUser(),
+ url = VSanitizedUrl(['url']))
def POST_fetch_title(self, form, jquery, url):
+ if form.has_errors('ratelimit', errors.RATELIMIT):
+ form.set_html(".title-status", "");
+ return
+
+ VRatelimit.ratelimit(rate_ip = True, rate_user = True,
+ prefix = 'fetchtitle_', seconds=1)
if url:
title = get_title(url)
if title:
diff --git a/r2/r2/controllers/toolbar.py b/r2/r2/controllers/toolbar.py
index 33a668b0a..c8a116fdd 100644
--- a/r2/r2/controllers/toolbar.py
+++ b/r2/r2/controllers/toolbar.py
@@ -73,12 +73,6 @@ def auto_expand_panel(link):
else:
return c.user.pref_frame_commentspanel
-@memoize('toolbar.get_title', time = 500)
-def get_title(url):
- """Find the
in the page contained at 'url'. Copied here
- from utils so that we can memoize it"""
- return utils.get_title(url)
-
class ToolbarController(RedditController):
@validate(link1 = VByName('id'),
link2 = VLink('id', redirect = False))
@@ -139,9 +133,7 @@ class ToolbarController(RedditController):
# link-id-based URL so that their URL is reusable
return self.redirect(add_sr("/tb/" + link._id36))
- title = get_title(path)
- if not title:
- title = utils.domain(path)
+ title = utils.domain(path)
res = Frame(title = title, url = path)
# we don't want clients to think that this URL is actually a
@@ -213,7 +205,7 @@ class ToolbarController(RedditController):
expanded = auto_expand_panel(link))
else:
res = FrameToolbar(link = None,
- title = get_title(url),
+ title = None,
url = url,
expanded = False)
diff --git a/r2/r2/public/static/css/reddit.css b/r2/r2/public/static/css/reddit.css
index 1f6a103d2..6a9df2d6f 100644
--- a/r2/r2/public/static/css/reddit.css
+++ b/r2/r2/public/static/css/reddit.css
@@ -743,7 +743,7 @@ a.star { text-decoration: none; color: #ff8b60 }
/* compressed links */
.linkcompressed { margin: 4px 0; overflow: hidden; margin-top: 8px; }
-.linkcompressed .title {margin-bottom: 4px; font-size:medium; font-weight: normal;}
+.linkcompressed .title {margin-bottom: 5px; font-size:medium; font-weight: normal;}
.linkcompressed .child h3 {
margin: 15px;
text-transform: none;
@@ -772,7 +772,7 @@ a.star { text-decoration: none; color: #ff8b60 }
.linkcompressed .entry .buttons li.first {padding-left: .5em;}
.linkcompressed .entry .buttons li a {
padding: 0 2px;
- background-color: #fafafa;
+ background-color: #fbfbfb;
font-weight: bold
}
diff --git a/r2/r2/templates/frame.html b/r2/r2/templates/frame.html
index 04f914d8d..fc3403123 100644
--- a/r2/r2/templates/frame.html
+++ b/r2/r2/templates/frame.html
@@ -30,7 +30,14 @@
${thing.title}
-