nicer
Massimo Melina committed
Feb 20, 2023 at 16:18 UTC
0aa053281cd2fc41aabf7e64077317f4b9bcf5ac
3 files changed
+10
-10
README.md
+4
-5
@@ -196,11 +196,10 @@ Valid keys in a node are:
196
- `can_delete` specify who can delete. Applies to folders with a source. Default is none.
197
- `masks`: maps a file mask to a set of properties as the one documented in this section. E.g.
198
```
199
- masks:
200
- "**/*.mp3":
201
- can_read: false
202
- "*.jpg|*.png":
203
- mime: auto
199
+ "**/*.mp3":
200
+ can_read: false
201
+ "*.jpg|*.png":
202
+ mime: auto
203
```
204
205
Permissions set on an inner element will override inherited permissions. This means that you can restrict access to folder1,
admin/src/FileForm.ts
+5
-4
@@ -37,6 +37,7 @@ export default function FileForm({ file, defaultPerms, addToBar }: { file: VfsNo
37
return _.defaults(ret, defaultPerms)
38
}, [parent])
39
const showTimestamps = hasSource && Boolean(values.ctime)
40
+ const showSize = hasSource && !realFolder
41
const barColors = useDialogBarColors()
42
43
const { data, element } = useApiEx<{ list: Account[] }>('get_accounts')
@@ -88,14 +89,14 @@ export default function FileForm({ file, defaultPerms, addToBar }: { file: VfsNo
89
{ accounts: Array.isArray(can_read) ? allAccounts.filter(x => can_read.includes(x.username)) : undefined }),
90
isDir && perm('can_upload', "Who can upload", hasSource ? '' : "Works only on folders with source"),
91
isDir && perm('can_delete', "Who can delete", hasSource ? '' : "Works only on folders with source"),
91
- hasSource && !realFolder && { k: 'size', comp: DisplayField, lg: 4, toField: formatBytes },
92
- showTimestamps && { k: 'ctime', comp: DisplayField, md: 6, lg: 4, label: 'Created', toField: formatTimestamp },
93
- showTimestamps && { k: 'mtime', comp: DisplayField, md: 6, lg: 4, label: 'Modified', toField: formatTimestamp },
92
+ showSize && { k: 'size', comp: DisplayField, lg: 4, toField: formatBytes },
93
+ showTimestamps && { k: 'ctime', comp: DisplayField, md: 6, lg: showSize && 4, label: 'Created', toField: formatTimestamp },
94
+ showTimestamps && { k: 'mtime', comp: DisplayField, md: 6, lg: showSize && 4, label: 'Modified', toField: formatTimestamp },
95
file.website && { k: 'default', comp: BoolField, label:"Serve index.html",
96
toField: Boolean, fromField: (v:boolean) => v ? 'index.html' : null,
97
helperText: md("This folder may be a website because contains `index.html`. Enabling this will show the website instead of the list of files.")
98
},
98
- isDir && { k: 'masks', multiline: true, xl: true, lg: 6,
99
+ isDir && { k: 'masks', multiline: true, lg: true,
100
toField: yaml.stringify, fromField: v => v ? yaml.parse(v) : undefined,
101
sx: { '& textarea': { fontFamily: 'monospace' } },
102
helperText: "Special field, leave empty unless you know what you are doing. YAML syntax." }
admin/src/VfsTree.ts
+1
-1
@@ -89,7 +89,7 @@ export default function VfsTree({ id2node }:{ id2node: Map<string, VfsNode> }) {
89
: iconTooltip(FileIcon, "File"),
90
// attributes
91
h(Box, { sx: {
92
- flex: 0, ml: '2px', '&>*': { fontSize: '87%' },
92
+ flex: 0, ml: '2px', my: '2px', '&>*': { fontSize: '87%', opacity: .6, mt: '-2px' },
93
display: 'grid', gridAutoFlow: 'column', gridTemplateRows: 'auto auto',
94
} },
95
node.can_delete !== undefined && iconTooltip(Delete, "Delete permission"),