mirror of
https://github.com/jumpserver/lina.git
synced 2026-01-13 19:35:24 +00:00
Compare commits
7 Commits
v4.10.14-l
...
v4.8.1
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
c9c2a37f30 | ||
|
|
c1fda10620 | ||
|
|
df1a0228d9 | ||
|
|
959ae0bb2c | ||
|
|
2b22c90701 | ||
|
|
6d16473e4b | ||
|
|
c046c28f6d |
@@ -53,24 +53,24 @@ export default {
|
||||
resizeObserver: null,
|
||||
span: 12,
|
||||
isShow: true,
|
||||
iValue: this.value
|
||||
iValue: this.sanitizeContent(this.value)
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
sanitizedValue() {
|
||||
// 转义特殊字符
|
||||
let content = this.iValue.replace(/\\/g, '\\\\').replace(/\$/g, '\\$')
|
||||
const content = this.iValue.replace(/\\/g, '\\\\').replace(/\$/g, '\\$')
|
||||
|
||||
// 使用 DOMPurify 进行 XSS 过滤
|
||||
content = DOMPurify.sanitize(content)
|
||||
|
||||
return content
|
||||
return this.sanitizeContent(content)
|
||||
}
|
||||
},
|
||||
watch: {
|
||||
value(newVal) {
|
||||
this.iValue = this.sanitizeContent(newVal)
|
||||
}
|
||||
},
|
||||
mounted() {
|
||||
this.$nextTick(() => {
|
||||
this.resizeObserver = new ResizeObserver(entries => {
|
||||
// 监听高度变化
|
||||
const height = entries[0].target.offsetHeight
|
||||
if (height) {
|
||||
this.height = height
|
||||
@@ -90,8 +90,19 @@ export default {
|
||||
this.resizeObserver = null
|
||||
},
|
||||
methods: {
|
||||
sanitizeContent(content) {
|
||||
if (!content) return ''
|
||||
|
||||
return DOMPurify.sanitize(content, {
|
||||
ALLOWED_TAGS: ['p', 'h1', 'h2', 'h3', 'h4', 'h5', 'h6', 'ul', 'ol', 'li', 'strong', 'em', 'code', 'pre', 'blockquote', 'a', 'img'],
|
||||
FORBID_TAGS: ['script', 'style', 'iframe', 'frame', 'object', 'embed'],
|
||||
FORBID_ATTR: ['onerror', 'onload', 'onclick', 'onmouseover']
|
||||
})
|
||||
},
|
||||
onChange() {
|
||||
this.$emit('change', this.iValue)
|
||||
const sanitizedValue = this.sanitizeContent(this.iValue)
|
||||
this.iValue = sanitizedValue
|
||||
this.$emit('change', sanitizedValue)
|
||||
},
|
||||
onView() {
|
||||
this.isShow = !this.isShow
|
||||
|
||||
@@ -25,7 +25,8 @@ export default [
|
||||
title: i18n.t('UserLoginACLs'),
|
||||
app: 'acls',
|
||||
resource: 'loginacl',
|
||||
disableOrgsChange: true
|
||||
disableOrgsChange: true,
|
||||
licenseRequired: true
|
||||
},
|
||||
children: [
|
||||
{
|
||||
|
||||
@@ -67,7 +67,7 @@ export default {
|
||||
fieldsMeta: {},
|
||||
performSubmit(validValues) {
|
||||
let url = this.url
|
||||
const { id = '' } = this.$route.query
|
||||
const { id = '' } = this.$route.params
|
||||
const values = _.cloneDeep(validValues)
|
||||
const submitMethod = id ? 'put' : 'post'
|
||||
|
||||
|
||||
@@ -216,16 +216,18 @@ export default {
|
||||
methods: {
|
||||
async updateOrCloneAsset(row, action) {
|
||||
this.createDrawer = this.drawer[row.category.value]
|
||||
const meta = {
|
||||
action: action,
|
||||
id: row.id,
|
||||
|
||||
const query = {
|
||||
platform: row.platform.id,
|
||||
type: row.type.value,
|
||||
category: row.category.value,
|
||||
row: row,
|
||||
payload: row.payload
|
||||
category: row.category.value
|
||||
}
|
||||
this.$refs.ListTable.onUpdate({ row, query: meta })
|
||||
|
||||
if (action === 'clone') {
|
||||
return this.$refs.ListTable.onClone({ row, query })
|
||||
}
|
||||
|
||||
this.$refs.ListTable.onUpdate({ row, query })
|
||||
},
|
||||
createAsset(platform) {
|
||||
this.showPlatform = false
|
||||
|
||||
@@ -194,7 +194,7 @@ export function getDefaultConfig(vm) {
|
||||
formatter: ActionsFormatter,
|
||||
formatterArgs: {
|
||||
onUpdate: ({ row }) => onAction(row, 'Update'),
|
||||
onClone: ({ row }) => onAction({ ...row, payload: 'pam_asset_clone' }, 'Clone'),
|
||||
onClone: ({ row }) => onAction(row, 'Clone'),
|
||||
performDelete: ({ row }) => {
|
||||
const id = row.id
|
||||
const url = `/api/v1/assets/assets/${id}/`
|
||||
|
||||
@@ -1,10 +0,0 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"module": "commonjs",
|
||||
"target": "es5",
|
||||
"sourceMap": true
|
||||
},
|
||||
"exclude": [
|
||||
"node_modules"
|
||||
]
|
||||
}
|
||||
@@ -57,6 +57,9 @@ export default {
|
||||
}
|
||||
}
|
||||
},
|
||||
mounted() {
|
||||
this.$store.dispatch('users/enterSettingOrg')
|
||||
},
|
||||
methods: {
|
||||
handleUpload(res) {
|
||||
this.$refs.CardTable.reloadTable()
|
||||
|
||||
@@ -75,6 +75,7 @@ export default {
|
||||
}
|
||||
},
|
||||
async mounted() {
|
||||
this.$route.query.platform = 'RemoteAppHost'
|
||||
this.loading = false
|
||||
},
|
||||
methods: {}
|
||||
|
||||
@@ -23,6 +23,7 @@ export default {
|
||||
DrawerListTable
|
||||
},
|
||||
data() {
|
||||
const appletRouteQuery = { type: 'windows', category: 'host', platform: 'RemoteAppHost' }
|
||||
return {
|
||||
createDrawer: () => import('./AppletHostCreateUpdate.vue'),
|
||||
detailDrawer: () => import('./AppletHostDetail/index.vue'),
|
||||
@@ -68,6 +69,9 @@ export default {
|
||||
const url = `/api/v1/terminal/applet-hosts/${id}/`
|
||||
return this.$axios.delete(url)
|
||||
},
|
||||
onUpdate: ({ row }) => {
|
||||
this.$refs.table.onUpdate({ row: row, query: appletRouteQuery })
|
||||
},
|
||||
extraActions: [
|
||||
{
|
||||
name: 'Test',
|
||||
@@ -93,7 +97,7 @@ export default {
|
||||
hasExport: false,
|
||||
hasImport: false,
|
||||
onCreate: () => {
|
||||
this.$refs.table.onCreate({ type: 'windows', category: 'host', platform: 'RemoteAppHost' })
|
||||
this.$refs.table.onCreate({ query: appletRouteQuery })
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user