Changeset 2921576
- Timestamp:
- 06/05/2023 11:04:32 AM (3 years ago)
- Location:
- nostrtium
- Files:
-
- 27 edited
- 1 copied
-
assets/screenshot-1.png (modified) (previous)
-
tags/0.7.0 (copied) (copied from nostrtium/trunk)
-
tags/0.7.0/classes/class-nostrtium-requirements-check.php (modified) (1 diff)
-
tags/0.7.0/classes/class-nostrtium-settings.php (modified) (4 diffs)
-
tags/0.7.0/classes/class-nostrtium.php (modified) (6 diffs)
-
tags/0.7.0/js/nostrtium-settings.js (modified) (3 diffs)
-
tags/0.7.0/nostrtium.php (modified) (3 diffs)
-
tags/0.7.0/readme.txt (modified) (4 diffs)
-
tags/0.7.0/vendor/autoload.php (modified) (1 diff)
-
tags/0.7.0/vendor/composer/autoload_psr4.php (modified) (1 diff)
-
tags/0.7.0/vendor/composer/autoload_real.php (modified) (2 diffs)
-
tags/0.7.0/vendor/composer/autoload_static.php (modified) (3 diffs)
-
tags/0.7.0/vendor/composer/installed.php (modified) (2 diffs)
-
tags/0.7.0/views/metabox.php (modified) (2 diffs)
-
tags/0.7.0/views/settings-page.php (modified) (1 diff)
-
trunk/classes/class-nostrtium-requirements-check.php (modified) (1 diff)
-
trunk/classes/class-nostrtium-settings.php (modified) (4 diffs)
-
trunk/classes/class-nostrtium.php (modified) (6 diffs)
-
trunk/js/nostrtium-settings.js (modified) (3 diffs)
-
trunk/nostrtium.php (modified) (3 diffs)
-
trunk/readme.txt (modified) (4 diffs)
-
trunk/vendor/autoload.php (modified) (1 diff)
-
trunk/vendor/composer/autoload_psr4.php (modified) (1 diff)
-
trunk/vendor/composer/autoload_real.php (modified) (2 diffs)
-
trunk/vendor/composer/autoload_static.php (modified) (3 diffs)
-
trunk/vendor/composer/installed.php (modified) (2 diffs)
-
trunk/views/metabox.php (modified) (2 diffs)
-
trunk/views/settings-page.php (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
nostrtium/tags/0.7.0/classes/class-nostrtium-requirements-check.php
r2905773 r2921576 79 79 public function dir_writeable_notice() { 80 80 echo '<div class="error">'; 81 echo '<p>The “' . esc_html($this->title) . '” plugin cannot run without its owndirectory being writeable.</p>';81 echo '<p>The “' . esc_html($this->title) . '” plugin cannot run without the wp-content/uploads directory being writeable.</p>'; 82 82 echo '</div>'; 83 83 } -
nostrtium/tags/0.7.0/classes/class-nostrtium-settings.php
r2905773 r2921576 17 17 public $encrypted_privkey = ''; 18 18 public $keyfile = ''; 19 public $auto_publish_settings = null; 19 20 20 21 // singleton … … 34 35 add_action('wp_ajax_pjv_nostrtium_save_relays', [$this, 'save_relays']); 35 36 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']); 36 38 37 39 if ($pagenow == 'plugins.php') { … … 39 41 } 40 42 } 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(); 44 70 } 45 71 … … 62 88 63 89 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" : ""; 64 94 include PJV_NOSTRTIUM_DIR . 'views/settings-page.php'; 65 95 } -
nostrtium/tags/0.7.0/classes/class-nostrtium.php
r2905773 r2921576 14 14 class Nostrtium { 15 15 private static $instance = null; 16 public $version = '';17 16 private $settings = null; 18 public $keyfile= '';17 public $keyfile = ''; 19 18 20 19 // singleton … … 30 29 require_once PJV_NOSTRTIUM_DIR . 'classes/class-nostrtium-metabox.php'; 31 30 require_once PJV_NOSTRTIUM_DIR . 'classes/class-nostrtium-settings.php'; 32 $this->version = PJV_NOSTRTIUM_VERSION;33 31 $this->settings = Nostrtium_Settings::get_instance(); 34 $this->keyfile = PJV_NOSTRTIUM_ DIR. 'keyfile.key';32 $this->keyfile = PJV_NOSTRTIUM_STORAGE . 'keyfile.key'; 35 33 36 34 if (is_admin()) { … … 38 36 add_action('wp_ajax_pjv_nostrtium_post_note', [$this, 'post_note']); 39 37 } 38 39 add_action('publish_post', [$this, 'maybe_publish_post_to_nostr'], 10, 2); 40 add_action('plugins_loaded', [$this, 'check_version']); 40 41 } 41 42 … … 73 74 'relays' => $this->settings->relays, 74 75 'private_key_set' => $private_key_set, 76 'ap_settings' => $this->settings->auto_publish_settings, 75 77 ]; 76 78 wp_localize_script('nostrtium-settings.js', 'nostrtium', $local_arr); 77 79 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 } 78 106 } 79 107 } … … 116 144 } 117 145 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 119 156 # set up encryption key 120 157 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 121 162 $encKey = KeyFactory::generateEncryptionKey(); 122 163 KeyFactory::save($encKey, $this->keyfile); 123 164 } 124 165 } 166 167 public function activate() { 168 $this->set_keyfile(); 169 125 170 // initial seed relays 126 171 if (!get_option('nostrtium-relays')) { 127 172 $relays = [ 128 173 'wss://relay.damus.io', 129 'wss://nostr-pub.wellorder.net',130 'wss://relay.wellorder.net',131 174 'wss://nos.lol', 132 175 'wss://nostr.mom', 133 176 'wss://no.str.cr', 134 177 'wss://relay.snort.social', 135 'wss://nostr.milou.lol',136 178 'wss://nostr.bitcoiner.social', 137 'wss://relay.nostrid.com',138 'wss://relay.nostrcheck.me',139 'wss://relayable.org',140 179 ]; 141 180 update_option('nostrtium-relays', $relays); 142 181 } 182 183 // save new plugin version to db 184 update_option('nostrtium-version', PJV_NOSTRTIUM_VERSION); 143 185 } 144 186 … … 181 223 } 182 224 183 $r = new stdClass;225 $r = new stdClass; 184 226 $r->sent = $sent; 185 $r->log = $log;227 $r->log = $log; 186 228 187 229 return $r; -
nostrtium/tags/0.7.0/js/nostrtium-settings.js
r2905773 r2921576 3 3 // execute when the DOM is ready 4 4 $(document).ready(function () { 5 var loading = true; 6 5 7 function buildRelayTable() { 6 8 var tbody = $("#relay-tbody"); … … 39 41 } 40 42 }); 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 } 41 95 } 42 96 … … 117 171 }); 118 172 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 119 191 buildRelayTable(); 192 setupCheckboxes(); 193 loading = false; 120 194 }); 121 195 })(jQuery, window, document); -
nostrtium/tags/0.7.0/nostrtium.php
r2905773 r2921576 9 9 * Text Domain: nostrtium 10 10 * Domain Path: /languages 11 * Version: 0. 6.111 * Version: 0.7.0 12 12 * Requires at least 6.0 13 13 * Requires PHP 8.1 … … 22 22 } 23 23 24 define('PJV_NOSTRTIUM_VERSION', '0. 6.1');24 define('PJV_NOSTRTIUM_VERSION', '0.7.0'); 25 25 define('PJV_NOSTRTIUM_DIR', plugin_dir_path(__FILE__)); 26 26 define('PJV_NOSTRTIUM_DEFAULT_USER_ROLE', 'edit_posts'); 27 define('PJV_NOSTRTIUM_STORAGE', wp_upload_dir()['basedir'] . '/nostrtium_' . md5(LOGGED_IN_SALT) . '/'); 27 28 28 29 require_once PJV_NOSTRTIUM_DIR . 'classes/class-nostrtium-requirements-check.php'; … … 31 32 'php' => '8.1', 32 33 'wp' => '6.0', 33 'dir' => PJV_NOSTRTIUM_DIR,34 'dir' => wp_upload_dir()['basedir'], 34 35 'file' => __FILE__, 35 36 ]); 36 37 if ($pjv_nostrtium_requirements_check->passes()) { 37 require_once PJV_NOSTRTIUM_DIR . ' /vendor/autoload.php';38 require_once PJV_NOSTRTIUM_DIR . 'vendor/autoload.php'; 38 39 require_once PJV_NOSTRTIUM_DIR . 'classes/class-nostrtium.php'; 39 40 $pjv_nostrtium_plugin = Nostrtium::get_instance(); -
nostrtium/tags/0.7.0/readme.txt
r2906331 r2921576 5 5 Requires at least: 6.0 6 6 Requires PHP: 8.1 7 Tested up to: 6.2 8 Stable tag: 0. 6.17 Tested up to: 6.2.2 8 Stable tag: 0.7.0 9 9 License: Unlicense 10 10 License URI: https://unlicense.org … … 16 16 Nostrtium lets you post from WordPress to [nostr](https://nostr.how/en/what-is-nostr). 17 17 18 This initial version justimplements 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.18 This 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. 19 19 20 20 You 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 22 There are also options (on the settings page) to auto-post to nostr the excerpt, the permalink, or both upon WordPress post publication. 21 23 22 24 [Note that the private key is stored encrypted in the WordPress database using libsodium cryptography.] … … 30 32 * php-gmp module must be installed ([Installation on Ubuntu](https://computingforgeeks.com/how-to-install-php-on-ubuntu-linux-system/)) 31 33 * WordPress 6.0+ 32 * Writable installation directory (on activation, the plugin writes a cryptographic keyfile to its own installdirectory)34 * Writable uploads directory (on activation, the plugin writes a cryptographic keyfile to a storage directory) 33 35 34 36 ### How to Use … … 59 61 == Screenshots == 60 62 61 1. Nostr relay management62 2. Post to Nostr metabox63 1. Nostrtium settings 64 2. Post to nostr metabox 63 65 64 66 == Changelog == 65 67 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 66 72 = 0.6.1 = 67 73 * Initial public release -
nostrtium/tags/0.7.0/vendor/autoload.php
r2905773 r2921576 23 23 require_once __DIR__ . '/composer/autoload_real.php'; 24 24 25 return ComposerAutoloaderInit c122159a2c090c68c81e277a8518ae21::getLoader();25 return ComposerAutoloaderInit2635a5e5e04df97aa633ddc41a392ae7::getLoader(); -
nostrtium/tags/0.7.0/vendor/composer/autoload_psr4.php
r2905773 r2921576 20 20 'BN\\' => array($vendorDir . '/simplito/bn-php/lib'), 21 21 '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'), 23 23 ); -
nostrtium/tags/0.7.0/vendor/composer/autoload_real.php
r2905773 r2921576 3 3 // autoload_real.php @generated by Composer 4 4 5 class ComposerAutoloaderInit c122159a2c090c68c81e277a8518ae215 class ComposerAutoloaderInit2635a5e5e04df97aa633ddc41a392ae7 6 6 { 7 7 private static $loader; … … 25 25 require __DIR__ . '/platform_check.php'; 26 26 27 spl_autoload_register(array('ComposerAutoloaderInit c122159a2c090c68c81e277a8518ae21', 'loadClassLoader'), true, true);27 spl_autoload_register(array('ComposerAutoloaderInit2635a5e5e04df97aa633ddc41a392ae7', 'loadClassLoader'), true, true); 28 28 self::$loader = $loader = new \Composer\Autoload\ClassLoader(\dirname(__DIR__)); 29 spl_autoload_unregister(array('ComposerAutoloaderInit c122159a2c090c68c81e277a8518ae21', 'loadClassLoader'));29 spl_autoload_unregister(array('ComposerAutoloaderInit2635a5e5e04df97aa633ddc41a392ae7', 'loadClassLoader')); 30 30 31 31 require __DIR__ . '/autoload_static.php'; 32 call_user_func(\Composer\Autoload\ComposerStaticInit c122159a2c090c68c81e277a8518ae21::getInitializer($loader));32 call_user_func(\Composer\Autoload\ComposerStaticInit2635a5e5e04df97aa633ddc41a392ae7::getInitializer($loader)); 33 33 34 34 $loader->register(true); 35 35 36 $filesToLoad = \Composer\Autoload\ComposerStaticInit c122159a2c090c68c81e277a8518ae21::$files;36 $filesToLoad = \Composer\Autoload\ComposerStaticInit2635a5e5e04df97aa633ddc41a392ae7::$files; 37 37 $requireFile = \Closure::bind(static function ($fileIdentifier, $file) { 38 38 if (empty($GLOBALS['__composer_autoload_files'][$fileIdentifier])) { -
nostrtium/tags/0.7.0/vendor/composer/autoload_static.php
r2905773 r2921576 5 5 namespace Composer\Autoload; 6 6 7 class ComposerStaticInit c122159a2c090c68c81e277a8518ae217 class ComposerStaticInit2635a5e5e04df97aa633ddc41a392ae7 8 8 { 9 9 public static $files = array ( … … 106 106 107 107 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', 110 110 ); 111 111 … … 367 367 { 368 368 return \Closure::bind(function () use ($loader) { 369 $loader->prefixLengthsPsr4 = ComposerStaticInit c122159a2c090c68c81e277a8518ae21::$prefixLengthsPsr4;370 $loader->prefixDirsPsr4 = ComposerStaticInit c122159a2c090c68c81e277a8518ae21::$prefixDirsPsr4;371 $loader->fallbackDirsPsr4 = ComposerStaticInit c122159a2c090c68c81e277a8518ae21::$fallbackDirsPsr4;372 $loader->classMap = ComposerStaticInit c122159a2c090c68c81e277a8518ae21::$classMap;369 $loader->prefixLengthsPsr4 = ComposerStaticInit2635a5e5e04df97aa633ddc41a392ae7::$prefixLengthsPsr4; 370 $loader->prefixDirsPsr4 = ComposerStaticInit2635a5e5e04df97aa633ddc41a392ae7::$prefixDirsPsr4; 371 $loader->fallbackDirsPsr4 = ComposerStaticInit2635a5e5e04df97aa633ddc41a392ae7::$fallbackDirsPsr4; 372 $loader->classMap = ComposerStaticInit2635a5e5e04df97aa633ddc41a392ae7::$classMap; 373 373 374 374 }, null, ClassLoader::class); -
nostrtium/tags/0.7.0/vendor/composer/installed.php
r2905773 r2921576 2 2 'root' => array( 3 3 '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', 7 7 'type' => 'library', 8 8 'install_path' => __DIR__ . '/../../', … … 99 99 ), 100 100 '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', 104 104 'type' => 'library', 105 105 'install_path' => __DIR__ . '/../../', -
nostrtium/tags/0.7.0/views/metabox.php
r2905773 r2921576 3 3 echo get_permalink($post->ID);?> 4 4 </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> 9 9 <?php endif; ?> 10 10 … … 13 13 <p class="" id="nostr-log">Please wait...</p> 14 14 </div> 15 16 <?php -
nostrtium/tags/0.7.0/views/settings-page.php
r2905773 r2921576 2 2 <h1 class="ui header">Nostrtium Settings</h1> 3 3 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> 9 28 </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 23 29 </div> 24 30 </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 25 95 </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 Relays32 </th>33 </tr>34 </thead>35 <tbody id="relay-tbody">36 </tbody>37 </table>38 <div class="ui hidden divider"></div>39 96 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 53 98 </div> -
nostrtium/trunk/classes/class-nostrtium-requirements-check.php
r2905773 r2921576 79 79 public function dir_writeable_notice() { 80 80 echo '<div class="error">'; 81 echo '<p>The “' . esc_html($this->title) . '” plugin cannot run without its owndirectory being writeable.</p>';81 echo '<p>The “' . esc_html($this->title) . '” plugin cannot run without the wp-content/uploads directory being writeable.</p>'; 82 82 echo '</div>'; 83 83 } -
nostrtium/trunk/classes/class-nostrtium-settings.php
r2905773 r2921576 17 17 public $encrypted_privkey = ''; 18 18 public $keyfile = ''; 19 public $auto_publish_settings = null; 19 20 20 21 // singleton … … 34 35 add_action('wp_ajax_pjv_nostrtium_save_relays', [$this, 'save_relays']); 35 36 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']); 36 38 37 39 if ($pagenow == 'plugins.php') { … … 39 41 } 40 42 } 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(); 44 70 } 45 71 … … 62 88 63 89 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" : ""; 64 94 include PJV_NOSTRTIUM_DIR . 'views/settings-page.php'; 65 95 } -
nostrtium/trunk/classes/class-nostrtium.php
r2905773 r2921576 14 14 class Nostrtium { 15 15 private static $instance = null; 16 public $version = '';17 16 private $settings = null; 18 public $keyfile= '';17 public $keyfile = ''; 19 18 20 19 // singleton … … 30 29 require_once PJV_NOSTRTIUM_DIR . 'classes/class-nostrtium-metabox.php'; 31 30 require_once PJV_NOSTRTIUM_DIR . 'classes/class-nostrtium-settings.php'; 32 $this->version = PJV_NOSTRTIUM_VERSION;33 31 $this->settings = Nostrtium_Settings::get_instance(); 34 $this->keyfile = PJV_NOSTRTIUM_ DIR. 'keyfile.key';32 $this->keyfile = PJV_NOSTRTIUM_STORAGE . 'keyfile.key'; 35 33 36 34 if (is_admin()) { … … 38 36 add_action('wp_ajax_pjv_nostrtium_post_note', [$this, 'post_note']); 39 37 } 38 39 add_action('publish_post', [$this, 'maybe_publish_post_to_nostr'], 10, 2); 40 add_action('plugins_loaded', [$this, 'check_version']); 40 41 } 41 42 … … 73 74 'relays' => $this->settings->relays, 74 75 'private_key_set' => $private_key_set, 76 'ap_settings' => $this->settings->auto_publish_settings, 75 77 ]; 76 78 wp_localize_script('nostrtium-settings.js', 'nostrtium', $local_arr); 77 79 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 } 78 106 } 79 107 } … … 116 144 } 117 145 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 119 156 # set up encryption key 120 157 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 121 162 $encKey = KeyFactory::generateEncryptionKey(); 122 163 KeyFactory::save($encKey, $this->keyfile); 123 164 } 124 165 } 166 167 public function activate() { 168 $this->set_keyfile(); 169 125 170 // initial seed relays 126 171 if (!get_option('nostrtium-relays')) { 127 172 $relays = [ 128 173 'wss://relay.damus.io', 129 'wss://nostr-pub.wellorder.net',130 'wss://relay.wellorder.net',131 174 'wss://nos.lol', 132 175 'wss://nostr.mom', 133 176 'wss://no.str.cr', 134 177 'wss://relay.snort.social', 135 'wss://nostr.milou.lol',136 178 'wss://nostr.bitcoiner.social', 137 'wss://relay.nostrid.com',138 'wss://relay.nostrcheck.me',139 'wss://relayable.org',140 179 ]; 141 180 update_option('nostrtium-relays', $relays); 142 181 } 182 183 // save new plugin version to db 184 update_option('nostrtium-version', PJV_NOSTRTIUM_VERSION); 143 185 } 144 186 … … 181 223 } 182 224 183 $r = new stdClass;225 $r = new stdClass; 184 226 $r->sent = $sent; 185 $r->log = $log;227 $r->log = $log; 186 228 187 229 return $r; -
nostrtium/trunk/js/nostrtium-settings.js
r2905773 r2921576 3 3 // execute when the DOM is ready 4 4 $(document).ready(function () { 5 var loading = true; 6 5 7 function buildRelayTable() { 6 8 var tbody = $("#relay-tbody"); … … 39 41 } 40 42 }); 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 } 41 95 } 42 96 … … 117 171 }); 118 172 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 119 191 buildRelayTable(); 192 setupCheckboxes(); 193 loading = false; 120 194 }); 121 195 })(jQuery, window, document); -
nostrtium/trunk/nostrtium.php
r2905773 r2921576 9 9 * Text Domain: nostrtium 10 10 * Domain Path: /languages 11 * Version: 0. 6.111 * Version: 0.7.0 12 12 * Requires at least 6.0 13 13 * Requires PHP 8.1 … … 22 22 } 23 23 24 define('PJV_NOSTRTIUM_VERSION', '0. 6.1');24 define('PJV_NOSTRTIUM_VERSION', '0.7.0'); 25 25 define('PJV_NOSTRTIUM_DIR', plugin_dir_path(__FILE__)); 26 26 define('PJV_NOSTRTIUM_DEFAULT_USER_ROLE', 'edit_posts'); 27 define('PJV_NOSTRTIUM_STORAGE', wp_upload_dir()['basedir'] . '/nostrtium_' . md5(LOGGED_IN_SALT) . '/'); 27 28 28 29 require_once PJV_NOSTRTIUM_DIR . 'classes/class-nostrtium-requirements-check.php'; … … 31 32 'php' => '8.1', 32 33 'wp' => '6.0', 33 'dir' => PJV_NOSTRTIUM_DIR,34 'dir' => wp_upload_dir()['basedir'], 34 35 'file' => __FILE__, 35 36 ]); 36 37 if ($pjv_nostrtium_requirements_check->passes()) { 37 require_once PJV_NOSTRTIUM_DIR . ' /vendor/autoload.php';38 require_once PJV_NOSTRTIUM_DIR . 'vendor/autoload.php'; 38 39 require_once PJV_NOSTRTIUM_DIR . 'classes/class-nostrtium.php'; 39 40 $pjv_nostrtium_plugin = Nostrtium::get_instance(); -
nostrtium/trunk/readme.txt
r2906331 r2921576 5 5 Requires at least: 6.0 6 6 Requires PHP: 8.1 7 Tested up to: 6.2 8 Stable tag: 0. 6.17 Tested up to: 6.2.2 8 Stable tag: 0.7.0 9 9 License: Unlicense 10 10 License URI: https://unlicense.org … … 16 16 Nostrtium lets you post from WordPress to [nostr](https://nostr.how/en/what-is-nostr). 17 17 18 This initial version justimplements 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.18 This 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. 19 19 20 20 You 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 22 There are also options (on the settings page) to auto-post to nostr the excerpt, the permalink, or both upon WordPress post publication. 21 23 22 24 [Note that the private key is stored encrypted in the WordPress database using libsodium cryptography.] … … 30 32 * php-gmp module must be installed ([Installation on Ubuntu](https://computingforgeeks.com/how-to-install-php-on-ubuntu-linux-system/)) 31 33 * WordPress 6.0+ 32 * Writable installation directory (on activation, the plugin writes a cryptographic keyfile to its own installdirectory)34 * Writable uploads directory (on activation, the plugin writes a cryptographic keyfile to a storage directory) 33 35 34 36 ### How to Use … … 59 61 == Screenshots == 60 62 61 1. Nostr relay management62 2. Post to Nostr metabox63 1. Nostrtium settings 64 2. Post to nostr metabox 63 65 64 66 == Changelog == 65 67 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 66 72 = 0.6.1 = 67 73 * Initial public release -
nostrtium/trunk/vendor/autoload.php
r2905773 r2921576 23 23 require_once __DIR__ . '/composer/autoload_real.php'; 24 24 25 return ComposerAutoloaderInit c122159a2c090c68c81e277a8518ae21::getLoader();25 return ComposerAutoloaderInit2635a5e5e04df97aa633ddc41a392ae7::getLoader(); -
nostrtium/trunk/vendor/composer/autoload_psr4.php
r2905773 r2921576 20 20 'BN\\' => array($vendorDir . '/simplito/bn-php/lib'), 21 21 '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'), 23 23 ); -
nostrtium/trunk/vendor/composer/autoload_real.php
r2905773 r2921576 3 3 // autoload_real.php @generated by Composer 4 4 5 class ComposerAutoloaderInit c122159a2c090c68c81e277a8518ae215 class ComposerAutoloaderInit2635a5e5e04df97aa633ddc41a392ae7 6 6 { 7 7 private static $loader; … … 25 25 require __DIR__ . '/platform_check.php'; 26 26 27 spl_autoload_register(array('ComposerAutoloaderInit c122159a2c090c68c81e277a8518ae21', 'loadClassLoader'), true, true);27 spl_autoload_register(array('ComposerAutoloaderInit2635a5e5e04df97aa633ddc41a392ae7', 'loadClassLoader'), true, true); 28 28 self::$loader = $loader = new \Composer\Autoload\ClassLoader(\dirname(__DIR__)); 29 spl_autoload_unregister(array('ComposerAutoloaderInit c122159a2c090c68c81e277a8518ae21', 'loadClassLoader'));29 spl_autoload_unregister(array('ComposerAutoloaderInit2635a5e5e04df97aa633ddc41a392ae7', 'loadClassLoader')); 30 30 31 31 require __DIR__ . '/autoload_static.php'; 32 call_user_func(\Composer\Autoload\ComposerStaticInit c122159a2c090c68c81e277a8518ae21::getInitializer($loader));32 call_user_func(\Composer\Autoload\ComposerStaticInit2635a5e5e04df97aa633ddc41a392ae7::getInitializer($loader)); 33 33 34 34 $loader->register(true); 35 35 36 $filesToLoad = \Composer\Autoload\ComposerStaticInit c122159a2c090c68c81e277a8518ae21::$files;36 $filesToLoad = \Composer\Autoload\ComposerStaticInit2635a5e5e04df97aa633ddc41a392ae7::$files; 37 37 $requireFile = \Closure::bind(static function ($fileIdentifier, $file) { 38 38 if (empty($GLOBALS['__composer_autoload_files'][$fileIdentifier])) { -
nostrtium/trunk/vendor/composer/autoload_static.php
r2905773 r2921576 5 5 namespace Composer\Autoload; 6 6 7 class ComposerStaticInit c122159a2c090c68c81e277a8518ae217 class ComposerStaticInit2635a5e5e04df97aa633ddc41a392ae7 8 8 { 9 9 public static $files = array ( … … 106 106 107 107 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', 110 110 ); 111 111 … … 367 367 { 368 368 return \Closure::bind(function () use ($loader) { 369 $loader->prefixLengthsPsr4 = ComposerStaticInit c122159a2c090c68c81e277a8518ae21::$prefixLengthsPsr4;370 $loader->prefixDirsPsr4 = ComposerStaticInit c122159a2c090c68c81e277a8518ae21::$prefixDirsPsr4;371 $loader->fallbackDirsPsr4 = ComposerStaticInit c122159a2c090c68c81e277a8518ae21::$fallbackDirsPsr4;372 $loader->classMap = ComposerStaticInit c122159a2c090c68c81e277a8518ae21::$classMap;369 $loader->prefixLengthsPsr4 = ComposerStaticInit2635a5e5e04df97aa633ddc41a392ae7::$prefixLengthsPsr4; 370 $loader->prefixDirsPsr4 = ComposerStaticInit2635a5e5e04df97aa633ddc41a392ae7::$prefixDirsPsr4; 371 $loader->fallbackDirsPsr4 = ComposerStaticInit2635a5e5e04df97aa633ddc41a392ae7::$fallbackDirsPsr4; 372 $loader->classMap = ComposerStaticInit2635a5e5e04df97aa633ddc41a392ae7::$classMap; 373 373 374 374 }, null, ClassLoader::class); -
nostrtium/trunk/vendor/composer/installed.php
r2905773 r2921576 2 2 'root' => array( 3 3 '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', 7 7 'type' => 'library', 8 8 'install_path' => __DIR__ . '/../../', … … 99 99 ), 100 100 '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', 104 104 'type' => 'library', 105 105 'install_path' => __DIR__ . '/../../', -
nostrtium/trunk/views/metabox.php
r2905773 r2921576 3 3 echo get_permalink($post->ID);?> 4 4 </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> 9 9 <?php endif; ?> 10 10 … … 13 13 <p class="" id="nostr-log">Please wait...</p> 14 14 </div> 15 16 <?php -
nostrtium/trunk/views/settings-page.php
r2905773 r2921576 2 2 <h1 class="ui header">Nostrtium Settings</h1> 3 3 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> 9 28 </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 23 29 </div> 24 30 </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 25 95 </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 Relays32 </th>33 </tr>34 </thead>35 <tbody id="relay-tbody">36 </tbody>37 </table>38 <div class="ui hidden divider"></div>39 96 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 53 98 </div>
Note: See TracChangeset
for help on using the changeset viewer.