mirror of
https://github.com/HackPlan/RootPanel.git
synced 2026-04-30 04:25:49 +08:00
nginx 修改配置,未完成
This commit is contained in:
@@ -49,6 +49,29 @@ $ ->
|
|||||||
else
|
else
|
||||||
$("#nginx-modal .option-#{item}").addClass 'hide'
|
$("#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
|
# refactored above
|
||||||
|
|
||||||
service = $ '#service'
|
service = $ '#service'
|
||||||
@@ -98,23 +121,6 @@ $ ->
|
|||||||
.success ->
|
.success ->
|
||||||
location.reload()
|
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 = $ '#mysql-input'
|
||||||
mysql.find 'button'
|
mysql.find 'button'
|
||||||
.on 'click', (e) ->
|
.on 'click', (e) ->
|
||||||
|
|||||||
@@ -11,6 +11,7 @@ module.exports = exports = express.Router()
|
|||||||
|
|
||||||
sample =
|
sample =
|
||||||
_id: '53c96734c2dad7d6208a0fbe'
|
_id: '53c96734c2dad7d6208a0fbe'
|
||||||
|
is_enable: true
|
||||||
listen: 80
|
listen: 80
|
||||||
server_name: ['domain1', 'domain2']
|
server_name: ['domain1', 'domain2']
|
||||||
auto_index: false
|
auto_index: false
|
||||||
|
|||||||
@@ -4,6 +4,9 @@ exports.assert = (account, config, site_id, callback) ->
|
|||||||
config.index ?= ['index']
|
config.index ?= ['index']
|
||||||
config.location ?= {}
|
config.location ?= {}
|
||||||
|
|
||||||
|
if config.is_enable == undefined
|
||||||
|
config.is_enable = true
|
||||||
|
|
||||||
unless config.listen in [80]
|
unless config.listen in [80]
|
||||||
return callback 'invalid_listen'
|
return callback 'invalid_listen'
|
||||||
|
|
||||||
|
|||||||
@@ -31,8 +31,9 @@ module.exports =
|
|||||||
sites_configure = []
|
sites_configure = []
|
||||||
|
|
||||||
for site in account.attribute.plugin.nginx.sites
|
for site in account.attribute.plugin.nginx.sites
|
||||||
sites_configure.push _.template template.site_configure,
|
if site.is_enable
|
||||||
site: site
|
sites_configure.push _.template template.site_configure,
|
||||||
|
site: site
|
||||||
|
|
||||||
user_configure = _.template template.user_configure,
|
user_configure = _.template template.user_configure,
|
||||||
sites: sites_configure
|
sites: sites_configure
|
||||||
|
|||||||
@@ -89,4 +89,4 @@ table.table.table-hover
|
|||||||
p 即将支持
|
p 即将支持
|
||||||
.modal-footer
|
.modal-footer
|
||||||
button.btn.btn-danger(type='button', data-dismiss='modal') 关闭
|
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