title => Odin::escapify($m, $title) . " (odin.gg Paste Bin)" &>
<h1><tt>odin.gg</tt> Paste Bin: <% $title %></h1>
<div class="menu">
- <span class="item"><a href="<% "$Odin::PASTEBIN/$tag?op=raw" %>">Raw</a></span>
+ <span class="item"><a href="<% "$Odin::PASTEBIN/$tag?op=raw" |h %>">Raw</a></span>
% if (defined $edit) {
- <span class="item"><a href="<% "$Odin::PASTEBIN/$tag?edit=$edit" %>">Edit</a></span>
+ <span class="item"><a href="<% "$Odin::PASTEBIN/$tag?edit=$edit" |h %>">Edit</a></span>
% }
</div>
+% if (defined $honc) {
+<div class="note">
+<p>Your browser doesn't appear to be accepting my cookies.
+<p>Don't share the link to this page with other people. <b>If you do,
+ they'll be able to edit this paste just as you can</b>, using the
+ <b>Edit</b> link at the top of the page.
+<p>Instead, share this link:
+ <a href="<% "$Odin::PASTEBIN/$tag" |h %>"><%
+ "$Odin::PASTEBIN/$tag" |h %></a>
+</div>
+% }
<pre class="paste">
% if ($lang eq 'txt') {
<% $content |h %>\
$title
$lang
$tag
+ $honc
$edit
</%args>
%#
-path => "$Odin::PASTEBIN_PATH/", %attr;
}
+ sub hasuff ($) {
+ my ($edit) = @_;
+ return $Odin::COOKIE{"odin-cookie-probe"} ? "" : "?honc=$edit";
+ }
+
+ Odin::bake_cookie $r, "odin-cookie-probe=t";
+
my %props = (
lang => $lang, title => $title,
content => Odin::tidy_pastebin_content $content
$m->print($old{content});
} else {
$edit = $Odin::COOKIE{"odin-handoff.$tag"};
- $m->comp("%show", tag => $tag, edit => $edit, %old);
+ $m->comp("%show", tag => $tag,
+ honc => $honc, edit => $edit // $honc, %old);
}
} else {
if ($op eq "del") {
} else {
set_handoff_cookie $tag, $edit;
my $editp = Odin::update_pastebin $tag, $edit, %props;
- if ($editp) { $m->redirect("$Odin::PASTEBIN/$tag"); }
- else { $m->comp("%edit", tag => $tag, edit => $edit, %props); }
+ if ($editp) {
+ $m->redirect("$Odin::PASTEBIN/$tag" . hasuff $edit);
+ } else {
+ $m->comp("%edit", tag => $tag, edit => $edit, %props);
+ }
}
}
} elsif (defined $content) {
($tag, $edit) = Odin::new_pastebin %props;
set_handoff_cookie $tag, $edit;
- $m->redirect("$Odin::PASTEBIN/$tag");
+ $m->redirect("$Odin::PASTEBIN/$tag" . hasuff $edit);
} else {
Odin::path_info($r) =~ m:/$:
or $m->redirect("$Odin::PASTEBIN/", 301);
$edit => undef
$lang => undef
$title => undef
+ $honc => undef
$op => "edit"
</%args>
%#