mirror of
				https://github.com/9001/copyparty.git
				synced 2025-10-30 20:22:20 -06:00 
			
		
		
		
	ui-elements can be hidden (#928)
This commit is contained in:
		
							parent
							
								
									d9cd7ec3cf
								
							
						
					
					
						commit
						98da5cc509
					
				|  | @ -1496,7 +1496,12 @@ tweaking the ui | |||
|   * to sort in music order (album, track, artist, title) with filename as fallback, you could `--sort tags/Circle,tags/.tn,tags/Artist,tags/Title,href` | ||||
|   * to sort by upload date, first enable showing the upload date in the listing with `-e2d -mte +.up_at` and then `--sort tags/.up_at` | ||||
| 
 | ||||
| see [./docs/rice](./docs/rice) for more, including how to add stuff (css/`<meta>`/...) to the html `<head>` tag, or to add your own translation | ||||
| see [./docs/rice](./docs/rice) for more, including: | ||||
| * how to [hide ui-elements](./docs/rice/README.md#hide-ui-elements) | ||||
| * [custom fonts](./docs/rice/README.md#custom-fonts) | ||||
| * [custom loading-spinner](./docs/rice/README.md#boring-loader-spinner) | ||||
| * adding stuff (css/`<meta>`/...) [to the html `<head>` tag](./docs/rice/README.md#head) | ||||
| * [adding your own translation](./docs/rice/README.md#translations) | ||||
| 
 | ||||
| 
 | ||||
| ## opengraph | ||||
|  |  | |||
|  | @ -1821,6 +1821,15 @@ def add_ui(ap, retry: int): | |||
|     ap2.add_argument("--lg-sba", metavar="TXT", type=u, default="", help="the value of the iframe 'allow' attribute for prologue/epilogue docs (volflag=lg_sba); see https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Permissions-Policy#iframes") | ||||
|     ap2.add_argument("--no-sb-md", action="store_true", help="don't sandbox README/PREADME.md documents (volflags: no_sb_md | sb_md)") | ||||
|     ap2.add_argument("--no-sb-lg", action="store_true", help="don't sandbox prologue/epilogue docs (volflags: no_sb_lg | sb_lg); enables non-js support") | ||||
|     ap2.add_argument("--ui-nombar", action="store_true", help="hide top-menu in the UI (volflag=ui_nombar)") | ||||
|     ap2.add_argument("--ui-noacci", action="store_true", help="hide account-info in the UI (volflag=ui_noacci)") | ||||
|     ap2.add_argument("--ui-nosrvi", action="store_true", help="hide server-info in the UI (volflag=ui_nosrvi)") | ||||
|     ap2.add_argument("--ui-nonav", action="store_true", help="hide navpane+breadcrumbs (volflag=ui_nonav)") | ||||
|     ap2.add_argument("--ui-notree", action="store_true", help="hide navpane in the UI (volflag=ui_nonav)") | ||||
|     ap2.add_argument("--ui-nocpla", action="store_true", help="hide cpanel-link in the UI (volflag=ui_nocpla)") | ||||
|     ap2.add_argument("--ui-nolbar", action="store_true", help="hide link-bar in the UI (volflag=ui_nolbar)") | ||||
|     ap2.add_argument("--ui-noctxb", action="store_true", help="hide context-buttons in the UI (volflag=ui_noctxb)") | ||||
|     ap2.add_argument("--ui-norepl", action="store_true", help="hide repl-button in the UI (volflag=ui_norepl)") | ||||
|     ap2.add_argument("--have-unlistc", action="store_true", help=argparse.SUPPRESS) | ||||
| 
 | ||||
| 
 | ||||
|  |  | |||
|  | @ -3075,6 +3075,10 @@ class AuthSrv(object): | |||
|                 "lifetime": vn.js_ls["lifetime"], | ||||
|                 "u2sort": self.args.u2sort, | ||||
|             } | ||||
|             zs = "ui_noacci ui_nocpla ui_noctxb ui_nolbar ui_nombar ui_nonav ui_notree ui_norepl ui_nosrvi" | ||||
|             for zs in zs.split(): | ||||
|                 if vf.get(zs): | ||||
|                     js_htm[zs] = 1 | ||||
|             vn.js_htm = json_hesc(json.dumps(js_htm)) | ||||
| 
 | ||||
|         vols = list(vfs.all_nodes.values()) | ||||
|  |  | |||
|  | @ -59,6 +59,15 @@ def vf_bmap() -> dict[str, str]: | |||
|         "rm_partial", | ||||
|         "rmagic", | ||||
|         "rss", | ||||
|         "ui_noacci", | ||||
|         "ui_nocpla", | ||||
|         "ui_nolbar", | ||||
|         "ui_nombar", | ||||
|         "ui_nonav", | ||||
|         "ui_notree", | ||||
|         "ui_norepl", | ||||
|         "ui_nosrvi", | ||||
|         "ui_noctxb", | ||||
|         "wo_up_readme", | ||||
|         "wram", | ||||
|         "xdev", | ||||
|  | @ -327,6 +336,15 @@ flagcats = { | |||
|         "md_sba": "value of iframe allow-prop for markdown-sandbox", | ||||
|         "lg_sba": "value of iframe allow-prop for *logue-sandbox", | ||||
|         "nohtml": "return html and markdown as text/html", | ||||
|         "ui_noacci": "hide account-info in the UI", | ||||
|         "ui_nocpla": "hide cpanel-link in the UI", | ||||
|         "ui_nolbar": "hide link-bar in the UI", | ||||
|         "ui_nombar": "hide top-menu in the UI", | ||||
|         "ui_nonav": "hide navpane+breadcrumbs in the UI", | ||||
|         "ui_notree": "hide navpane in the UI", | ||||
|         "ui_norepl": "hide repl-button in the UI", | ||||
|         "ui_nosrvi": "hide server-info in the UI", | ||||
|         "ui_noctxb": "hide context-buttons in the UI", | ||||
|     }, | ||||
|     "opengraph (discord embeds)": { | ||||
|         "og": "enable OG (disables hotlinking)", | ||||
|  |  | |||
|  | @ -1118,6 +1118,9 @@ var ACtx = !IPHONE && (window.AudioContext || window.webkitAudioContext), | |||
| 	hash0 = location.hash, | ||||
| 	sloc0 = '' + location, | ||||
| 	noih = /[?&]v\b/.exec(sloc0), | ||||
| 	fullui = /[?&]fullui\b/.exec(sloc0), | ||||
| 	nonav = !fullui && (/[?&]nonav\b/.exec(sloc0) || window.ui_nonav), | ||||
| 	notree = !fullui && (/[?&]notree\b/.exec(sloc0) || window.ui_notree || nonav), | ||||
| 	dbg_kbd = /[?&]dbgkbd\b/.exec(sloc0), | ||||
| 	abrt_key = "", | ||||
| 	can_shr = false, | ||||
|  | @ -6660,7 +6663,7 @@ var treectl = (function () { | |||
| 	r.show = function () { | ||||
| 		r.hidden = false; | ||||
| 		if (!entreed) { | ||||
| 			ebi('path').style.display = 'inline-block'; | ||||
| 			ebi('path').style.display = nonav ? 'none' : 'inline-block'; | ||||
| 			return; | ||||
| 		} | ||||
| 
 | ||||
|  | @ -6678,8 +6681,9 @@ var treectl = (function () { | |||
| 		swrite('entreed', 'na'); | ||||
| 
 | ||||
| 		r.hide(); | ||||
| 		if (!nonav) | ||||
| 			ebi('path').style.display = ''; | ||||
| 	} | ||||
| 	}; | ||||
| 
 | ||||
| 	r.hide = function () { | ||||
| 		r.hidden = true; | ||||
|  | @ -6689,7 +6693,7 @@ var treectl = (function () { | |||
| 		window.removeEventListener('resize', onresize); | ||||
| 		window.removeEventListener('scroll', onscroll); | ||||
| 		aligngriditems(); | ||||
| 	} | ||||
| 	}; | ||||
| 
 | ||||
| 	function unmenter() { | ||||
| 		if (mentered) { | ||||
|  | @ -7554,6 +7558,11 @@ var treectl = (function () { | |||
| 	var cs = sread('entreed'), | ||||
| 		vw = window.innerWidth / parseFloat(getComputedStyle(document.body)['font-size']); | ||||
| 
 | ||||
| 	if (notree) { | ||||
| 		cs = 'na'; | ||||
| 		r.hide(); | ||||
| 	} | ||||
| 
 | ||||
| 	if (cs == 'tree' || (cs != 'na' && vw >= 60)) | ||||
| 		r.entree(null, true); | ||||
| 
 | ||||
|  | @ -9366,3 +9375,14 @@ function reload_browser() { | |||
| 	msel.render(); | ||||
| } | ||||
| treectl.hydrate(); | ||||
| 
 | ||||
| if (!fullui && (window.ui_nombar || /[?&]nombar\b/.exec(sloc0))) ebi('ops').style.display = 'none'; | ||||
| if (!fullui && (window.ui_noacci || /[?&]noacci\b/.exec(sloc0))) ebi('acc_info').style.display = 'none'; | ||||
| if (!fullui && (window.ui_nosrvi || /[?&]nosrvi\b/.exec(sloc0))) ebi('srv_info').style.display = 'none'; | ||||
| if (!fullui && (window.ui_nocpla || /[?&]nocpla\b/.exec(sloc0))) ebi('goh').style.display = 'none'; | ||||
| if (!fullui && (window.ui_nolbar || /[?&]nolbar\b/.exec(sloc0))) ebi('wfp').style.display = 'none'; | ||||
| if (!fullui && (window.ui_noctxb || /[?&]noctxb\b/.exec(sloc0))) ebi('wtoggle').style.display = 'none'; | ||||
| if (!fullui && (window.ui_norepl || /[?&]norepl\b/.exec(sloc0))) ebi('repl').style.display = 'none'; | ||||
| 
 | ||||
| var m = /[?&]theme=([0-9]+)/.exec(sloc0); | ||||
| if (m) settheme.go(parseInt(m[1])); | ||||
|  |  | |||
|  | @ -1,3 +1,24 @@ | |||
| # hide ui-elements | ||||
| 
 | ||||
| useful for simplifying the UI in a write-only folder for uploads, or to embed copyparty into another website in an `<iframe>` or similar | ||||
| 
 | ||||
| | url-param | volflag | what it hides | | ||||
| | --------- | ------- | ------------- | | ||||
| | [nombar](https://a.ocv.me/pub/demo/?nombar) | ui_nombar | the menu-bar at the top | | ||||
| | [noacci](https://a.ocv.me/pub/demo/?noacci) | ui_noacci | permissions-list and logout-button | | ||||
| | [nosrvi](https://a.ocv.me/pub/demo/?nosrvi) | ui_nosrvi | server-info (name, disk usage) | | ||||
| | [notree](https://a.ocv.me/pub/demo/?notree) | ui_notree | the navpane sidebar | | ||||
| | [nonav](https://a.ocv.me/pub/demo/?nonav)   | ui_nonav  | `notree` + breadcrumbs | | ||||
| | [nocpla](https://a.ocv.me/pub/demo/?nocpla) | ui_nocpla | link to controlpanel | | ||||
| | [nolbar](https://a.ocv.me/pub/demo/?nolbar) | ui_nolbar | `nocpla` + "prev/up/next" | | ||||
| | [noctxb](https://a.ocv.me/pub/demo/?noctxb) | ui_noctxb | tray-toggle / context-buttons | | ||||
| | [norepl](https://a.ocv.me/pub/demo/?norepl) | ui_norepl | the `π` repl button | | ||||
| 
 | ||||
| can be combined; https://a.ocv.me/pub/demo/?nombar&noacci&nosrvi&nonav&nolbar&noctxb&norepl | ||||
| 
 | ||||
| all options can be overruled with url-param `fullui`; https://a.ocv.me/pub/demo/?fullui | ||||
| 
 | ||||
| 
 | ||||
| # custom fonts | ||||
| 
 | ||||
| to change the fonts in the web-UI,  first save the following text (the default font-config) to a new css file, for example named `customfonts.css` in your webroot: | ||||
|  |  | |||
|  | @ -143,7 +143,7 @@ class Cfg(Namespace): | |||
|     def __init__(self, a=None, v=None, c=None, **ka0): | ||||
|         ka = {} | ||||
| 
 | ||||
|         ex = "allow_flac allow_wav chpw cookie_lax daw dav_auth dav_mac dav_rt e2d e2ds e2dsa e2t e2ts e2tsr e2v e2vu e2vp early_ban ed emp exp force_js getmod grid gsel hardlink hardlink_only http_no_tcp ih ihead localtime log_badxml magic md_no_br nid nih no_acode no_athumb no_bauth no_clone no_cp no_dav no_db_ip no_del no_dirsz no_dupe no_dupe_m no_fnugg no_lifetime no_logues no_mv no_pipe no_poll no_readme no_robots no_sb_md no_sb_lg no_scandir no_tail no_tarcmp no_thumb no_vthumb no_u2abrt no_zip no_zls nrand nsort nw og og_no_head og_s_title ohead opds q rand re_dirsz reflink rm_partial rmagic rss smb srch_dbg srch_excl srch_icase stats uqe usernames vague_403 vc ver wo_up_readme write_uplog xdev xlink xvol zipmaxu zs" | ||||
|         ex = "allow_flac allow_wav chpw cookie_lax daw dav_auth dav_mac dav_rt e2d e2ds e2dsa e2t e2ts e2tsr e2v e2vu e2vp early_ban ed emp exp force_js getmod grid gsel hardlink hardlink_only http_no_tcp ih ihead localtime log_badxml magic md_no_br nid nih no_acode no_athumb no_bauth no_clone no_cp no_dav no_db_ip no_del no_dirsz no_dupe no_dupe_m no_fnugg no_lifetime no_logues no_mv no_pipe no_poll no_readme no_robots no_sb_md no_sb_lg no_scandir no_tail no_tarcmp no_thumb no_vthumb no_u2abrt no_zip no_zls nrand nsort nw og og_no_head og_s_title ohead opds q rand re_dirsz reflink rm_partial rmagic rss smb srch_dbg srch_excl srch_icase stats ui_noacci ui_nocpla ui_noctxb ui_nolbar ui_nombar ui_nonav ui_notree ui_norepl ui_nosrvi uqe usernames vague_403 vc ver wo_up_readme write_uplog xdev xlink xvol zipmaxu zs" | ||||
|         ka.update(**{k: False for k in ex.split()}) | ||||
| 
 | ||||
|         ex = "dav_inf dedup dotpart dotsrch hook_v no_dhash no_fastboot no_fpool no_htp no_rescan no_sendfile no_ses no_snap no_up_list no_voldump wram re_dhash see_dots plain_ip" | ||||
|  |  | |||
		Loading…
	
		Reference in a new issue