my eye

author Angelo Gladding

category Micropub

name Like

published 2025-06-26T16:23:00.877193-07:00

type entry

updated 2025-06-26T17:54:16.436127-07:00

url /like, /2025/06/26/rc

visibility public

Content

$ req = web.tx.request

$if req.method == "GET":
    <p>Bookmarklet: <a href="javascript:(function(){window.location.href='https://ragt.ag/like?permalink='+encodeURIComponent(window.location.href)})()">Like</a> <small>(drag to browser toolbar to install)</small></p>
    
    $ permalink = req.uri.query.get('permalink', [None])[0]
    <form method=post>
    <label><small>Permalink:</small><br>
    <input name=like_of value="$permalink" style=width:30em></label><br>
    $if permalink:
        $ page = web.get(permalink).entry
        <p>$page["name"]</p>
    <button>Like</button>
    </form>
$elif req.method == "POST":
    $ form = web.form("like_of")
    $if mp_resp := mp_post(like_of=form.like_of):
        <p>$mp_resp.text</p>
        <p>Like posted.</p>
    $else:
        <p>Your website does not support micropub.</p>