Plugin Directory

Changeset 2921576


Ignore:
Timestamp:
06/05/2023 11:04:32 AM (3 years ago)
Author:
pjv
Message:

Update to version 0.7.0 from GitHub

Location:
nostrtium
Files:
27 edited
1 copied

Legend:

Unmodified
Added
Removed
  • nostrtium/tags/0.7.0/classes/class-nostrtium-requirements-check.php

    r2905773 r2921576  
    7979  public function dir_writeable_notice() {
    8080    echo '<div class="error">';
    81     echo '<p>The &#8220;' . esc_html($this->title) . '&#8221; plugin cannot run without its own directory being writeable.</p>';
     81    echo '<p>The &#8220;' . esc_html($this->title) . '&#8221; plugin cannot run without the wp-content/uploads directory being writeable.</p>';
    8282    echo '</div>';
    8383  }
  • nostrtium/tags/0.7.0/classes/class-nostrtium-settings.php

    r2905773 r2921576  
    1717  public $encrypted_privkey = '';
    1818  public $keyfile = '';
     19  public $auto_publish_settings = null;
    1920
    2021  // singleton
     
    3435      add_action('wp_ajax_pjv_nostrtium_save_relays', [$this, 'save_relays']);
    3536      add_action('wp_ajax_pjv_nostrtium_save_private_key', [$this, 'save_private_key']);
     37      add_action('wp_ajax_pjv_nostrtium_save_auto_publish', [$this, 'save_auto_publish_settings']);
    3638
    3739      if ($pagenow == 'plugins.php') {
     
    3941      }
    4042    }
    41     $this->relays = $this->get_relays();
    42     $this->encrypted_privkey = $this->get_encrypted_key();
    43     $this->keyfile = PJV_NOSTRTIUM_DIR . 'keyfile.key';
     43    $this->relays                  = $this->get_relays();
     44    $this->encrypted_privkey       = $this->get_encrypted_key();
     45    $this->keyfile                 = PJV_NOSTRTIUM_STORAGE . 'keyfile.key';
     46    $this->auto_publish_settings   = $this->get_auto_publish_settings();
     47  }
     48
     49  public function get_auto_publish_settings() {
     50    return get_option('nostrtium-auto-publish');
     51  }
     52  public function set_auto_publish_settings(array $ap) {
     53    update_option('nostrtium-auto-publish', $ap);
     54  }
     55  public function save_auto_publish_settings() {
     56    check_ajax_referer('nostrtium-ajax-nonce', 'security');
     57    $this->check_user();
     58
     59    $ap = $_POST['apSettings'] ?? null;
     60    if ($ap == null) {
     61      wp_send_json_error('No auto publish settings received.');
     62    }
     63
     64    foreach ($ap as $key => &$value) {
     65      $value = rest_sanitize_boolean($value);
     66    }
     67
     68    $this->set_auto_publish_settings($ap);
     69    wp_send_json_success();
    4470  }
    4571
     
    6288
    6389  public function render_settings_page() {
     90    $ap_checked = $this->auto_publish_settings['autoPublish'] ? "checked" : "";
     91    $excerpt_checked = $this->auto_publish_settings['apExcerpt'] ? "checked" : "";
     92    $permalink_checked = $this->auto_publish_settings['apPermalink'] ? "checked" : "";
     93    $whole_post_checked = $this->auto_publish_settings['apWholePost'] ? "checked" : "";
    6494    include PJV_NOSTRTIUM_DIR . 'views/settings-page.php';
    6595  }
  • nostrtium/tags/0.7.0/classes/class-nostrtium.php

    r2905773 r2921576  
    1414class Nostrtium {
    1515  private static $instance = null;
    16   public  $version         = '';
    1716  private $settings        = null;
    18   public  $keyfile         = '';
     17  public $keyfile          = '';
    1918
    2019  // singleton
     
    3029    require_once PJV_NOSTRTIUM_DIR . 'classes/class-nostrtium-metabox.php';
    3130    require_once PJV_NOSTRTIUM_DIR . 'classes/class-nostrtium-settings.php';
    32     $this->version  = PJV_NOSTRTIUM_VERSION;
    3331    $this->settings = Nostrtium_Settings::get_instance();
    34     $this->keyfile  = PJV_NOSTRTIUM_DIR . 'keyfile.key';
     32    $this->keyfile  = PJV_NOSTRTIUM_STORAGE . 'keyfile.key';
    3533
    3634    if (is_admin()) {
     
    3836      add_action('wp_ajax_pjv_nostrtium_post_note', [$this, 'post_note']);
    3937    }
     38
     39    add_action('publish_post', [$this, 'maybe_publish_post_to_nostr'], 10, 2);
     40    add_action('plugins_loaded', [$this, 'check_version']);
    4041  }
    4142
     
    7374        'relays'          => $this->settings->relays,
    7475        'private_key_set' => $private_key_set,
     76        'ap_settings'     => $this->settings->auto_publish_settings,
    7577      ];
    7678      wp_localize_script('nostrtium-settings.js', 'nostrtium', $local_arr);
    7779      wp_enqueue_script('nostrtium-settings.js');
     80    }
     81  }
     82
     83  public function maybe_publish_post_to_nostr($post_id, $post) {
     84    if (!$post->_nostrtium_posted && $this->settings->auto_publish_settings['autoPublish']) {
     85      $note = "";
     86
     87      if ($this->settings->auto_publish_settings['apExcerpt']) {
     88        $note .= get_the_excerpt($post->ID) . "\n\n";
     89      }
     90
     91      if ($this->settings->auto_publish_settings['apPermalink']) {
     92        $note .= get_permalink($post->ID);
     93      }
     94
     95      if ($this->settings->auto_publish_settings['apWholePost']) {
     96        # code...
     97      }
     98
     99      $result = $this->send_note($note);
     100
     101      if ($result->sent) {
     102        if ($post_id > 0) {
     103          update_post_meta($post_id, '_nostrtium_posted', true);
     104        }
     105      }
    78106    }
    79107  }
     
    116144  }
    117145
    118   public function activate() {
     146  public function check_version() {
     147    if (PJV_NOSTRTIUM_VERSION !== get_option('nostrtium-version')) {
     148      $this->activate();
     149    }
     150  }
     151
     152  private function set_keyfile() {
     153    # set up storage directory
     154    if (!file_exists(PJV_NOSTRTIUM_STORAGE)) wp_mkdir_p(PJV_NOSTRTIUM_STORAGE);
     155
    119156    # set up encryption key
    120157    if (!file_exists($this->keyfile)) {
     158      // wipe out any previously stored private key
     159      update_option('nostrtium-enc-privkey', '');
     160      $this->settings->encrypted_privkey = '';
     161      // generate and save keyfile
    121162      $encKey = KeyFactory::generateEncryptionKey();
    122163      KeyFactory::save($encKey, $this->keyfile);
    123164    }
    124 
     165  }
     166
     167  public function activate() {
     168    $this->set_keyfile();
     169   
    125170    // initial seed relays
    126171    if (!get_option('nostrtium-relays')) {
    127172      $relays = [
    128173        'wss://relay.damus.io',
    129         'wss://nostr-pub.wellorder.net',
    130         'wss://relay.wellorder.net',
    131174        'wss://nos.lol',
    132175        'wss://nostr.mom',
    133176        'wss://no.str.cr',
    134177        'wss://relay.snort.social',
    135         'wss://nostr.milou.lol',
    136178        'wss://nostr.bitcoiner.social',
    137         'wss://relay.nostrid.com',
    138         'wss://relay.nostrcheck.me',
    139         'wss://relayable.org',
    140179      ];
    141180      update_option('nostrtium-relays', $relays);
    142181    }
     182   
     183    // save new plugin version to db
     184    update_option('nostrtium-version', PJV_NOSTRTIUM_VERSION);
    143185  }
    144186
     
    181223    }
    182224
    183     $r       = new stdClass;
     225    $r = new stdClass;
    184226    $r->sent = $sent;
    185     $r->log  = $log;
     227    $r->log = $log;
    186228
    187229    return $r;
  • nostrtium/tags/0.7.0/js/nostrtium-settings.js

    r2905773 r2921576  
    33  // execute when the DOM is ready
    44  $(document).ready(function () {
     5    var loading = true;
     6
    57    function buildRelayTable() {
    68      var tbody = $("#relay-tbody");
     
    3941        }
    4042      });
     43    }
     44
     45    function saveAutoPublishSettings() {
     46      if (loading) {
     47        return;
     48      }
     49      var apSettings = {
     50        autoPublish: $("#auto-publish").checkbox("is checked"),
     51        apExcerpt: $("#post-excerpt").checkbox("is checked"),
     52        apPermalink: $("#permalink").checkbox("is checked"),
     53        apWholePost: $("#whole-post").checkbox("is checked"),
     54      };
     55      var data = {
     56        action: "pjv_nostrtium_save_auto_publish",
     57        apSettings: apSettings,
     58        security: nostrtium.security,
     59      };
     60      $.post(nostrtium.ajaxurl, data, function (response) {
     61        if (response.success) {
     62          $("body").toast({
     63            class: "success",
     64            message: `Settings updated.`,
     65          });
     66        } else {
     67          alert(response.data);
     68        }
     69      });
     70    }
     71
     72    function setupCheckboxes() {
     73      if (nostrtium.ap_settings.autoPublish) {
     74        $("#auto-publish").checkbox("check");
     75      } else {
     76        $("#auto-publish").checkbox("uncheck");
     77      }
     78
     79      if (nostrtium.ap_settings.apExcerpt) {
     80        $("#post-excerpt").checkbox("check");
     81      } else {
     82        $("#post-excerpt").checkbox("uncheck");
     83      }
     84
     85      if (nostrtium.ap_settings.apPermalink) {
     86        $("#permalink").checkbox("check");
     87      } else {
     88        $("#permalink").checkbox("uncheck");
     89      }
     90      if (nostrtium.ap_settings.apWholePost) {
     91        $("#whole_post").checkbox("check");
     92      } else {
     93        $("#whole_post").checkbox("uncheck");
     94      }
    4195    }
    4296
     
    117171    });
    118172
     173    $("#auto-publish").checkbox({
     174      onChecked: function () {
     175        $("#auto-publish-fields").removeClass("disabled");
     176      },
     177      onUnchecked: function () {
     178        $("#auto-publish-fields").addClass("disabled");
     179      },
     180      onChange: function () {
     181        saveAutoPublishSettings();
     182      },
     183    });
     184
     185    $(".ui.checkbox.ap").checkbox({
     186      onChange: function () {
     187        saveAutoPublishSettings();
     188      },
     189    });
     190
    119191    buildRelayTable();
     192    setupCheckboxes();
     193    loading = false;
    120194  });
    121195})(jQuery, window, document);
  • nostrtium/tags/0.7.0/nostrtium.php

    r2905773 r2921576  
    99 * Text Domain:      nostrtium
    1010 * Domain Path:      /languages
    11  * Version:          0.6.1
     11 * Version:          0.7.0
    1212 * Requires at least 6.0
    1313 * Requires PHP      8.1
     
    2222}
    2323
    24 define('PJV_NOSTRTIUM_VERSION', '0.6.1');
     24define('PJV_NOSTRTIUM_VERSION', '0.7.0');
    2525define('PJV_NOSTRTIUM_DIR', plugin_dir_path(__FILE__));
    2626define('PJV_NOSTRTIUM_DEFAULT_USER_ROLE', 'edit_posts');
     27define('PJV_NOSTRTIUM_STORAGE', wp_upload_dir()['basedir'] . '/nostrtium_' . md5(LOGGED_IN_SALT) . '/');
    2728
    2829require_once PJV_NOSTRTIUM_DIR . 'classes/class-nostrtium-requirements-check.php';
     
    3132  'php'   => '8.1',
    3233  'wp'    => '6.0',
    33   'dir'   => PJV_NOSTRTIUM_DIR,
     34  'dir'   => wp_upload_dir()['basedir'],
    3435  'file'  => __FILE__,
    3536]);
    3637if ($pjv_nostrtium_requirements_check->passes()) {
    37   require_once PJV_NOSTRTIUM_DIR . '/vendor/autoload.php';
     38  require_once PJV_NOSTRTIUM_DIR . 'vendor/autoload.php';
    3839  require_once PJV_NOSTRTIUM_DIR . 'classes/class-nostrtium.php';
    3940  $pjv_nostrtium_plugin = Nostrtium::get_instance();
  • nostrtium/tags/0.7.0/readme.txt

    r2906331 r2921576  
    55Requires at least: 6.0
    66Requires PHP: 8.1
    7 Tested up to: 6.2
    8 Stable tag: 0.6.1
     7Tested up to: 6.2.2
     8Stable tag: 0.7.0
    99License: Unlicense
    1010License URI: https://unlicense.org
     
    1616Nostrtium lets you post from WordPress to [nostr](https://nostr.how/en/what-is-nostr).
    1717
    18 This initial version just implements basic nostr settings (private key, relays) and provides a metabox in the WordPress Post editing page which is pre-populated with the Post Excerpt and a link to the Post and lets you post the content of that metabox to your configured relays.
     18This version implements basic nostr settings (private key, relays) and provides a metabox in the WordPress Post editing page which is pre-populated with the Post Excerpt and a link to the Post and lets you post the content of that metabox to your configured relays.
    1919
    2020You can change the content in the metabox as you like. If you have a good excerpt and post it as-is, it creates a twitter-style "announcement" note on nostr. A lot of nostr clients will render the link to the WordPress post as a nice-looking summary card with featured image and etc. This functionality is probably enough for many use-cases but I have plans to add more functionality to this plugin in the future, including generation of keys; support for NIP-07 browser extensions; separate nostr profiles for individual WP users; support for full, long-form content from WP to nostr; and more.
     21
     22There are also options (on the settings page) to auto-post to nostr the excerpt, the permalink, or both upon WordPress post publication.
    2123
    2224[Note that the private key is stored encrypted in the WordPress database using libsodium cryptography.]
     
    3032* php-gmp module must be installed ([Installation on Ubuntu](https://computingforgeeks.com/how-to-install-php-on-ubuntu-linux-system/))
    3133* WordPress 6.0+
    32 * Writable installation directory (on activation, the plugin writes a cryptographic keyfile to its own install directory)
     34* Writable uploads directory (on activation, the plugin writes a cryptographic keyfile to a storage directory)
    3335
    3436### How to Use
     
    5961== Screenshots ==
    6062
    61 1. Nostr relay management
    62 2. Post to Nostr metabox
     631. Nostrtium settings
     642. Post to nostr metabox
    6365
    6466== Changelog ==
    6567
     68= 0.7.0 =
     69* Allow auto posting excerpt, permalink, or both on publication of WordPress post.
     70* NOTE: If you have installed a prior version, this update requires you to re-enter your private key on the Nostrtium settings page. This is a one-time occurrence.
     71
    6672= 0.6.1 =
    6773* Initial public release
  • nostrtium/tags/0.7.0/vendor/autoload.php

    r2905773 r2921576  
    2323require_once __DIR__ . '/composer/autoload_real.php';
    2424
    25 return ComposerAutoloaderInitc122159a2c090c68c81e277a8518ae21::getLoader();
     25return ComposerAutoloaderInit2635a5e5e04df97aa633ddc41a392ae7::getLoader();
  • nostrtium/tags/0.7.0/vendor/composer/autoload_psr4.php

    r2905773 r2921576  
    2020    'BN\\' => array($vendorDir . '/simplito/bn-php/lib'),
    2121    'BI\\' => array($vendorDir . '/simplito/bigint-wrapper-php/lib'),
    22     '' => array($vendorDir . '/phrity/net-uri/src', $vendorDir . '/phrity/util-errorhandler/src'),
     22    '' => array($vendorDir . '/phrity/util-errorhandler/src', $vendorDir . '/phrity/net-uri/src'),
    2323);
  • nostrtium/tags/0.7.0/vendor/composer/autoload_real.php

    r2905773 r2921576  
    33// autoload_real.php @generated by Composer
    44
    5 class ComposerAutoloaderInitc122159a2c090c68c81e277a8518ae21
     5class ComposerAutoloaderInit2635a5e5e04df97aa633ddc41a392ae7
    66{
    77    private static $loader;
     
    2525        require __DIR__ . '/platform_check.php';
    2626
    27         spl_autoload_register(array('ComposerAutoloaderInitc122159a2c090c68c81e277a8518ae21', 'loadClassLoader'), true, true);
     27        spl_autoload_register(array('ComposerAutoloaderInit2635a5e5e04df97aa633ddc41a392ae7', 'loadClassLoader'), true, true);
    2828        self::$loader = $loader = new \Composer\Autoload\ClassLoader(\dirname(__DIR__));
    29         spl_autoload_unregister(array('ComposerAutoloaderInitc122159a2c090c68c81e277a8518ae21', 'loadClassLoader'));
     29        spl_autoload_unregister(array('ComposerAutoloaderInit2635a5e5e04df97aa633ddc41a392ae7', 'loadClassLoader'));
    3030
    3131        require __DIR__ . '/autoload_static.php';
    32         call_user_func(\Composer\Autoload\ComposerStaticInitc122159a2c090c68c81e277a8518ae21::getInitializer($loader));
     32        call_user_func(\Composer\Autoload\ComposerStaticInit2635a5e5e04df97aa633ddc41a392ae7::getInitializer($loader));
    3333
    3434        $loader->register(true);
    3535
    36         $filesToLoad = \Composer\Autoload\ComposerStaticInitc122159a2c090c68c81e277a8518ae21::$files;
     36        $filesToLoad = \Composer\Autoload\ComposerStaticInit2635a5e5e04df97aa633ddc41a392ae7::$files;
    3737        $requireFile = \Closure::bind(static function ($fileIdentifier, $file) {
    3838            if (empty($GLOBALS['__composer_autoload_files'][$fileIdentifier])) {
  • nostrtium/tags/0.7.0/vendor/composer/autoload_static.php

    r2905773 r2921576  
    55namespace Composer\Autoload;
    66
    7 class ComposerStaticInitc122159a2c090c68c81e277a8518ae21
     7class ComposerStaticInit2635a5e5e04df97aa633ddc41a392ae7
    88{
    99    public static $files = array (
     
    106106
    107107    public static $fallbackDirsPsr4 = array (
    108         0 => __DIR__ . '/..' . '/phrity/net-uri/src',
    109         1 => __DIR__ . '/..' . '/phrity/util-errorhandler/src',
     108        0 => __DIR__ . '/..' . '/phrity/util-errorhandler/src',
     109        1 => __DIR__ . '/..' . '/phrity/net-uri/src',
    110110    );
    111111
     
    367367    {
    368368        return \Closure::bind(function () use ($loader) {
    369             $loader->prefixLengthsPsr4 = ComposerStaticInitc122159a2c090c68c81e277a8518ae21::$prefixLengthsPsr4;
    370             $loader->prefixDirsPsr4 = ComposerStaticInitc122159a2c090c68c81e277a8518ae21::$prefixDirsPsr4;
    371             $loader->fallbackDirsPsr4 = ComposerStaticInitc122159a2c090c68c81e277a8518ae21::$fallbackDirsPsr4;
    372             $loader->classMap = ComposerStaticInitc122159a2c090c68c81e277a8518ae21::$classMap;
     369            $loader->prefixLengthsPsr4 = ComposerStaticInit2635a5e5e04df97aa633ddc41a392ae7::$prefixLengthsPsr4;
     370            $loader->prefixDirsPsr4 = ComposerStaticInit2635a5e5e04df97aa633ddc41a392ae7::$prefixDirsPsr4;
     371            $loader->fallbackDirsPsr4 = ComposerStaticInit2635a5e5e04df97aa633ddc41a392ae7::$fallbackDirsPsr4;
     372            $loader->classMap = ComposerStaticInit2635a5e5e04df97aa633ddc41a392ae7::$classMap;
    373373
    374374        }, null, ClassLoader::class);
  • nostrtium/tags/0.7.0/vendor/composer/installed.php

    r2905773 r2921576  
    22    'root' => array(
    33        'name' => 'pjv/nostrtium',
    4         'pretty_version' => 'v0.6.1',
    5         'version' => '0.6.1.0',
    6         'reference' => '3b1ad964ebf0e59510e247fd7f9638d1883c77f6',
     4        'pretty_version' => 'v0.7.0',
     5        'version' => '0.7.0.0',
     6        'reference' => '2f15d1be5548b5900bd23ad9e6d4169c51dc9712',
    77        'type' => 'library',
    88        'install_path' => __DIR__ . '/../../',
     
    9999        ),
    100100        'pjv/nostrtium' => array(
    101             'pretty_version' => 'v0.6.1',
    102             'version' => '0.6.1.0',
    103             'reference' => '3b1ad964ebf0e59510e247fd7f9638d1883c77f6',
     101            'pretty_version' => 'v0.7.0',
     102            'version' => '0.7.0.0',
     103            'reference' => '2f15d1be5548b5900bd23ad9e6d4169c51dc9712',
    104104            'type' => 'library',
    105105            'install_path' => __DIR__ . '/../../',
  • nostrtium/tags/0.7.0/views/metabox.php

    r2905773 r2921576  
    33  echo get_permalink($post->ID);?>
    44</textarea>
    5 <?php if($post->_nostrtium_posted): ?>
    6 <button disabled="disabled" id="nostrtium-post" class="ui button" style="margin-top:15px">POSTED</button>
    7 <?php else: ?>
    8 <button id="nostrtium-post" class="ui button" style="margin-top:15px">Post to Nostr</button>
     5<?php if ($post->_nostrtium_posted) : ?>
     6  <button disabled="disabled" id="nostrtium-post" class="ui button" style="margin-top:15px">POSTED</button>
     7<?php else : ?>
     8  <button id="nostrtium-post" class="ui button" style="margin-top:15px">Post to Nostr</button>
    99<?php endif; ?>
    1010
     
    1313  <p class="" id="nostr-log">Please wait...</p>
    1414</div>
    15 
    16 <?php
  • nostrtium/tags/0.7.0/views/settings-page.php

    r2905773 r2921576  
    22  <h1 class="ui header">Nostrtium Settings</h1>
    33
    4   <div class="ui form">
    5     <div class="ten wide field">
    6       <div class="ui action labeled input">
    7         <div class="ui label">
    8           Private Key
     4  <div class="ui stackable grid container">
     5    <div class="row">
     6      <div class="sixteen wide column">
     7        <div class="ui form">
     8          <div class="eleven wide field">
     9            <div class="ui action labeled input">
     10              <div class="ui label">
     11                Private Key
     12              </div>
     13
     14              <?php if ($this->encrypted_privkey != '') : ?>
     15                <input type="password" id="private-key" name="private-key" placeholder="nsec1..." value="Encrypted private key stored 101010101010101010101010101010101010">
     16                <button id="save-private-key" type="button" class="ui icon green button">
     17                  <i class="check icon"></i>
     18                </button>
     19              <?php else : ?>
     20                <input type="password" id="private-key" name="private-key" placeholder="nsec1...">
     21                <button id="save-private-key" type="button" class="ui icon violet button">
     22                  <i class="save icon"></i>
     23                </button>
     24              <?php endif; ?>
     25
     26            </div>
     27          </div>
    928        </div>
    10 
    11         <?php if ($this->encrypted_privkey != '') : ?>
    12           <input type="password" id="private-key" name="private-key" placeholder="nsec1..." value="Encrypted private key stored 101010101010101010101010101010101010">
    13           <button id="save-private-key" type="button" class="ui icon green button">
    14             <i class="check icon"></i>
    15           </button>
    16         <?php else : ?>
    17           <input type="password" id="private-key" name="private-key" placeholder="nsec1...">
    18           <button id="save-private-key" type="button" class="ui icon violet button">
    19             <i class="save icon"></i>
    20           </button>
    21         <?php endif; ?>
    22 
    2329      </div>
    2430    </div>
     31
     32    <div class="row">
     33      <div class="six wide column">
     34        <table class="ui collapsing celled striped table">
     35          <thead>
     36            <tr>
     37              <th colspan="3">
     38                Relays
     39              </th>
     40            </tr>
     41          </thead>
     42          <tbody id="relay-tbody">
     43          </tbody>
     44        </table>
     45
     46        <div class="ui form">
     47          <div class="ui action labeled fluid input">
     48            <div class="ui label">
     49              Add Relay
     50            </div>
     51            <input type="text" id="new-relay-url" name="new-relay-url" placeholder="wss://...">
     52            <button id="add-relay" type="button" class="ui icon violet button disabled">
     53              <i class="save icon"></i>
     54            </button>
     55          </div>
     56        </div>
     57      </div>
     58
     59      <div class="five wide column">
     60        <div id="ap-segment" class="ui segment">
     61          <div class="ui form">
     62            <div class="inline field">
     63              <div class="ui toggle checkbox <?php echo $ap_checked; ?>" id="auto-publish">
     64                <input type="checkbox" name="auto-publish">
     65                <label>Auto Post</label>
     66              </div>
     67              <div id="auto-publish-fields" class="grouped disabled fields" style="margin-left:20px">
     68                <div class="inline field">
     69                  <div id="post-excerpt" class="ui checkbox ap <?php echo $excerpt_checked; ?>">
     70                    <input type="checkbox" name="post-excerpt">
     71                    <label>Excerpt</label>
     72                  </div>
     73                </div>
     74                <div class="inline field">
     75                  <div id="permalink" class="ui checkbox ap <?php echo $permalink_checked; ?>">
     76                    <input type="checkbox" name="permalink">
     77                    <label>Permalink</label>
     78                  </div>
     79                </div>
     80                <div class="inline disabled field">
     81                  <div id="whole-post" class="ui checkbox ap <?php echo $whole_post_checked; ?>">
     82                    <input type="checkbox" name="whole-post">
     83                    <label>Whole Post Markdown (Coming)</label>
     84                  </div>
     85                </div>
     86              </div>
     87            </div>
     88          </div>
     89        </div>
     90      </div>
     91
     92    </div>
     93
     94
    2595  </div>
    26   <div class="ui hidden divider"></div>
    27   <table class="ui collapsing celled striped table">
    28     <thead>
    29       <tr>
    30         <th colspan="3">
    31           Relays
    32         </th>
    33       </tr>
    34     </thead>
    35     <tbody id="relay-tbody">
    36     </tbody>
    37   </table>
    38   <div class="ui hidden divider"></div>
    3996
    40   <div class="ui form">
    41     <div class="five wide field">
    42       <div class="ui action labeled input">
    43         <div class="ui label">
    44           Add Relay
    45         </div>
    46         <input type="text" id="new-relay-url" name="new-relay-url" placeholder="wss://...">
    47         <button id="add-relay" type="button" class="ui icon violet button disabled">
    48           <i class="save icon"></i>
    49         </button>
    50       </div>
    51     </div>
    52   </div>
     97
    5398</div>
  • nostrtium/trunk/classes/class-nostrtium-requirements-check.php

    r2905773 r2921576  
    7979  public function dir_writeable_notice() {
    8080    echo '<div class="error">';
    81     echo '<p>The &#8220;' . esc_html($this->title) . '&#8221; plugin cannot run without its own directory being writeable.</p>';
     81    echo '<p>The &#8220;' . esc_html($this->title) . '&#8221; plugin cannot run without the wp-content/uploads directory being writeable.</p>';
    8282    echo '</div>';
    8383  }
  • nostrtium/trunk/classes/class-nostrtium-settings.php

    r2905773 r2921576  
    1717  public $encrypted_privkey = '';
    1818  public $keyfile = '';
     19  public $auto_publish_settings = null;
    1920
    2021  // singleton
     
    3435      add_action('wp_ajax_pjv_nostrtium_save_relays', [$this, 'save_relays']);
    3536      add_action('wp_ajax_pjv_nostrtium_save_private_key', [$this, 'save_private_key']);
     37      add_action('wp_ajax_pjv_nostrtium_save_auto_publish', [$this, 'save_auto_publish_settings']);
    3638
    3739      if ($pagenow == 'plugins.php') {
     
    3941      }
    4042    }
    41     $this->relays = $this->get_relays();
    42     $this->encrypted_privkey = $this->get_encrypted_key();
    43     $this->keyfile = PJV_NOSTRTIUM_DIR . 'keyfile.key';
     43    $this->relays                  = $this->get_relays();
     44    $this->encrypted_privkey       = $this->get_encrypted_key();
     45    $this->keyfile                 = PJV_NOSTRTIUM_STORAGE . 'keyfile.key';
     46    $this->auto_publish_settings   = $this->get_auto_publish_settings();
     47  }
     48
     49  public function get_auto_publish_settings() {
     50    return get_option('nostrtium-auto-publish');
     51  }
     52  public function set_auto_publish_settings(array $ap) {
     53    update_option('nostrtium-auto-publish', $ap);
     54  }
     55  public function save_auto_publish_settings() {
     56    check_ajax_referer('nostrtium-ajax-nonce', 'security');
     57    $this->check_user();
     58
     59    $ap = $_POST['apSettings'] ?? null;
     60    if ($ap == null) {
     61      wp_send_json_error('No auto publish settings received.');
     62    }
     63
     64    foreach ($ap as $key => &$value) {
     65      $value = rest_sanitize_boolean($value);
     66    }
     67
     68    $this->set_auto_publish_settings($ap);
     69    wp_send_json_success();
    4470  }
    4571
     
    6288
    6389  public function render_settings_page() {
     90    $ap_checked = $this->auto_publish_settings['autoPublish'] ? "checked" : "";
     91    $excerpt_checked = $this->auto_publish_settings['apExcerpt'] ? "checked" : "";
     92    $permalink_checked = $this->auto_publish_settings['apPermalink'] ? "checked" : "";
     93    $whole_post_checked = $this->auto_publish_settings['apWholePost'] ? "checked" : "";
    6494    include PJV_NOSTRTIUM_DIR . 'views/settings-page.php';
    6595  }
  • nostrtium/trunk/classes/class-nostrtium.php

    r2905773 r2921576  
    1414class Nostrtium {
    1515  private static $instance = null;
    16   public  $version         = '';
    1716  private $settings        = null;
    18   public  $keyfile         = '';
     17  public $keyfile          = '';
    1918
    2019  // singleton
     
    3029    require_once PJV_NOSTRTIUM_DIR . 'classes/class-nostrtium-metabox.php';
    3130    require_once PJV_NOSTRTIUM_DIR . 'classes/class-nostrtium-settings.php';
    32     $this->version  = PJV_NOSTRTIUM_VERSION;
    3331    $this->settings = Nostrtium_Settings::get_instance();
    34     $this->keyfile  = PJV_NOSTRTIUM_DIR . 'keyfile.key';
     32    $this->keyfile  = PJV_NOSTRTIUM_STORAGE . 'keyfile.key';
    3533
    3634    if (is_admin()) {
     
    3836      add_action('wp_ajax_pjv_nostrtium_post_note', [$this, 'post_note']);
    3937    }
     38
     39    add_action('publish_post', [$this, 'maybe_publish_post_to_nostr'], 10, 2);
     40    add_action('plugins_loaded', [$this, 'check_version']);
    4041  }
    4142
     
    7374        'relays'          => $this->settings->relays,
    7475        'private_key_set' => $private_key_set,
     76        'ap_settings'     => $this->settings->auto_publish_settings,
    7577      ];
    7678      wp_localize_script('nostrtium-settings.js', 'nostrtium', $local_arr);
    7779      wp_enqueue_script('nostrtium-settings.js');
     80    }
     81  }
     82
     83  public function maybe_publish_post_to_nostr($post_id, $post) {
     84    if (!$post->_nostrtium_posted && $this->settings->auto_publish_settings['autoPublish']) {
     85      $note = "";
     86
     87      if ($this->settings->auto_publish_settings['apExcerpt']) {
     88        $note .= get_the_excerpt($post->ID) . "\n\n";
     89      }
     90
     91      if ($this->settings->auto_publish_settings['apPermalink']) {
     92        $note .= get_permalink($post->ID);
     93      }
     94
     95      if ($this->settings->auto_publish_settings['apWholePost']) {
     96        # code...
     97      }
     98
     99      $result = $this->send_note($note);
     100
     101      if ($result->sent) {
     102        if ($post_id > 0) {
     103          update_post_meta($post_id, '_nostrtium_posted', true);
     104        }
     105      }
    78106    }
    79107  }
     
    116144  }
    117145
    118   public function activate() {
     146  public function check_version() {
     147    if (PJV_NOSTRTIUM_VERSION !== get_option('nostrtium-version')) {
     148      $this->activate();
     149    }
     150  }
     151
     152  private function set_keyfile() {
     153    # set up storage directory
     154    if (!file_exists(PJV_NOSTRTIUM_STORAGE)) wp_mkdir_p(PJV_NOSTRTIUM_STORAGE);
     155
    119156    # set up encryption key
    120157    if (!file_exists($this->keyfile)) {
     158      // wipe out any previously stored private key
     159      update_option('nostrtium-enc-privkey', '');
     160      $this->settings->encrypted_privkey = '';
     161      // generate and save keyfile
    121162      $encKey = KeyFactory::generateEncryptionKey();
    122163      KeyFactory::save($encKey, $this->keyfile);
    123164    }
    124 
     165  }
     166
     167  public function activate() {
     168    $this->set_keyfile();
     169   
    125170    // initial seed relays
    126171    if (!get_option('nostrtium-relays')) {
    127172      $relays = [
    128173        'wss://relay.damus.io',
    129         'wss://nostr-pub.wellorder.net',
    130         'wss://relay.wellorder.net',
    131174        'wss://nos.lol',
    132175        'wss://nostr.mom',
    133176        'wss://no.str.cr',
    134177        'wss://relay.snort.social',
    135         'wss://nostr.milou.lol',
    136178        'wss://nostr.bitcoiner.social',
    137         'wss://relay.nostrid.com',
    138         'wss://relay.nostrcheck.me',
    139         'wss://relayable.org',
    140179      ];
    141180      update_option('nostrtium-relays', $relays);
    142181    }
     182   
     183    // save new plugin version to db
     184    update_option('nostrtium-version', PJV_NOSTRTIUM_VERSION);
    143185  }
    144186
     
    181223    }
    182224
    183     $r       = new stdClass;
     225    $r = new stdClass;
    184226    $r->sent = $sent;
    185     $r->log  = $log;
     227    $r->log = $log;
    186228
    187229    return $r;
  • nostrtium/trunk/js/nostrtium-settings.js

    r2905773 r2921576  
    33  // execute when the DOM is ready
    44  $(document).ready(function () {
     5    var loading = true;
     6
    57    function buildRelayTable() {
    68      var tbody = $("#relay-tbody");
     
    3941        }
    4042      });
     43    }
     44
     45    function saveAutoPublishSettings() {
     46      if (loading) {
     47        return;
     48      }
     49      var apSettings = {
     50        autoPublish: $("#auto-publish").checkbox("is checked"),
     51        apExcerpt: $("#post-excerpt").checkbox("is checked"),
     52        apPermalink: $("#permalink").checkbox("is checked"),
     53        apWholePost: $("#whole-post").checkbox("is checked"),
     54      };
     55      var data = {
     56        action: "pjv_nostrtium_save_auto_publish",
     57        apSettings: apSettings,
     58        security: nostrtium.security,
     59      };
     60      $.post(nostrtium.ajaxurl, data, function (response) {
     61        if (response.success) {
     62          $("body").toast({
     63            class: "success",
     64            message: `Settings updated.`,
     65          });
     66        } else {
     67          alert(response.data);
     68        }
     69      });
     70    }
     71
     72    function setupCheckboxes() {
     73      if (nostrtium.ap_settings.autoPublish) {
     74        $("#auto-publish").checkbox("check");
     75      } else {
     76        $("#auto-publish").checkbox("uncheck");
     77      }
     78
     79      if (nostrtium.ap_settings.apExcerpt) {
     80        $("#post-excerpt").checkbox("check");
     81      } else {
     82        $("#post-excerpt").checkbox("uncheck");
     83      }
     84
     85      if (nostrtium.ap_settings.apPermalink) {
     86        $("#permalink").checkbox("check");
     87      } else {
     88        $("#permalink").checkbox("uncheck");
     89      }
     90      if (nostrtium.ap_settings.apWholePost) {
     91        $("#whole_post").checkbox("check");
     92      } else {
     93        $("#whole_post").checkbox("uncheck");
     94      }
    4195    }
    4296
     
    117171    });
    118172
     173    $("#auto-publish").checkbox({
     174      onChecked: function () {
     175        $("#auto-publish-fields").removeClass("disabled");
     176      },
     177      onUnchecked: function () {
     178        $("#auto-publish-fields").addClass("disabled");
     179      },
     180      onChange: function () {
     181        saveAutoPublishSettings();
     182      },
     183    });
     184
     185    $(".ui.checkbox.ap").checkbox({
     186      onChange: function () {
     187        saveAutoPublishSettings();
     188      },
     189    });
     190
    119191    buildRelayTable();
     192    setupCheckboxes();
     193    loading = false;
    120194  });
    121195})(jQuery, window, document);
  • nostrtium/trunk/nostrtium.php

    r2905773 r2921576  
    99 * Text Domain:      nostrtium
    1010 * Domain Path:      /languages
    11  * Version:          0.6.1
     11 * Version:          0.7.0
    1212 * Requires at least 6.0
    1313 * Requires PHP      8.1
     
    2222}
    2323
    24 define('PJV_NOSTRTIUM_VERSION', '0.6.1');
     24define('PJV_NOSTRTIUM_VERSION', '0.7.0');
    2525define('PJV_NOSTRTIUM_DIR', plugin_dir_path(__FILE__));
    2626define('PJV_NOSTRTIUM_DEFAULT_USER_ROLE', 'edit_posts');
     27define('PJV_NOSTRTIUM_STORAGE', wp_upload_dir()['basedir'] . '/nostrtium_' . md5(LOGGED_IN_SALT) . '/');
    2728
    2829require_once PJV_NOSTRTIUM_DIR . 'classes/class-nostrtium-requirements-check.php';
     
    3132  'php'   => '8.1',
    3233  'wp'    => '6.0',
    33   'dir'   => PJV_NOSTRTIUM_DIR,
     34  'dir'   => wp_upload_dir()['basedir'],
    3435  'file'  => __FILE__,
    3536]);
    3637if ($pjv_nostrtium_requirements_check->passes()) {
    37   require_once PJV_NOSTRTIUM_DIR . '/vendor/autoload.php';
     38  require_once PJV_NOSTRTIUM_DIR . 'vendor/autoload.php';
    3839  require_once PJV_NOSTRTIUM_DIR . 'classes/class-nostrtium.php';
    3940  $pjv_nostrtium_plugin = Nostrtium::get_instance();
  • nostrtium/trunk/readme.txt

    r2906331 r2921576  
    55Requires at least: 6.0
    66Requires PHP: 8.1
    7 Tested up to: 6.2
    8 Stable tag: 0.6.1
     7Tested up to: 6.2.2
     8Stable tag: 0.7.0
    99License: Unlicense
    1010License URI: https://unlicense.org
     
    1616Nostrtium lets you post from WordPress to [nostr](https://nostr.how/en/what-is-nostr).
    1717
    18 This initial version just implements basic nostr settings (private key, relays) and provides a metabox in the WordPress Post editing page which is pre-populated with the Post Excerpt and a link to the Post and lets you post the content of that metabox to your configured relays.
     18This version implements basic nostr settings (private key, relays) and provides a metabox in the WordPress Post editing page which is pre-populated with the Post Excerpt and a link to the Post and lets you post the content of that metabox to your configured relays.
    1919
    2020You can change the content in the metabox as you like. If you have a good excerpt and post it as-is, it creates a twitter-style "announcement" note on nostr. A lot of nostr clients will render the link to the WordPress post as a nice-looking summary card with featured image and etc. This functionality is probably enough for many use-cases but I have plans to add more functionality to this plugin in the future, including generation of keys; support for NIP-07 browser extensions; separate nostr profiles for individual WP users; support for full, long-form content from WP to nostr; and more.
     21
     22There are also options (on the settings page) to auto-post to nostr the excerpt, the permalink, or both upon WordPress post publication.
    2123
    2224[Note that the private key is stored encrypted in the WordPress database using libsodium cryptography.]
     
    3032* php-gmp module must be installed ([Installation on Ubuntu](https://computingforgeeks.com/how-to-install-php-on-ubuntu-linux-system/))
    3133* WordPress 6.0+
    32 * Writable installation directory (on activation, the plugin writes a cryptographic keyfile to its own install directory)
     34* Writable uploads directory (on activation, the plugin writes a cryptographic keyfile to a storage directory)
    3335
    3436### How to Use
     
    5961== Screenshots ==
    6062
    61 1. Nostr relay management
    62 2. Post to Nostr metabox
     631. Nostrtium settings
     642. Post to nostr metabox
    6365
    6466== Changelog ==
    6567
     68= 0.7.0 =
     69* Allow auto posting excerpt, permalink, or both on publication of WordPress post.
     70* NOTE: If you have installed a prior version, this update requires you to re-enter your private key on the Nostrtium settings page. This is a one-time occurrence.
     71
    6672= 0.6.1 =
    6773* Initial public release
  • nostrtium/trunk/vendor/autoload.php

    r2905773 r2921576  
    2323require_once __DIR__ . '/composer/autoload_real.php';
    2424
    25 return ComposerAutoloaderInitc122159a2c090c68c81e277a8518ae21::getLoader();
     25return ComposerAutoloaderInit2635a5e5e04df97aa633ddc41a392ae7::getLoader();
  • nostrtium/trunk/vendor/composer/autoload_psr4.php

    r2905773 r2921576  
    2020    'BN\\' => array($vendorDir . '/simplito/bn-php/lib'),
    2121    'BI\\' => array($vendorDir . '/simplito/bigint-wrapper-php/lib'),
    22     '' => array($vendorDir . '/phrity/net-uri/src', $vendorDir . '/phrity/util-errorhandler/src'),
     22    '' => array($vendorDir . '/phrity/util-errorhandler/src', $vendorDir . '/phrity/net-uri/src'),
    2323);
  • nostrtium/trunk/vendor/composer/autoload_real.php

    r2905773 r2921576  
    33// autoload_real.php @generated by Composer
    44
    5 class ComposerAutoloaderInitc122159a2c090c68c81e277a8518ae21
     5class ComposerAutoloaderInit2635a5e5e04df97aa633ddc41a392ae7
    66{
    77    private static $loader;
     
    2525        require __DIR__ . '/platform_check.php';
    2626
    27         spl_autoload_register(array('ComposerAutoloaderInitc122159a2c090c68c81e277a8518ae21', 'loadClassLoader'), true, true);
     27        spl_autoload_register(array('ComposerAutoloaderInit2635a5e5e04df97aa633ddc41a392ae7', 'loadClassLoader'), true, true);
    2828        self::$loader = $loader = new \Composer\Autoload\ClassLoader(\dirname(__DIR__));
    29         spl_autoload_unregister(array('ComposerAutoloaderInitc122159a2c090c68c81e277a8518ae21', 'loadClassLoader'));
     29        spl_autoload_unregister(array('ComposerAutoloaderInit2635a5e5e04df97aa633ddc41a392ae7', 'loadClassLoader'));
    3030
    3131        require __DIR__ . '/autoload_static.php';
    32         call_user_func(\Composer\Autoload\ComposerStaticInitc122159a2c090c68c81e277a8518ae21::getInitializer($loader));
     32        call_user_func(\Composer\Autoload\ComposerStaticInit2635a5e5e04df97aa633ddc41a392ae7::getInitializer($loader));
    3333
    3434        $loader->register(true);
    3535
    36         $filesToLoad = \Composer\Autoload\ComposerStaticInitc122159a2c090c68c81e277a8518ae21::$files;
     36        $filesToLoad = \Composer\Autoload\ComposerStaticInit2635a5e5e04df97aa633ddc41a392ae7::$files;
    3737        $requireFile = \Closure::bind(static function ($fileIdentifier, $file) {
    3838            if (empty($GLOBALS['__composer_autoload_files'][$fileIdentifier])) {
  • nostrtium/trunk/vendor/composer/autoload_static.php

    r2905773 r2921576  
    55namespace Composer\Autoload;
    66
    7 class ComposerStaticInitc122159a2c090c68c81e277a8518ae21
     7class ComposerStaticInit2635a5e5e04df97aa633ddc41a392ae7
    88{
    99    public static $files = array (
     
    106106
    107107    public static $fallbackDirsPsr4 = array (
    108         0 => __DIR__ . '/..' . '/phrity/net-uri/src',
    109         1 => __DIR__ . '/..' . '/phrity/util-errorhandler/src',
     108        0 => __DIR__ . '/..' . '/phrity/util-errorhandler/src',
     109        1 => __DIR__ . '/..' . '/phrity/net-uri/src',
    110110    );
    111111
     
    367367    {
    368368        return \Closure::bind(function () use ($loader) {
    369             $loader->prefixLengthsPsr4 = ComposerStaticInitc122159a2c090c68c81e277a8518ae21::$prefixLengthsPsr4;
    370             $loader->prefixDirsPsr4 = ComposerStaticInitc122159a2c090c68c81e277a8518ae21::$prefixDirsPsr4;
    371             $loader->fallbackDirsPsr4 = ComposerStaticInitc122159a2c090c68c81e277a8518ae21::$fallbackDirsPsr4;
    372             $loader->classMap = ComposerStaticInitc122159a2c090c68c81e277a8518ae21::$classMap;
     369            $loader->prefixLengthsPsr4 = ComposerStaticInit2635a5e5e04df97aa633ddc41a392ae7::$prefixLengthsPsr4;
     370            $loader->prefixDirsPsr4 = ComposerStaticInit2635a5e5e04df97aa633ddc41a392ae7::$prefixDirsPsr4;
     371            $loader->fallbackDirsPsr4 = ComposerStaticInit2635a5e5e04df97aa633ddc41a392ae7::$fallbackDirsPsr4;
     372            $loader->classMap = ComposerStaticInit2635a5e5e04df97aa633ddc41a392ae7::$classMap;
    373373
    374374        }, null, ClassLoader::class);
  • nostrtium/trunk/vendor/composer/installed.php

    r2905773 r2921576  
    22    'root' => array(
    33        'name' => 'pjv/nostrtium',
    4         'pretty_version' => 'v0.6.1',
    5         'version' => '0.6.1.0',
    6         'reference' => '3b1ad964ebf0e59510e247fd7f9638d1883c77f6',
     4        'pretty_version' => 'v0.7.0',
     5        'version' => '0.7.0.0',
     6        'reference' => '2f15d1be5548b5900bd23ad9e6d4169c51dc9712',
    77        'type' => 'library',
    88        'install_path' => __DIR__ . '/../../',
     
    9999        ),
    100100        'pjv/nostrtium' => array(
    101             'pretty_version' => 'v0.6.1',
    102             'version' => '0.6.1.0',
    103             'reference' => '3b1ad964ebf0e59510e247fd7f9638d1883c77f6',
     101            'pretty_version' => 'v0.7.0',
     102            'version' => '0.7.0.0',
     103            'reference' => '2f15d1be5548b5900bd23ad9e6d4169c51dc9712',
    104104            'type' => 'library',
    105105            'install_path' => __DIR__ . '/../../',
  • nostrtium/trunk/views/metabox.php

    r2905773 r2921576  
    33  echo get_permalink($post->ID);?>
    44</textarea>
    5 <?php if($post->_nostrtium_posted): ?>
    6 <button disabled="disabled" id="nostrtium-post" class="ui button" style="margin-top:15px">POSTED</button>
    7 <?php else: ?>
    8 <button id="nostrtium-post" class="ui button" style="margin-top:15px">Post to Nostr</button>
     5<?php if ($post->_nostrtium_posted) : ?>
     6  <button disabled="disabled" id="nostrtium-post" class="ui button" style="margin-top:15px">POSTED</button>
     7<?php else : ?>
     8  <button id="nostrtium-post" class="ui button" style="margin-top:15px">Post to Nostr</button>
    99<?php endif; ?>
    1010
     
    1313  <p class="" id="nostr-log">Please wait...</p>
    1414</div>
    15 
    16 <?php
  • nostrtium/trunk/views/settings-page.php

    r2905773 r2921576  
    22  <h1 class="ui header">Nostrtium Settings</h1>
    33
    4   <div class="ui form">
    5     <div class="ten wide field">
    6       <div class="ui action labeled input">
    7         <div class="ui label">
    8           Private Key
     4  <div class="ui stackable grid container">
     5    <div class="row">
     6      <div class="sixteen wide column">
     7        <div class="ui form">
     8          <div class="eleven wide field">
     9            <div class="ui action labeled input">
     10              <div class="ui label">
     11                Private Key
     12              </div>
     13
     14              <?php if ($this->encrypted_privkey != '') : ?>
     15                <input type="password" id="private-key" name="private-key" placeholder="nsec1..." value="Encrypted private key stored 101010101010101010101010101010101010">
     16                <button id="save-private-key" type="button" class="ui icon green button">
     17                  <i class="check icon"></i>
     18                </button>
     19              <?php else : ?>
     20                <input type="password" id="private-key" name="private-key" placeholder="nsec1...">
     21                <button id="save-private-key" type="button" class="ui icon violet button">
     22                  <i class="save icon"></i>
     23                </button>
     24              <?php endif; ?>
     25
     26            </div>
     27          </div>
    928        </div>
    10 
    11         <?php if ($this->encrypted_privkey != '') : ?>
    12           <input type="password" id="private-key" name="private-key" placeholder="nsec1..." value="Encrypted private key stored 101010101010101010101010101010101010">
    13           <button id="save-private-key" type="button" class="ui icon green button">
    14             <i class="check icon"></i>
    15           </button>
    16         <?php else : ?>
    17           <input type="password" id="private-key" name="private-key" placeholder="nsec1...">
    18           <button id="save-private-key" type="button" class="ui icon violet button">
    19             <i class="save icon"></i>
    20           </button>
    21         <?php endif; ?>
    22 
    2329      </div>
    2430    </div>
     31
     32    <div class="row">
     33      <div class="six wide column">
     34        <table class="ui collapsing celled striped table">
     35          <thead>
     36            <tr>
     37              <th colspan="3">
     38                Relays
     39              </th>
     40            </tr>
     41          </thead>
     42          <tbody id="relay-tbody">
     43          </tbody>
     44        </table>
     45
     46        <div class="ui form">
     47          <div class="ui action labeled fluid input">
     48            <div class="ui label">
     49              Add Relay
     50            </div>
     51            <input type="text" id="new-relay-url" name="new-relay-url" placeholder="wss://...">
     52            <button id="add-relay" type="button" class="ui icon violet button disabled">
     53              <i class="save icon"></i>
     54            </button>
     55          </div>
     56        </div>
     57      </div>
     58
     59      <div class="five wide column">
     60        <div id="ap-segment" class="ui segment">
     61          <div class="ui form">
     62            <div class="inline field">
     63              <div class="ui toggle checkbox <?php echo $ap_checked; ?>" id="auto-publish">
     64                <input type="checkbox" name="auto-publish">
     65                <label>Auto Post</label>
     66              </div>
     67              <div id="auto-publish-fields" class="grouped disabled fields" style="margin-left:20px">
     68                <div class="inline field">
     69                  <div id="post-excerpt" class="ui checkbox ap <?php echo $excerpt_checked; ?>">
     70                    <input type="checkbox" name="post-excerpt">
     71                    <label>Excerpt</label>
     72                  </div>
     73                </div>
     74                <div class="inline field">
     75                  <div id="permalink" class="ui checkbox ap <?php echo $permalink_checked; ?>">
     76                    <input type="checkbox" name="permalink">
     77                    <label>Permalink</label>
     78                  </div>
     79                </div>
     80                <div class="inline disabled field">
     81                  <div id="whole-post" class="ui checkbox ap <?php echo $whole_post_checked; ?>">
     82                    <input type="checkbox" name="whole-post">
     83                    <label>Whole Post Markdown (Coming)</label>
     84                  </div>
     85                </div>
     86              </div>
     87            </div>
     88          </div>
     89        </div>
     90      </div>
     91
     92    </div>
     93
     94
    2595  </div>
    26   <div class="ui hidden divider"></div>
    27   <table class="ui collapsing celled striped table">
    28     <thead>
    29       <tr>
    30         <th colspan="3">
    31           Relays
    32         </th>
    33       </tr>
    34     </thead>
    35     <tbody id="relay-tbody">
    36     </tbody>
    37   </table>
    38   <div class="ui hidden divider"></div>
    3996
    40   <div class="ui form">
    41     <div class="five wide field">
    42       <div class="ui action labeled input">
    43         <div class="ui label">
    44           Add Relay
    45         </div>
    46         <input type="text" id="new-relay-url" name="new-relay-url" placeholder="wss://...">
    47         <button id="add-relay" type="button" class="ui icon violet button disabled">
    48           <i class="save icon"></i>
    49         </button>
    50       </div>
    51     </div>
    52   </div>
     97
    5398</div>
Note: See TracChangeset for help on using the changeset viewer.