mirror of
https://github.com/luxfi/pics.git
synced 2026-07-26 21:08:58 +00:00
Add ethereum links URL %s format global setting, default to ethersca
Improve apearance of eth address under post Put signature under post in details+summary
This commit is contained in:
@@ -112,9 +112,10 @@ module.exports = {
|
||||
//max age of a hot thread, with a reducing score multiplier from 0-1 bias towards this date
|
||||
hotThreadsMaxAge: 2629800000,
|
||||
|
||||
//default url format/links for archive and reverse image search links, %s will be replaced by the url
|
||||
//default url format/links for archive, reverse image search, and ethereum links, %s will be replaced by the url
|
||||
archiveLinksURL: 'https://archive.today/?run=1&url=%s',
|
||||
reverseImageLinksURL: 'https://tineye.com/search?url=%s',
|
||||
ethereumLinksURL: 'https://etherscan.io/address/%s',
|
||||
|
||||
//cache templates in memory. disable only if editing templates and doing dev work
|
||||
cacheTemplates: true,
|
||||
|
||||
@@ -15,7 +15,7 @@ module.exports = {
|
||||
paramConverter: paramConverter({
|
||||
timeFields: ['hot_threads_max_age', 'inactive_account_time', 'default_ban_duration', 'block_bypass_expire_after_time', 'dnsbl_cache_time', 'board_defaults_delete_protection_age'],
|
||||
trimFields: ['captcha_options_grid_question', 'captcha_options_grid_trues', 'captcha_options_grid_falses', 'captcha_options_font', 'allowed_hosts', 'dnsbl_blacklists', 'other_mime_types',
|
||||
'highlight_options_language_subset', 'global_limits_custom_css_filters', 'board_defaults_filters', 'filters', 'archive_links', 'reverse_links', 'language', 'board_defaults_language'],
|
||||
'highlight_options_language_subset', 'global_limits_custom_css_filters', 'board_defaults_filters', 'filters', 'archive_links', 'ethereum_links', 'reverse_links', 'language', 'board_defaults_language'],
|
||||
numberFields: ['inactive_account_action', 'abandoned_board_action', 'auth_level', 'captcha_options_text_wave', 'captcha_options_text_paint', 'captcha_options_text_noise',
|
||||
'captcha_options_grid_noise', 'captcha_options_grid_edge', 'captcha_options_generate_limit', 'captcha_options_grid_size', 'captcha_options_grid_image_size',
|
||||
'captcha_options_num_distorts_min', 'captcha_options_num_distorts_max', 'captcha_options_distortion', 'captcha_options_grid_icon_y_offset', 'flood_timers_same_content_same_ip', 'flood_timers_same_content_any_ip',
|
||||
@@ -73,6 +73,12 @@ module.exports = {
|
||||
}
|
||||
return false;
|
||||
}, expected: true, error: __('Invalid reverse image search links URL format, must be a link containing %s where the url param belongs.') },
|
||||
{ result: () => {
|
||||
if (req.body.ethereum_links) {
|
||||
return /https?\:\/\/[^\s<>\[\]{}|\\^]+%s[^\s<>\[\]{}|\\^]*/i.test(req.body.ethereum_links);
|
||||
}
|
||||
return false;
|
||||
}, expected: true, error: __('Invalid ethereum links URL format, must be a link containing %s where the url param belongs.') },
|
||||
{ result: existsBody(req.body.referrer_check) ? lengthBody(req.body.allowed_hosts, 1) : false, expected: false, error: __('Please enter at least one allowed host in the "Allowed Hosts" field when the "Referer Check" option is selected.') },
|
||||
{ result: numberBody(req.body.inactive_account_time), expected: true, error: __('Invalid inactive account time') },
|
||||
{ result: numberBody(req.body.inactive_account_action, 0, 2), expected: true, error: __('Inactive account action must be a number from 0-2') },
|
||||
|
||||
@@ -424,6 +424,7 @@ async function custompages() {
|
||||
early404Fraction: config.get.early404Fraction,
|
||||
early404Replies: config.get.early404Replies,
|
||||
meta: config.get.meta,
|
||||
ethereumLinksURL: config.get.ethereumLinksURL,
|
||||
archiveLinksURL: config.get.archiveLinksURL,
|
||||
reverseImageLinksURL: config.get.reverseImageLinksURL,
|
||||
enableWebring: config.get.enableWebring,
|
||||
|
||||
+3
-2
@@ -15,16 +15,17 @@ const { outputFile } = require('fs-extra')
|
||||
, i18n = require(__dirname+'/../locale/locale.js')
|
||||
, config = require(__dirname+'/../../lib/misc/config.js');
|
||||
|
||||
let { language, archiveLinksURL, lockWait, globalLimits, boardDefaults, cacheTemplates,
|
||||
let { language, archiveLinksURL, ethereumLinksURL, lockWait, globalLimits, boardDefaults, cacheTemplates,
|
||||
reverseImageLinksURL, meta, enableWebring, captchaOptions, globalAnnouncement, enableWeb3 } = config.get
|
||||
, renderLocals = null;
|
||||
|
||||
const updateLocals = () => {
|
||||
({ language, archiveLinksURL, lockWait, globalLimits, boardDefaults, cacheTemplates,
|
||||
({ language, archiveLinksURL, ethereumLinksURL, lockWait, globalLimits, boardDefaults, cacheTemplates,
|
||||
reverseImageLinksURL, meta, enableWebring, captchaOptions, globalAnnouncement, enableWeb3 } = config.get);
|
||||
renderLocals = {
|
||||
Permissions,
|
||||
cache: cacheTemplates,
|
||||
ethereumLinksURL,
|
||||
archiveLinksURL,
|
||||
reverseImageLinksURL,
|
||||
meta,
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
'use strict';
|
||||
|
||||
//NOTE: unused (for now)
|
||||
|
||||
const { Web3 } = require('web3')
|
||||
, config = require(__dirname+'/../misc/config.js')
|
||||
, { addCallback } = require(__dirname+'/../redis/redis.js')
|
||||
|
||||
@@ -8,6 +8,7 @@ module.exports = async(db, redis) => {
|
||||
'globalLimits.filters': {
|
||||
max: 50,
|
||||
},
|
||||
'ethereumLinksURL': 'https://etherscan.io/address/%s',
|
||||
},
|
||||
});
|
||||
|
||||
|
||||
@@ -19,6 +19,7 @@ const { Boards } = require(__dirname+'/../../db/')
|
||||
'meta.siteName': ['deletehtml', 'scripts', 'custompages'],
|
||||
'meta.url': ['deletehtml', 'scripts', 'custompages'],
|
||||
'archiveLinksURL': ['deletehtml', 'custompages'],
|
||||
'ethereumLinksURL': ['deletehtml', 'custompages'],
|
||||
'reverseImageLinksURL': ['deletehtml', 'custompages'],
|
||||
'enableWebring': ['deletehtml', 'custompages'],
|
||||
'enableWeb3': ['deletehtml'],
|
||||
@@ -130,6 +131,7 @@ module.exports = async (req, res) => {
|
||||
allowCustomOverboard: booleanSetting(req.body.allow_custom_overboard, oldSettings.allowCustomOverboard),
|
||||
archiveLinksURL: trimSetting(req.body.archive_links, oldSettings.archiveLinksURL),
|
||||
reverseImageLinksURL: trimSetting(req.body.reverse_links, oldSettings.reverseImageLinksURL),
|
||||
ethereumLinksURL: trimSetting(req.body.ethereum_links, oldSettings.ethereumLinksURL),
|
||||
cacheTemplates: booleanSetting(req.body.cache_templates, oldSettings.cacheTemplates),
|
||||
lockWait: numberSetting(req.body.lock_wait, oldSettings.lockWait),
|
||||
pruneModlogs: numberSetting(req.body.prune_modlogs, oldSettings.pruneModlogs),
|
||||
@@ -137,7 +139,7 @@ module.exports = async (req, res) => {
|
||||
pruneIps: numberSetting(req.body.prune_ips, oldSettings.pruneIps),
|
||||
enableWebring: booleanSetting(req.body.enable_webring, oldSettings.enableWebring),
|
||||
enableWeb3: booleanSetting(req.body.enable_web3, oldSettings.enableWeb3),
|
||||
ethereumNode: trimSetting(req.body.ethereum_node, oldSettings.ethereumNode),
|
||||
// ethereumNode: trimSetting(req.body.ethereum_node, oldSettings.ethereumNode),
|
||||
following: arraySetting(req.body.webring_following, oldSettings.following),
|
||||
blacklist: arraySetting(req.body.webring_blacklist, oldSettings.blacklist),
|
||||
logo: arraySetting(req.body.webring_logos, oldSettings.logo),
|
||||
|
||||
@@ -68,7 +68,7 @@ const config = require(__dirname+'/lib/misc/config.js')
|
||||
|
||||
const loadAppLocals = () => {
|
||||
const { language, cacheTemplates, boardDefaults, globalLimits, captchaOptions, archiveLinksURL,
|
||||
reverseImageLinksURL, meta, enableWebring, globalAnnouncement, enableWeb3 } = config.get;
|
||||
reverseImageLinksURL, meta, enableWebring, globalAnnouncement, enableWeb3, ethereumLinksURL } = config.get;
|
||||
//cache loaded templates
|
||||
app.cache = {};
|
||||
app[cacheTemplates === true ? 'enable' : 'disable']('view cache');
|
||||
@@ -77,6 +77,7 @@ const config = require(__dirname+'/lib/misc/config.js')
|
||||
app.locals.defaultTheme = boardDefaults.theme;
|
||||
app.locals.defaultCodeTheme = boardDefaults.codeTheme;
|
||||
app.locals.globalLimits = globalLimits;
|
||||
app.locals.ethereumLinksURL = ethereumLinksURL;
|
||||
app.locals.archiveLinksURL = archiveLinksURL;
|
||||
app.locals.reverseImageLinksURL = reverseImageLinksURL;
|
||||
app.locals.enableWebring = enableWebring;
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
mixin web3signature(signature, address)
|
||||
.web3-address #{__('Address: %s', address)}
|
||||
.web3-signature #{__('Signature: %s', signature)}
|
||||
a.web3-address(href=ethereumLinksURL.replace('%s', encodeURIComponent(address)) rel='nofollow' referrerpolicy='same-origin' target='_blank') #{address.substring(0,5)}…#{address.substring(38, 42)}
|
||||
details
|
||||
summary #{__('Signature')}
|
||||
.web3-signature #{signature}
|
||||
|
||||
@@ -534,6 +534,15 @@ block content
|
||||
label.postform-style.ph-5
|
||||
input(type='checkbox', name='enable_web3' value='true' checked=settings.enableWeb3)
|
||||
.row
|
||||
.label
|
||||
| #{__('Ethereum Links URL')}
|
||||
|
|
||||
small
|
||||
| (
|
||||
a(href='/faq.html#archive-reverse-url-format') ?
|
||||
| )
|
||||
input(type='text', name='ethereum_links', value=settings.ethereumLinksURL)
|
||||
//- .row
|
||||
.label
|
||||
| #{__('Ethereum Node')}
|
||||
|
|
||||
|
||||
Reference in New Issue
Block a user