mirror of
https://github.com/HackPlan/RootPanel.git
synced 2026-03-26 22:16:28 +08:00
nginx 修改配置,未完成
This commit is contained in:
@@ -49,6 +49,29 @@ $ ->
|
||||
else
|
||||
$("#nginx-modal .option-#{item}").addClass 'hide'
|
||||
|
||||
$('#nginx-modal .modal-footer button.btn-success').click ->
|
||||
type = $('#nginx-modal ul.config-type').find('.active a').attr('href')['#nginx-type-'.length..]
|
||||
|
||||
if type == 'guide'
|
||||
config = {}
|
||||
|
||||
else if type == 'json'
|
||||
try
|
||||
config = JSON.parse($('#nginx-type-json textarea').val())
|
||||
catch e
|
||||
return alert 'Invalid JSON'
|
||||
|
||||
else
|
||||
return alert 'Coming Soon'
|
||||
|
||||
$.post '/plugin/nginx/update_site/', JSON.stringify
|
||||
action: if config.id then 'update' else 'create'
|
||||
id: config.id
|
||||
type: type
|
||||
config: config
|
||||
.success ->
|
||||
location.reload()
|
||||
|
||||
# refactored above
|
||||
|
||||
service = $ '#service'
|
||||
@@ -98,23 +121,6 @@ $ ->
|
||||
.success ->
|
||||
location.reload()
|
||||
|
||||
$ '#nginxSave'
|
||||
.on 'click', (e) ->
|
||||
e.preventDefault()
|
||||
type = $('#nginxConfigType').find('.active a').attr('href').substr 1
|
||||
try
|
||||
config = JSON.parse($("##{type}").find('textarea').val())
|
||||
catch e
|
||||
return alert '配置文件格式不正确'
|
||||
|
||||
$.post '/plugin/nginx/update_site/', JSON.stringify
|
||||
action: if config.id then 'update' else 'create'
|
||||
id: config.id
|
||||
type: type
|
||||
config: config
|
||||
.success ->
|
||||
location.reload()
|
||||
|
||||
mysql = $ '#mysql-input'
|
||||
mysql.find 'button'
|
||||
.on 'click', (e) ->
|
||||
|
||||
@@ -11,6 +11,7 @@ module.exports = exports = express.Router()
|
||||
|
||||
sample =
|
||||
_id: '53c96734c2dad7d6208a0fbe'
|
||||
is_enable: true
|
||||
listen: 80
|
||||
server_name: ['domain1', 'domain2']
|
||||
auto_index: false
|
||||
|
||||
@@ -4,6 +4,9 @@ exports.assert = (account, config, site_id, callback) ->
|
||||
config.index ?= ['index']
|
||||
config.location ?= {}
|
||||
|
||||
if config.is_enable == undefined
|
||||
config.is_enable = true
|
||||
|
||||
unless config.listen in [80]
|
||||
return callback 'invalid_listen'
|
||||
|
||||
|
||||
@@ -31,8 +31,9 @@ module.exports =
|
||||
sites_configure = []
|
||||
|
||||
for site in account.attribute.plugin.nginx.sites
|
||||
sites_configure.push _.template template.site_configure,
|
||||
site: site
|
||||
if site.is_enable
|
||||
sites_configure.push _.template template.site_configure,
|
||||
site: site
|
||||
|
||||
user_configure = _.template template.user_configure,
|
||||
sites: sites_configure
|
||||
|
||||
@@ -89,4 +89,4 @@ table.table.table-hover
|
||||
p 即将支持
|
||||
.modal-footer
|
||||
button.btn.btn-danger(type='button', data-dismiss='modal') 关闭
|
||||
button.btn.btn-success#nginxSave(type='button') 保存
|
||||
button.btn.btn-success(type='button') 保存
|
||||
|
||||
Reference in New Issue
Block a user