mirror of
https://0xacab.org/sutty/sutty
synced 2024-11-16 14:21:41 +00:00
feat: validar y agregar la dirección a la configuración del sitio
This commit is contained in:
parent
718463f0ea
commit
487765f7d8
2 changed files with 4 additions and 5 deletions
|
@ -6,6 +6,8 @@ class DeployHiddenService < DeployWww
|
||||||
|
|
||||||
before_create :create_hidden_service!
|
before_create :create_hidden_service!
|
||||||
|
|
||||||
|
ONION_RE = /\A[a-z0-9]{56}\.onion\z/.freeze
|
||||||
|
|
||||||
def fqdn
|
def fqdn
|
||||||
onion.tap do |onion|
|
onion.tap do |onion|
|
||||||
raise ArgumentError, 'Aun no se generó la dirección .onion' if onion.blank?
|
raise ArgumentError, 'Aun no se generó la dirección .onion' if onion.blank?
|
||||||
|
|
|
@ -64,14 +64,11 @@ SiteService = Struct.new(:site, :usuarie, :params, keyword_init: true) do
|
||||||
# Agregar una dirección oculta de Tor al DeployHiddenService y a la
|
# Agregar una dirección oculta de Tor al DeployHiddenService y a la
|
||||||
# configuración del Site.
|
# configuración del Site.
|
||||||
def add_onion
|
def add_onion
|
||||||
onion = params[:onion].strip
|
onion = params[:onion]
|
||||||
deploy = DeployHiddenService.find_by(site: site)
|
deploy = params[:deploy]
|
||||||
|
|
||||||
return false unless !onion.blank? && deploy
|
return false unless !onion.blank? && deploy
|
||||||
|
|
||||||
deploy.values[:onion] = onion
|
|
||||||
deploy.save
|
|
||||||
|
|
||||||
site.config['onion-location'] = onion
|
site.config['onion-location'] = onion
|
||||||
site.config.write
|
site.config.write
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue