summaryrefslogtreecommitdiff
path: root/views
diff options
context:
space:
mode:
Diffstat (limited to 'views')
-rw-r--r--views/auth_start.php4
-rw-r--r--views/creating-a-micropub-endpoint.php10
-rw-r--r--views/dashboard.php4
-rw-r--r--views/docs/editor.php17
-rw-r--r--views/docs/syndication.php8
-rw-r--r--views/email.php18
-rw-r--r--views/new-exercise.php77
-rw-r--r--views/new-itinerary.php17
-rw-r--r--views/new-post.php61
-rw-r--r--views/new-weight.php63
-rw-r--r--views/privacy.php2
-rw-r--r--views/settings.php46
12 files changed, 244 insertions, 83 deletions
diff --git a/views/auth_start.php b/views/auth_start.php
index a6df0da..856caec 100644
--- a/views/auth_start.php
+++ b/views/auth_start.php
@@ -48,8 +48,8 @@
<form action="/auth/redirect" method="get">
<p>Choose the scope to request:</p>
<ul style="list-style-type: none;">
- <li><input type="radio" name="scope" value="create update media" checked="checked"> create update media (default)</li>
- <li><input type="radio" name="scope" value="create"> create</li>
+ <li><input type="radio" name="scope" value="profile create update media" checked="checked"> profile create update media (default)</li>
+ <li><input type="radio" name="scope" value="create"> profile create</li>
<li><input type="radio" name="scope" value="post"> post (legacy)</li>
</ul>
diff --git a/views/creating-a-micropub-endpoint.php b/views/creating-a-micropub-endpoint.php
index 4da9510..68ca8ff 100644
--- a/views/creating-a-micropub-endpoint.php
+++ b/views/creating-a-micropub-endpoint.php
@@ -9,7 +9,7 @@ it is ready to make requests to create posts.
### The Request
-This is not intended to be a comprehensive guide to Micropub, and only includes the
+This is not intended to be a comprehensive guide to Micropub, and only includes the
fields that this client sends.
The request to create a post will be sent with as a standard HTTP form-encoded request
@@ -49,7 +49,7 @@ at hand that can be used to check:
* `issued_at` - The date the token was issued.
Keep in mind that it may be possible for another user besides yourself to have created
-an access token at your token endpoint, so the first thing you'll do when verifying
+an access token at your token endpoint, so the first thing you'll do when verifying
is making sure the "me" parameter matches your own domain. This way you are the only
one that can create posts on your website.
@@ -57,7 +57,7 @@ one that can create posts on your website.
### Validating the Request Parameters
A valid request to create a post will contain the parameters listed above. For now,
-you can verify the presence of everything in the list, or you can try to genericize your
+you can verify the presence of everything in the list, or you can try to genericize your
micropub endpoint so that it can also create <a href="http://ownyourgram.com/creating-a-micropub-endpoint">photo posts</a>.
At a bare minimum, a Micropub request will contain the following:
@@ -81,7 +81,7 @@ HTTP/1.1 201 Created
Location: http://example.com/post/100
</pre>
-If there was an error, the response should include an HTTP error code as appropriate,
+If there was an error, the response should include an HTTP error code as appropriate,
and optionally an HTML or other body with more information. Below is a list of possible errors.
* `HTTP 401 Unauthorized` - No access token was provided in the request.
@@ -90,5 +90,5 @@ and optionally an HTML or other body with more information. Below is a list of p
-<?= Markdown(ob_get_clean()) ?>
+<?= \Michelf\Markdown::defaultTransform(ob_get_clean()) ?>
</div>
diff --git a/views/dashboard.php b/views/dashboard.php
index 7b8af63..51c13f1 100644
--- a/views/dashboard.php
+++ b/views/dashboard.php
@@ -18,6 +18,9 @@
<?php if(supports_post_type($this->user, 'like')): ?>
<li><a href="/favorite">👍</a></li>
<?php endif; ?>
+ <?php if(supports_post_type($this->user, 'weight')): ?>
+ <li><a href="/weight">⚖️</a></li>
+ <?php endif; ?>
<?php if(supports_post_type($this->user, 'repost')): ?>
<li><a href="/repost">♺</a></li>
<?php endif; ?>
@@ -27,7 +30,6 @@
<?php if(supports_post_type($this->user, 'review')): ?>
<li><a href="/review">⭐️</a></li>
<?php endif; ?>
- <li><a href="/email">✉️</a></li>
<li><a href="/settings">⚙</a></li>
</ul>
<div style="clear:both;"></div>
diff --git a/views/docs/editor.php b/views/docs/editor.php
index 9cac51a..30606da 100644
--- a/views/docs/editor.php
+++ b/views/docs/editor.php
@@ -43,12 +43,21 @@ Authorization: Bearer XXXXXXXXXXX
{
"type": "h-entry",
"properties": {
- "name": ["Post Title"],
+ "name": [
+ "Post Title"
+ ],
"content": [
- "html": "&lt;p&gt;The HTML contents of your post from the editor&lt;/p&gt;"
+ {
+ "html": "&lt;p&gt;The HTML contents of your post from the editor&lt;/p&gt;"
+ }
+ ],
+ "mp-slug": [
+ "slug"
],
- "mp-slug": ["slug"],
- "category": ["foo","bar"]
+ "category": [
+ "foo",
+ "bar"
+ ]
}
}
</pre>
diff --git a/views/docs/syndication.php b/views/docs/syndication.php
index 3452173..aaa695d 100644
--- a/views/docs/syndication.php
+++ b/views/docs/syndication.php
@@ -18,10 +18,6 @@ Content-type: application/json
{
"syndicate-to": [
{
- "uid": "https://twitter.com/aaronpk",
- "name": "twitter.com/aaronpk"
- },
- {
"uid": "https://news.indieweb.org/en",
"name": "IndieNews"
}
@@ -29,10 +25,10 @@ Content-type: application/json
}
</code></pre>
- <p>The specific values of names and uids are up to your Micropub endpoint, but a good convention is to use the domain name of the service (e.g. https://twitter.com), or domain name and username (e.g. https://twitter.com/aaronpk) for the uid, and a friendly name like "Twitter" or "twitter.com/aaronpk" as the name.</p>
+ <p>The specific values of names and uids are up to your Micropub endpoint, but a good convention is to use the domain name of the service (e.g. https://news.indieweb.org), or domain name and username (e.g. https://mastodon.social/@aaronpk) for the uid, and a friendly name like "IndieNews" or "mastodon.social/@aaronpk" as the name.</p>
<p>Quill will check for your supported syndication targets when you sign in, but there is also a link on the new post screen to manually re-check if you'd like.</p>
- <p>When you create a post and tap one of the syndication options, the value of <code>uid</code> is sent in a property called <code>mp-syndicate-to</code>, which instructs your endpoint to syndicate to that target. Note that Quill doesn't know whether the target is Twitter, Facebook, or something else, and doesn't talk to the service directly. It's just an instruction to your endpoint to syndicate to that destination.</p>
+ <p>When you create a post and tap one of the syndication options, the value of <code>uid</code> is sent in a property called <code>mp-syndicate-to</code>, which instructs your endpoint to syndicate to that target. Note that Quill doesn't know whether the target is Mastodon, IndieNews, or something else, and doesn't talk to the service directly. It's just an instruction to your endpoint to syndicate to that destination.</p>
</div>
diff --git a/views/email.php b/views/email.php
index e3464f6..4781c7a 100644
--- a/views/email.php
+++ b/views/email.php
@@ -1,22 +1,6 @@
<div class="narrow">
<?= partial('partials/header') ?>
- <div class="jumbotron" style="margin-top: 20px;">
- <p>
- Send email or MMS to<br>
- <a href="mailto:<?= $this->user->email_username . '@' . Config::$hostname ?>"><?= $this->user->email_username . '@' . Config::$hostname ?></a>
- </p>
- </div>
-
- <div style="width: 80%; margin: 0 auto;">
- <h3>Email Subject</h3>
- <p>If you add a subject line to your email, it will be sent as the "name" property which indicates to your Micropub endpoint that this is a blog post.</p>
-
- <h3>Email and MMS body</h3>
- <p>The text of your email or MMS will be send as the "content" property, which is the main contents of your post. Plaintext only for now.</p>
-
- <h3>Photo</h3>
- <p>If you attach a photo to your email or MMS, it will be sent to your Micropub endpoint. (Only one photo is currently supported.)</p>
- </div>
+ <p>This feature is not available.</p>
</div>
diff --git a/views/new-exercise.php b/views/new-exercise.php
new file mode 100644
index 0000000..4a451ca
--- /dev/null
+++ b/views/new-exercise.php
@@ -0,0 +1,77 @@
+ <div class="narrow">
+ <?= partial('partials/header') ?>
+
+ <div style="clear: both;" class="notice-pad">
+ <div class="alert alert-success hidden" id="test_success"><strong>Success! </strong><a href="" id="post_href">View your post</a></div>
+ <div class="alert alert-danger hidden" id="test_error"><strong>Something went wrong!</strong><br>Your Micropub endpoint indicated that something went wrong creating the post.</div>
+ </div>
+
+ <form style="margin-top: 20px;" id="weight_form">
+
+ <div class="form-group">
+ <label for="exercise_activity">Activity</label>
+ <select id="exercise_activity" class="form-control">
+ <option value="indoor-cycling">Indoor Cycling</option>
+ </select>
+ </div>
+
+ <div class="form-group">
+ <label for="exercise_minutes">Minutes</label>
+ <input type="number" id="exercise_minutes" class="form-control">
+ </div>
+
+ <div class="form-group">
+ <label for="exercise_heartrate">Avg Heart Rate</label>
+ <input type="number" id="exercise_heartrate" class="form-control">
+ </div>
+
+ <div class="form-group">
+ <label for="date">Date and Time</label>
+ <input type="text" id="date" class="form-control" value="<?= date('Y-m-d H:i:s') ?>">
+ </div>
+
+ <div style="float: right; margin-top: 6px;">
+ <button class="btn btn-success" id="btn_post">Post</button>
+ </div>
+ </form>
+
+ <div style="clear: both;"></div>
+
+ </div>
+<script>
+$(function(){
+
+ var d = new Date();
+ var tzOffset = tz_seconds_to_offset(d.getTimezoneOffset() * 60 * -1);
+ $("#date").val( $("#date").val() + " " + tzOffset);
+
+ $("#btn_post").click(function(){
+ $("#btn_post").addClass("loading disabled");
+
+ $.post("/exercise", {
+ activity: $("#exercise_activity").val(),
+ minutes: $("#exercise_minutes").val(),
+ heartrate: $("#exercise_heartrate").val(),
+ published: $("#date").val()
+ }, function(response){
+ if(response.location != false) {
+
+ $("#test_success").removeClass('hidden');
+ $("#test_error").addClass('hidden');
+ $("#post_href").attr("href", response.location);
+
+ window.location = response.location;
+ } else {
+ $("#test_success").addClass('hidden');
+ $("#test_error").removeClass('hidden');
+ if(response.error_details) {
+ $("#test_error").text(response.error_details);
+ }
+ $("#btn_post").removeClass("loading disabled");
+ }
+
+ });
+ return false;
+ });
+});
+</script>
diff --git a/views/new-itinerary.php b/views/new-itinerary.php
index e40ec2a..f0661e9 100644
--- a/views/new-itinerary.php
+++ b/views/new-itinerary.php
@@ -146,17 +146,30 @@ $(function(){
$(el.target).parents(".itinerary-leg").find(".leg-arrival-tz").parent().addClass("has-success");
});
});
+ $(".leg-departure-date").unbind("change").change(function(el){
+ $(el.target).parents(".itinerary-leg").find(".leg-arrival-date").val($(el.target).val());
+ });
}
function add_leg() {
+ var last_date = $(".itinerary-leg:last .date").val();
+ var last_airport = $(".itinerary-leg:last .leg-destination").val();
+ var last_operator = $(".itinerary-leg:last .leg-operator").val();
+
$("#itinerary-legs-container").append($("#leg-template").html());
$(".itinerary-leg:last .template").val(0);
var d = new Date();
- $(".itinerary-leg:last .date").val(d.getFullYear()+"-"+zero_pad(d.getMonth()+1)+"-"+zero_pad(d.getDate()));
+ if(last_date) {
+ $(".itinerary-leg:last .date").val(last_date);
+ } else {
+ $(".itinerary-leg:last .date").val(d.getFullYear()+"-"+zero_pad(d.getMonth()+1)+"-"+zero_pad(d.getDate()));
+ }
$(".itinerary-leg:last .time").val(zero_pad(d.getHours())+":"+zero_pad(d.getMinutes())+":00");
$(".itinerary-leg:last .tz").val(tz_seconds_to_offset(d.getTimezoneOffset() * 60 * -1));
-
+ $(".itinerary-leg:last .leg-origin").val(last_airport);
+ $(".itinerary-leg:last .leg-operator").val(last_operator);
+
/*
$('.itinerary-leg:last .date').datepicker({
'format': 'yyyy-mm-dd',
diff --git a/views/new-post.php b/views/new-post.php
index 9e678b3..2190752 100644
--- a/views/new-post.php
+++ b/views/new-post.php
@@ -46,11 +46,18 @@
</div>
<div class="form-group">
+ <div id="mastodon_content_remaining" class="mcheck500"><img src="/images/mastodon.ico" width="16"> <span>500</span></div>
<div id="note_content_remaining" class="pcheck206"><img src="/images/twitter.ico"> <span>280</span></div>
+ <div id="bluesky_content_remaining" class="bcheck256"><img src="/images/bluesky.png" width="16"> <span>256</span></div>
<label for="note_content">Content</label>
<textarea id="note_content" value="" class="form-control" style="height: 4em;"></textarea>
</div>
+ <div class="form-group hidden" id="published-field">
+ <label for="note_published_date">Published</label>
+ <input type="text" placeholder="YYYY-MM-DD hh:mm:ss +zz:zz" pattern="\d{4}-\d{2}-\d{2}[ T]\d\d:\d\d:\d\d[ ]?[+\-]\d\d:?\d\d" class="form-control" id="note_published_date">
+ </div>
+
<div class="form-group hidden" id="content-type-selection">
<label for="note_content_type">Content Type</label>
<select class="form-control" id="note_content_type">
@@ -215,10 +222,11 @@
margin-bottom: 1em;
}
-#note_content_remaining {
+#note_content_remaining, #mastodon_content_remaining, #bluesky_content_remaining {
float: right;
font-size: 0.8em;
font-weight: bold;
+ margin-left: 10px;
}
#modal_photo_preview {
@@ -260,6 +268,10 @@
.pcheck200,.pcheck208 { color: #59cb3a; } /* exactly fits 280 chars, both with or without RT */
.pcheck413 { color: #a73b3b; } /* over max tweet length */
+.lengthOK { color: #6ba15c; }
+.lengthWARN { color: #c4b404; }
+.lengthOVER { color: #a73b3b; }
+
.reply-context {
display: flex;
flex-direction: row;
@@ -470,12 +482,25 @@ $(function(){
refreshPhotoPreviews();
saveNoteState();
});
+
+ $("#note_published_date").bind('keyup', function(e) {
+ const valid = document.getElementById("note_published_date").validity;
+ if(valid.patternMismatch) {
+ $("#published-field").addClass("has-error");
+ } else {
+ $("#published-field").removeClass("has-error");
+ }
+ });
$(document).bind('keydown', function(e){
// Easter egg: press ctrl+shift+c to reveal a content type selection
if(e.keyCode == 67 && e.ctrlKey && e.shiftKey) {
$("#content-type-selection").removeClass("hidden");
}
+ // Easter egg: press ctrl+shift+d to reveal a datetime field
+ if(e.keyCode == 68 && e.ctrlKey && e.shiftKey) {
+ $("#published-field").removeClass("hidden");
+ }
// Easter egg: press ctrl+shift+m to switch to markdown
if(e.keyCode == 77 && e.ctrlKey && e.shiftKey) {
switchToMarkdown();
@@ -597,12 +622,26 @@ $(function(){
$("#note_content").on('change keyup', function(e){
var text = $("#note_content").val();
var tweet_length = tw_text_proxy(text).length;
- var tweet_check = tw_length_check(text, 280, "<?= $this->user->twitter_username ?>");
+ var tweet_check = tw_length_check(text, 280, "");
var remaining = 280 - tweet_length;
- $("#note_content_remaining span").html(remaining);
+ $("#note_content_remaining span").text(remaining);
$("#note_content_remaining").removeClass("pcheck200 pcheck206 pcheck207 pcheck208 pcheck413");
$("#note_content_remaining").addClass("pcheck"+tweet_check);
+ $("#mastodon_content_remaining span").text(500 - text.length);
+ $("#mastodon_content_remaining").removeClass("lengthOK lengthWARN lengthOVER");
+ mastodonLengthCheck = "lengthOK";
+ if(text.length > 490) { mastodonLengthCheck = "lengthWARN"; }
+ if(text.length > 500) { mastodonLengthCheck = "lengthOVER"; }
+ $("#mastodon_content_remaining").addClass(mastodonLengthCheck);
+
+ $("#bluesky_content_remaining span").text(256 - text.length);
+ $("#bluesky_content_remaining").removeClass("lengthOK lengthWARN lengthOVER");
+ blueskyLengthCheck = "lengthOK";
+ if(text.length > 240) { blueskyLengthCheck = "lengthWARN"; }
+ if(text.length > 256) { blueskyLengthCheck = "lengthOVER"; }
+ $("#bluesky_content_remaining").addClass(blueskyLengthCheck);
+
// If the user didn't enter any categories, add them from the post
// if(!userHasSetCategory) {
// var tags = $("#note_content").val().match(/#[a-z][a-z0-9]+/ig);
@@ -644,17 +683,6 @@ $(function(){
// }
// $("#note_category").val(category.join(", "));
- /*
- // stop auto-populating usernames in replies, since Twitter no longer requires it
- if($("#note_content").val() == "" && data.mentions) {
- var mentions = '';
- for(var i in data.mentions) {
- mentions += '@'+data.mentions[i]+' ';
- }
- $("#note_content").val(mentions);
- }
- */
-
if(data.entry) {
$(".reply-context .content").text(data.entry.content.text);
if(data.entry.name) {
@@ -803,6 +831,11 @@ $(function(){
formData.append('p3k-content-type', $("#note_content_type").val());
}
+ if(!$("#published-field").hasClass("hidden")) {
+ entry['published'] = $("#note_published_date").val();
+ formData.append('published', $("#note_published_date").val());
+ }
+
// Need to append a placeholder field because if the file size max is hit, $_POST will
// be empty, so the server needs to be able to recognize a post with only a file vs a failed one.
// This will be stripped by Quill before it's sent to the Micropub endpoint
diff --git a/views/new-weight.php b/views/new-weight.php
new file mode 100644
index 0000000..121b368
--- /dev/null
+++ b/views/new-weight.php
@@ -0,0 +1,63 @@
+ <div class="narrow">
+ <?= partial('partials/header') ?>
+
+ <div style="clear: both;" class="notice-pad">
+ <div class="alert alert-success hidden" id="test_success"><strong>Success! </strong><a href="" id="post_href">View your post</a></div>
+ <div class="alert alert-danger hidden" id="test_error"><strong>Something went wrong!</strong><br>Your Micropub endpoint indicated that something went wrong creating the post.</div>
+ </div>
+
+ <form style="margin-top: 20px;" id="weight_form">
+
+ <div class="form-group">
+ <label for="weight_num">Weight (in <?= $this->unit ?>)</label>
+ <input type="number" id="weight_num" class="form-control">
+ </div>
+
+ <div class="form-group">
+ <label for="date">Date and Time</label>
+ <input type="text" id="date" class="form-control" value="<?= date('Y-m-d H:i:s') ?>">
+ </div>
+
+ <div style="float: right; margin-top: 6px;">
+ <button class="btn btn-success" id="btn_post">Post</button>
+ </div>
+ </form>
+
+ <div style="clear: both;"></div>
+
+ </div>
+<script>
+$(function(){
+
+ var d = new Date();
+ var tzOffset = tz_seconds_to_offset(d.getTimezoneOffset() * 60 * -1);
+ $("#date").val( $("#date").val() + " " + tzOffset);
+
+ $("#btn_post").click(function(){
+ $("#btn_post").addClass("loading disabled");
+
+ $.post("/weight", {
+ weight_num: $("#weight_num").val(),
+ published: $("#date").val()
+ }, function(response){
+ if(response.location != false) {
+
+ $("#test_success").removeClass('hidden');
+ $("#test_error").addClass('hidden');
+ $("#post_href").attr("href", response.location);
+
+ window.location = response.location;
+ } else {
+ $("#test_success").addClass('hidden');
+ $("#test_error").removeClass('hidden');
+ if(response.error_details) {
+ $("#test_error").text(response.error_details);
+ }
+ $("#btn_post").removeClass("loading disabled");
+ }
+
+ });
+ return false;
+ });
+});
+</script>
diff --git a/views/privacy.php b/views/privacy.php
index 40ce393..c870f99 100644
--- a/views/privacy.php
+++ b/views/privacy.php
@@ -7,6 +7,4 @@
<p>Quill does not store your posts itself, but does cache the last response from your website and provides it to you for debugging purposes.</p>
- <p>If you connect Quill to your Twitter account, Quill can favorite tweets on your behalf when you favorite a Twitter URL. Quill will never post anything to your accounts without an explicit action on your part.</p>
-
</div>
diff --git a/views/settings.php b/views/settings.php
index 55cbd17..a479924 100644
--- a/views/settings.php
+++ b/views/settings.php
@@ -61,6 +61,17 @@
</tr>
</table>
+ <h3>Post Format Settings</h3>
+ <table class="table table-condensed" width="100%">
+ <tr>
+ <td>Weight Unit</td>
+ <td width="160">
+ <div style="margin-bottom:4px;"><input type="text" id="weight-unit" value="<?= $this->user->weight_unit ?>" class="form-control"></div>
+ <div><input type="button" class="btn btn-primary" value="Save" id="save-weight-unit"></div>
+ </td>
+ <td>The unit to be used for <a href="/weight">weight posts</a>.</td>
+ </tr>
+ </table>
<h3>Syndication Targets</h3>
@@ -112,13 +123,6 @@
- <?php if(!Config::$twitterClientID): ?>
- <h3>Twitter</h3>
- <p>Connecting a Twitter account will automatically "favorite" and "retweet" tweets on Twitter when you favorite and retweet a Twitter URL in Quill.</p>
- <input type="button" id="twitter-button" value="Checking" class="btn">
- <?php endif ?>
-
-
<h3>Backwards Compatibility</h3>
<p>You can customize some of the properties that are sent in the Micropub request to work with older software.</p>
@@ -157,29 +161,6 @@
<script>
$(function(){
- <?php if(!Config::$twitterClientID): ?>
- $.getJSON("/auth/twitter", function(data){
- // Check if we're already authorized with twitter
- if(data && data.result == 'ok') {
- $("#twitter-button").val("Connected").addClass("btn-success");
- } else if(data && data.url) {
- $("#twitter-button").val("Sign In").data("url", data.url).addClass("btn-warning");
- } else {
- $("#twitter-button").val("Error").addClass("btn-danger");
- }
- });
-
- $("#twitter-button").click(function(){
- if($(this).data('url')) {
- window.location = $(this).data('url');
- } else {
- $.getJSON("/auth/twitter", {login: 1}, function(data){
- window.location = data.url;
- });
- }
- });
- <?php endif ?>
-
$("#send-html-content").click(function(){
var enabled = $(this).attr("checked") == "checked";
$.post("/settings/save", {
@@ -206,6 +187,11 @@ $(function(){
});
+ $("#save-weight-unit").click(function(){
+ $.post("/settings/save", {
+ weight_unit: $("#weight-unit").val()
+ });
+ });
});