'.' to expand new entries, allow bare domain in url fields

This commit is contained in:
Kyle Mahan 2015-07-30 04:26:21 +00:00
parent b4e907912c
commit 1956a59bb0
10 changed files with 1552 additions and 31 deletions

View file

@ -12,6 +12,6 @@ chmod-socket=666
module=woodwind.wsgi module=woodwind.wsgi
import=timers import=timers
attach-daemon=venv/bin/rqworker high #attach-daemon=venv/bin/rqworker high
attach-daemon=venv/bin/rqworker high low attach-daemon=venv/bin/rqworker high low
attach-daemon=venv/bin/python -m woodwind.websocket_server attach-daemon=venv/bin/python -m woodwind.websocket_server

1478
woodwind/static/cassis.js Normal file

File diff suppressed because one or more lines are too long

View file

@ -69,7 +69,6 @@ $(function(){
$(".show-like-form").off('click').click(clickShowLikeForm); $(".show-like-form").off('click').click(clickShowLikeForm);
$(".micropub-form button[type='submit']").off('click').click(submitMicropubForm); $(".micropub-form button[type='submit']").off('click').click(submitMicropubForm);
$(".micropub-form .content").focus(function (){ $(".micropub-form .content").focus(function (){
$(this).animate({ height: "4em" }, 200); $(this).animate({ height: "4em" }, 200);
}); });
@ -111,9 +110,17 @@ $(function(){
} }
attachListeners(); attachListeners();
$(document).on("keypress", function(e) {
if (e.which === 46) {
clickUnfoldLink();
}
});
if (WS_TOPIC) { if (WS_TOPIC) {
webSocketSubscribe(WS_TOPIC); webSocketSubscribe(WS_TOPIC);
} }
updateTimestamps(); updateTimestamps();
window.setInterval(updateTimestamps, 60 * 1000); window.setInterval(updateTimestamps, 60 * 1000);

View file

@ -432,7 +432,8 @@ article {
article header { article header {
color: #484a47; color: #484a47;
border-bottom: 1px solid #687d77; border-bottom: 1px solid #687d77;
margin-bottom: 0.5em; } margin-bottom: 0.5em;
overflow: auto; }
article header img { article header img {
vertical-align: middle; vertical-align: middle;
margin: inherit; margin: inherit;

Binary file not shown.

After

Width:  |  Height:  |  Size: 726 B

View file

@ -11,7 +11,7 @@
<button type="submit" name="action" value="repost"><i class="fa fa-retweet"></i></button> <button type="submit" name="action" value="repost"><i class="fa fa-retweet"></i></button>
<button type="submit" name="action" value="like"><i class="fa fa-star"></i></button> <button type="submit" name="action" value="like"><i class="fa fa-star"></i></button>
</div> </div>
<div> <div class="syndication-toggles">
{% for target in current_user.get_setting('syndicate-to', []) %} {% for target in current_user.get_setting('syndicate-to', []) %}
<div class="syndication-toggle"> <div class="syndication-toggle">
<input id="sc-{{entry.id}}-{{loop.index}}" type="checkbox" name="syndicate-to[]" value="{{ target }}"/> <input id="sc-{{entry.id}}-{{loop.index}}" type="checkbox" name="syndicate-to[]" value="{{ target }}"/>

View file

@ -12,6 +12,8 @@
<link rel="stylesheet" href="//maxcdn.bootstrapcdn.com/font-awesome/4.3.0/css/font-awesome.min.css"/> <link rel="stylesheet" href="//maxcdn.bootstrapcdn.com/font-awesome/4.3.0/css/font-awesome.min.css"/>
<script src="//code.jquery.com/jquery-2.1.3.min.js"></script> <script src="//code.jquery.com/jquery-2.1.3.min.js"></script>
<script src="{{ url_for('static', filename='moment.min.js') }}"></script> <script src="{{ url_for('static', filename='moment.min.js') }}"></script>
<script src="{{ url_for('static', filename='cassis.js') }}"></script>
<link rel="stylesheet" href="//maxcdn.bootstrapcdn.com/font-awesome/4.3.0/css/font-awesome.min.css"> <link rel="stylesheet" href="//maxcdn.bootstrapcdn.com/font-awesome/4.3.0/css/font-awesome.min.css">
{% block head %}{% endblock %} {% block head %}{% endblock %}
@ -48,7 +50,7 @@
{% endif %} {% endif %}
{% if not current_user.is_authenticated() %} {% if not current_user.is_authenticated() %}
<form action="{{ url_for('.login') }}" method="POST"> <form action="{{ url_for('.login') }}" method="POST">
<input type="text" name="me" placeholder="mydomain.com" /> <input type="url" name="me" placeholder="https://yourdomain.com" />
<input type="hidden" name="next" placeholder="{{ request.path }}" /> <input type="hidden" name="next" placeholder="{{ request.path }}" />
<button style="text-align: right;" type="submit">Login</button> <button style="text-align: right;" type="submit">Login</button>
</form> </form>
@ -66,5 +68,29 @@
{% block body %}{% endblock %} {% block body %}{% endblock %}
</main> </main>
{% block foot %}{% endblock %} {% block foot %}{% endblock %}
<script>
$("input[type='url']").blur(function() {
if (this.value.trim() != '') {
this.value = web_address_to_uri(this.value, true);
}
});
$("input[type='url']").on("invalid", function() {
this.value = web_address_to_uri(this.value, true);
if (this.willValidate) {
this.setCustomValidity('');
this.parentNode.submit();
return false;
} else if (document.getElementById('error')) {
return;
} else {
$html = document.createElement("div");
$html.id = 'error';
$html.innerHTML = "Oops! looks like you didn't enter a URL. Try starting with http://";
this.parentNode.appendChild($html)
}
})
</script>
</body> </body>
</html> </html>

View file

@ -4,7 +4,7 @@
{% if ws_topic %} {% if ws_topic %}
<script>var WS_TOPIC = "{{ ws_topic }}";</script> <script>var WS_TOPIC = "{{ ws_topic }}";</script>
{% endif %} {% endif %}
<script src="{{url_for('static', filename='feed.js', version='2015-05-28')}}"></script> <script src="{{url_for('static', filename='feed.js', version='2015-07-13')}}"></script>
{% if current_user and current_user.settings {% if current_user and current_user.settings
and current_user.settings.get('reply-method') == 'indie-config' %} and current_user.settings.get('reply-method') == 'indie-config' %}
@ -49,4 +49,6 @@
</div> </div>
{% endif %} {% endif %}
<iframe style="display:none;" src="https://www.subtome.com/register-no-ui.html?name=Woodwind&amp;url=https%3A%2F%2Freader.kylewm.com%2Fsubscribe%3Forigin%3D%7Burl%7D"></iframe>
{% endblock body %} {% endblock body %}

View file

@ -1,12 +1,14 @@
{% extends "base.jinja2" %} {% extends "base.jinja2" %}
{% block body %} {% block body %}
<main> <main>
{% set reply_method = settings.get('reply-method') %}
<form name="settings" action="{{ url_for('.settings') }}" method="POST"> <form id="settings" name="settings" action="{{ url_for('.settings') }}"
method="POST" data-reply-method="{{reply_method}}">
<button type="submit">Save Changes</button> <button type="submit">Save Changes</button>
<div id="reply-mechanism-settings"> <div id="reply-mechanism-settings">
{% set reply_method = settings.get('reply-method') %}
<h2>Reply Mechanism</h2> <h2>Reply Mechanism</h2>
<p> <p>
@ -66,6 +68,7 @@
</p> </p>
{% set selectedActions = settings.get('indie-config-actions', []) %} {% set selectedActions = settings.get('indie-config-actions', []) %}
<p>
{% for action in ['like', 'favorite', 'reply', 'repost', 'bookmark'] %} {% for action in ['like', 'favorite', 'reply', 'repost', 'bookmark'] %}
<label> <label>
<input type="checkbox" name="indie-config-action" value="{{ action }}" <input type="checkbox" name="indie-config-action" value="{{ action }}"
@ -91,6 +94,9 @@
</div> </div>
<button id="add-action">Add</button> <button id="add-action">Add</button>
</div>
<button type="submit">Save Changes</button>
</form> </form>
</main> </main>
@ -103,11 +109,12 @@ $('#add-action').click(function(evt) {
}); });
function showRelevantSection() { function showRelevantSection() {
var savedReplyMethod = $('form').data('reply-method')
var replyMethod = $('input[name=reply-method]:checked').val(); var replyMethod = $('input[name=reply-method]:checked').val();
$('#micropub-settings').hide(); $('#micropub-settings').hide();
$('#indie-config-settings').hide(); $('#indie-config-settings').hide();
$('#action-urls-settings').hide(); $('#action-urls-settings').hide();
if (replyMethod == 'micropub') { if (replyMethod == 'micropub' && savedReplyMethod == 'micropub') {
$('#micropub-settings').show(); $('#micropub-settings').show();
} else if (replyMethod == 'indie-config') { } else if (replyMethod == 'indie-config') {
$('#indie-config-settings').show(); $('#indie-config-settings').show();

View file

@ -285,29 +285,29 @@ def load_user(url):
@views.route('/subscribe', methods=['GET', 'POST']) @views.route('/subscribe', methods=['GET', 'POST'])
@flask_login.login_required @flask_login.login_required
def subscribe(): def subscribe():
if flask.request.method == 'POST': origin = flask.request.form.get('origin') or flask.request.args.get('origin')
origin = flask.request.form.get('origin') if origin:
if origin: type = None
type = None feed = None
feed = None typed_feed = flask.request.form.get('feed')
typed_feed = flask.request.form.get('feed') if typed_feed:
if typed_feed: type, feed = typed_feed.split('|', 1)
type, feed = typed_feed.split('|', 1)
else:
feeds = find_possible_feeds(origin)
if not feeds:
flask.flash('No feeds found for: ' + origin)
return flask.redirect(flask.url_for('.index'))
if len(feeds) > 1:
return flask.render_template(
'select-feed.jinja2', origin=origin, feeds=feeds)
feed = feeds[0]['feed']
type = feeds[0]['type']
new_feed = add_subscription(origin, feed, type)
flask.flash('Successfully subscribed to: {}'.format(new_feed.name))
return flask.redirect(flask.url_for('.index'))
else: else:
flask.abort(400) feeds = find_possible_feeds(origin)
if not feeds:
flask.flash('No feeds found for: ' + origin)
return flask.redirect(flask.url_for('.index'))
if len(feeds) > 1:
return flask.render_template(
'select-feed.jinja2', origin=origin, feeds=feeds)
feed = feeds[0]['feed']
type = feeds[0]['type']
new_feed = add_subscription(origin, feed, type)
flask.flash('Successfully subscribed to: {}'.format(new_feed.name))
return flask.redirect(flask.url_for('.index'))
if flask.request.method == 'POST':
flask.abort(400)
return flask.render_template('subscribe.jinja2') return flask.render_template('subscribe.jinja2')