add.phtml 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290
  1. <?php
  2. declare(strict_types=1);
  3. /** @var FreshRSS_View $this */
  4. $this->partial('aside_subscription');
  5. ?>
  6. <main class="post drop-section">
  7. <div class="link-back-wrapper">
  8. <a class="link-back" href="<?= _url('index', 'index') ?>"><?= _t('gen.action.back_to_rss_feeds') ?></a>
  9. </div>
  10. <h1><?= _t('sub.menu.add') ?></h1>
  11. <h2><?= _t('sub.title.add_category') ?></h2>
  12. <form action="<?= _url('category', 'create') ?>" method="post">
  13. <input type="hidden" name="_csrf" value="<?= FreshRSS_Auth::csrfToken() ?>" />
  14. <div class="form-group">
  15. <label class="group-name" for="new-category"><?= _t('sub.category') ?></label>
  16. <div class="group-controls">
  17. <input id="new-category" name="new-category" type="text" required="required" autocomplete="off" />
  18. </div>
  19. </div>
  20. <div class="form-group form-actions">
  21. <div class="group-controls">
  22. <button type="submit" class="btn btn-important"><?= _t('gen.action.add') ?></button>
  23. </div>
  24. </div>
  25. </form>
  26. <h2><?= _t('sub.title.add_feed') ?></h2>
  27. <form id="add_rss" method="post" action="<?= _url('feed', 'add') ?>" autocomplete="off">
  28. <input type="hidden" name="_csrf" value="<?= FreshRSS_Auth::csrfToken() ?>" />
  29. <div class="form-group">
  30. <label class="group-name" for="url_rss"><?= _t('sub.feed.url') ?></label>
  31. <div class="group-controls">
  32. <div class="stick">
  33. <input id="url_rss" name="url_rss" type="url" required="required" autocomplete="off" class="long" autofocus="autofocus" />
  34. <a class="btn open-url" target="_blank" rel="noreferrer" href="" data-input="url_rss" title="<?= _t('gen.action.open_url') ?>"><?= _i('link') ?></a>
  35. </div>
  36. </div>
  37. </div>
  38. <div class="form-group">
  39. <label class="group-name" for="category"><?= _t('sub.category') ?></label>
  40. <div class="group-controls">
  41. <select name="category" id="category">
  42. <?php
  43. foreach ($this->categories as $cat) {
  44. if ($cat->kind() == FreshRSS_Category::KIND_DYNAMIC_OPML) {
  45. continue;
  46. }
  47. ?>
  48. <option value="<?= $cat->id() ?>"<?= $cat->id() === (Minz_Request::paramInt('cat_id') ?: 1) ? ' selected="selected"' : '' ?>>
  49. <?= $cat->name() ?>
  50. </option>
  51. <?php } ?>
  52. </select>
  53. </div>
  54. </div>
  55. <details class="form-advanced">
  56. <summary class="form-advanced-title">
  57. <?= _t('sub.feed.kind') ?>
  58. </summary>
  59. <div class="form-group">
  60. <label class="group-name" for="feed_kind"><?= _t('sub.feed.kind') ?></label>
  61. <div class="group-controls">
  62. <select name="feed_kind" id="feed_kind" class="select-show">
  63. <option value="<?= FreshRSS_Feed::KIND_RSS ?>" selected="selected"><?= _t('sub.feed.kind.rss') ?></option>
  64. <option value="<?= FreshRSS_Feed::KIND_HTML_XPATH ?>" data-show="html_xpath"><?= _t('sub.feed.kind.html_xpath') ?></option>
  65. <option value="<?= FreshRSS_Feed::KIND_XML_XPATH ?>" data-show="html_xpath"><?= _t('sub.feed.kind.xml_xpath') ?></option>
  66. </select>
  67. </div>
  68. </div>
  69. <fieldset id="html_xpath">
  70. <p class="help"><?= _i('help') ?> <?= _t('sub.feed.kind.html_xpath.help') ?></p>
  71. <div class="form-group">
  72. <label class="group-name" for="xPathFeedTitle"><small><?= _t('sub.feed.kind.html_xpath.xpath') ?></small><br />
  73. <?= _t('sub.feed.kind.html_xpath.feed_title') ?></label>
  74. <div class="group-controls">
  75. <textarea class="valid-xpath" name="xPathFeedTitle" id="xPathFeedTitle" rows="2" cols="64" spellcheck="false">//title</textarea>
  76. <p class="help"><?= _i('help') ?> <?= _t('sub.feed.kind.html_xpath.feed_title.help') ?></p>
  77. </div>
  78. </div>
  79. <div class="form-group">
  80. <label class="group-name" for="xPathItem"><small><?= _t('sub.feed.kind.html_xpath.xpath') ?></small><br />
  81. <?= _t('sub.feed.kind.html_xpath.item') ?></label>
  82. <div class="group-controls">
  83. <textarea class="valid-xpath" name="xPathItem" id="xPathItem" rows="2" cols="64" spellcheck="false"></textarea>
  84. <p class="help"><?= _i('help') ?> <?= _t('sub.feed.kind.html_xpath.item.help') ?></p>
  85. </div>
  86. </div>
  87. <div class="form-group">
  88. <label class="group-name" for="xPathItemTitle"><small><?= _t('sub.feed.kind.html_xpath.relative') ?></small><br />
  89. <?= _t('sub.feed.kind.html_xpath.item_title') ?></label>
  90. <div class="group-controls">
  91. <textarea class="valid-xpath" name="xPathItemTitle" id="xPathItemTitle" rows="2" cols="64" spellcheck="false"></textarea>
  92. <p class="help"><?= _i('help') ?> <?= _t('sub.feed.kind.html_xpath.item_title.help') ?></p>
  93. </div>
  94. </div>
  95. <div class="form-group">
  96. <label class="group-name" for="xPathItemContent"><small><?= _t('sub.feed.kind.html_xpath.relative') ?></small><br />
  97. <?= _t('sub.feed.kind.html_xpath.item_content') ?></label>
  98. <div class="group-controls">
  99. <textarea class="valid-xpath" name="xPathItemContent" id="xPathItemContent" rows="2" cols="64" spellcheck="false"></textarea>
  100. <p class="help"><?= _i('help') ?> <?= _t('sub.feed.kind.html_xpath.item_content.help') ?></p>
  101. </div>
  102. </div>
  103. <div class="form-group">
  104. <label class="group-name" for="xPathItemUri"><small><?= _t('sub.feed.kind.html_xpath.relative') ?></small><br />
  105. <?= _t('sub.feed.kind.html_xpath.item_uri') ?></label>
  106. <div class="group-controls">
  107. <textarea class="valid-xpath" name="xPathItemUri" id="xPathItemUri" rows="2" cols="64" spellcheck="false"></textarea>
  108. <p class="help"><?= _i('help') ?> <?= _t('sub.feed.kind.html_xpath.item_uri.help') ?></p>
  109. </div>
  110. </div>
  111. <div class="form-group">
  112. <label class="group-name" for="xPathItemThumbnail"><small><?= _t('sub.feed.kind.html_xpath.relative') ?></small><br />
  113. <?= _t('sub.feed.kind.html_xpath.item_thumbnail') ?></label>
  114. <div class="group-controls">
  115. <textarea class="valid-xpath" name="xPathItemThumbnail" id="xPathItemThumbnail" rows="2" cols="64" spellcheck="false"></textarea>
  116. <p class="help"><?= _i('help') ?> <?= _t('sub.feed.kind.html_xpath.item_thumbnail.help') ?></p>
  117. </div>
  118. </div>
  119. <div class="form-group">
  120. <label class="group-name" for="xPathItemAuthor"><small><?= _t('sub.feed.kind.html_xpath.relative') ?></small><br />
  121. <?= _t('sub.feed.kind.html_xpath.item_author') ?></label>
  122. <div class="group-controls">
  123. <textarea class="valid-xpath" name="xPathItemAuthor" id="xPathItemAuthor" rows="2" cols="64" spellcheck="false"></textarea>
  124. <p class="help"><?= _i('help') ?> <?= _t('sub.feed.kind.html_xpath.item_author.help') ?></p>
  125. </div>
  126. </div>
  127. <div class="form-group">
  128. <label class="group-name" for="xPathItemTimestamp"><small><?= _t('sub.feed.kind.html_xpath.relative') ?></small><br />
  129. <?= _t('sub.feed.kind.html_xpath.item_timestamp') ?></label>
  130. <div class="group-controls">
  131. <textarea class="valid-xpath" name="xPathItemTimestamp" id="xPathItemTimestamp" rows="2" cols="64" spellcheck="false"></textarea>
  132. <p class="help"><?= _i('help') ?> <?= _t('sub.feed.kind.html_xpath.item_timestamp.help') ?></p>
  133. </div>
  134. </div>
  135. <div class="form-group">
  136. <label class="group-name" for="xPathItemTimeFormat">
  137. <?= _t('sub.feed.kind.html_xpath.item_timeFormat') ?></label>
  138. <div class="group-controls">
  139. <textarea name="xPathItemTimeFormat" id="xPathItemTimeFormat" rows="2" cols="64" spellcheck="false"></textarea>
  140. <p class="help"><?= _i('help') ?> <?= _t('sub.feed.kind.html_xpath.item_timeFormat.help') ?></p>
  141. </div>
  142. </div>
  143. <div class="form-group">
  144. <label class="group-name" for="xPathItemCategories"><small><?= _t('sub.feed.kind.html_xpath.relative') ?></small><br />
  145. <?= _t('sub.feed.kind.html_xpath.item_categories') ?></label>
  146. <div class="group-controls">
  147. <textarea class="valid-xpath" name="xPathItemCategories" id="xPathItemCategories" rows="2" cols="64" spellcheck="false"></textarea>
  148. </div>
  149. </div>
  150. <div class="form-group">
  151. <label class="group-name" for="xPathItemUid"><small><?= _t('sub.feed.kind.html_xpath.relative') ?></small><br />
  152. <?= _t('sub.feed.kind.html_xpath.item_uid') ?></label>
  153. <div class="group-controls">
  154. <textarea class="valid-xpath" name="xPathItemUid" id="xPathItemUid" rows="2" cols="64" spellcheck="false"></textarea>
  155. </div>
  156. </div>
  157. </fieldset>
  158. </details>
  159. <details class="form-advanced">
  160. <summary class="form-advanced-title">
  161. <?= _t('sub.feed.advanced') ?>
  162. </summary>
  163. <div class="form-group">
  164. <label class="group-name" for="http_user"><?= _t('sub.feed.auth.username') ?></label>
  165. <div class="group-controls">
  166. <input id="http_user" name="http_user" type="text" autocomplete="off"/>
  167. </div>
  168. </div>
  169. <div class="form-group">
  170. <label class="group-name" for="http_pass"><?= _t('sub.feed.auth.password') ?></label>
  171. <div class="group-controls">
  172. <div class="stick">
  173. <input id="http_pass" name="http_pass" type="password" value="" autocomplete="new-password" />
  174. <button type="button" class="btn toggle-password" data-toggle="http_pass"><?= _i('key') ?></button>
  175. </div>
  176. </div>
  177. </div>
  178. <div class="form-group">
  179. <label class="group-name" for="curl_params_cookie"><?= _t('sub.feed.css_cookie') ?></label>
  180. <div class="group-controls">
  181. <input type="text" name="curl_params_cookie" id="curl_params_cookie" value="" placeholder="<?= _t('gen.short.blank_to_disable') ?>" />
  182. <p class="help"><?= _i('help') ?> <?= _t('sub.feed.css_cookie_help') ?></p>
  183. <label for="curl_params_cookiefile">
  184. <input type="checkbox" name="curl_params_cookiefile" id="curl_params_cookiefile" value="1" />
  185. <?= _t('sub.feed.accept_cookies') ?>
  186. </label>
  187. <p class="help"><?= _i('help') ?> <?= _t('sub.feed.accept_cookies_help') ?></p>
  188. </div>
  189. </div>
  190. <div class="form-group">
  191. <label class="group-name" for="curl_params_redirects"><?= _t('sub.feed.max_http_redir') ?></label>
  192. <div class="group-controls">
  193. <input type="number" name="curl_params_redirects" id="curl_params_redirects" min="-1" value="" placeholder="<?= _t('gen.short.blank_to_disable') ?>" />
  194. <p class="help"><?= _i('help') ?> <?= _t('sub.feed.max_http_redir_help') ?></p>
  195. </div>
  196. </div>
  197. <div class="form-group">
  198. <label class="group-name" for="curl_params_useragent"><?= _t('sub.feed.useragent') ?></label>
  199. <div class="group-controls">
  200. <input type="text" name="curl_params_useragent" id="curl_params_useragent" value="" placeholder="<?= _t('gen.short.blank_to_disable') ?>" />
  201. <p class="help"><?= _i('help') ?> <?= _t('sub.feed.useragent_help') ?></p>
  202. </div>
  203. </div>
  204. <div class="form-group">
  205. <label class="group-name" for="proxy_type"><?= _t('sub.feed.proxy') ?></label>
  206. <div class="group-controls">
  207. <select class="number" name="proxy_type" id="proxy_type"><?php
  208. foreach(['' => '', 3 => 'NONE', 0 => 'HTTP', 2 => 'HTTPS', 4 => 'SOCKS4', 6 => 'SOCKS4A', 5 => 'SOCKS5', 7 => 'SOCKS5H'] as $k => $v) {
  209. echo '<option value="' . $k . '">' . $v . '</option>';
  210. }
  211. ?>
  212. </select>
  213. <input type="text" name="curl_params" id="curl_params" value="" placeholder="<?= _t('gen.short.blank_to_disable') ?>" />
  214. <p class="help"><?= _i('help') ?> <?= _t('sub.feed.proxy_help') ?></p>
  215. </div>
  216. </div>
  217. <div class="form-group">
  218. <label class="group-name" for="timeout"><?= _t('sub.feed.timeout') ?></label>
  219. <div class="group-controls">
  220. <input type="number" name="timeout" id="timeout" min="3" max="900" value="" placeholder="<?= _t('gen.short.by_default') ?>" />
  221. </div>
  222. </div>
  223. <div class="form-group">
  224. <label class="group-name" for="ssl_verify"><?= _t('sub.feed.ssl_verify') ?></label>
  225. <div class="group-controls">
  226. <select name="ssl_verify" id="ssl_verify">
  227. <option value=""><?= _t('gen.short.by_default') ?></option>
  228. <option value="0"><?= _t('gen.short.no') ?></option>
  229. <option value="1"><?= _t('gen.short.yes') ?></option>
  230. </select>
  231. </div>
  232. </div>
  233. </details>
  234. <div class="form-group form-actions">
  235. <div class="group-controls">
  236. <button type="submit" class="btn btn-important"><?= _t('gen.action.add') ?></button>
  237. </div>
  238. </div>
  239. </form>
  240. <h2>
  241. <?= _t('sub.title.add_dynamic_opml') ?>
  242. <?= _i('opml-dyn') ?>
  243. </h2>
  244. <form action="<?= _url('category', 'create') ?>" method="post">
  245. <input type="hidden" name="_csrf" value="<?= FreshRSS_Auth::csrfToken() ?>" />
  246. <div class="form-group">
  247. <label class="group-name" for="new-category"><?= _t('sub.category') ?></label>
  248. <div class="group-controls">
  249. <input id="new-category" name="new-category" type="text" required="required" autocomplete="off" />
  250. </div>
  251. </div>
  252. <div class="form-group">
  253. <label class="group-name" for="opml_url"><?= _t('sub.category.opml_url') ?></label>
  254. <div class="group-controls">
  255. <div class="stick">
  256. <input id="opml_url" name="opml_url" type="url" required="required" autocomplete="off" class="long" />
  257. <a class="btn open-url" target="_blank" rel="noreferrer" href="" data-input="opml_url" title="<?= _t('gen.action.open_url') ?>"><?= _i('link') ?></a>
  258. </div>
  259. <p class="help"><?= _i('help') ?> <?= _t('sub.category.dynamic_opml.help') ?></p>
  260. </div>
  261. </div>
  262. <div class="form-group form-actions">
  263. <div class="group-controls">
  264. <button type="submit" class="btn btn-important"><?= _t('gen.action.add') ?></button>
  265. </div>
  266. </div>
  267. </form>
  268. </main>