From 8eb7f03c0c2dc0d4bb3127e9c36eb37087cf6959 Mon Sep 17 00:00:00 2001 From: Luk Date: Sun, 28 Jan 2024 12:19:08 +0800 Subject: [PATCH] updated .gitignore and seafile-ignore.txt using npm/sysconfig/*-ignore-find2merge.sh --- .gitignore | 19 +++++++- seafile-ignore.txt | 111 +++++++++++++++++++++++---------------------- unitool.js | 43 ++++++++++-------- 3 files changed, 99 insertions(+), 74 deletions(-) diff --git a/.gitignore b/.gitignore index cb4fce5..b316cfd 100644 --- a/.gitignore +++ b/.gitignore @@ -1,12 +1,25 @@ # See https://help.github.com/articles/ignoring-files/ for more about ignoring files. +# how to include another gitignore? +# https://stackoverflow.com/questions/7005142/can-i-include-other-gitignore-file-in-a-gitignore-file-like-include-in-c-li +# https://github.com/github/gitignore +# https://github.com/SlideWave/gitignore-include?tab=readme-ov-file#examples +# https://gitignore.io -### 目录 ################################################################# +### .gitignore_global ### + +# Self defined extension to ignore all files/folders containing .gitignore +*.gitignore.* +*.gitignore.*/ +*.gitignore +*.gitignore/ +!.gitignore # 通用 .svn/ .deploy_git/ .idea/ .sass-cache/ +.wrangler /test/unit/coverage/ /test/e2e/reports/ node_modules/ @@ -70,7 +83,6 @@ _desktop.ini /db.json # wo -*.gitignore.* # 服务端 /_archive/* /_datastore/* @@ -86,3 +98,6 @@ pages4loader.json5 # 保留 !.gitkeep + +### .gitignore_local ### + diff --git a/seafile-ignore.txt b/seafile-ignore.txt index 748ad87..8328961 100644 --- a/seafile-ignore.txt +++ b/seafile-ignore.txt @@ -1,54 +1,57 @@ -# https://help.seafile.com/syncing_client/excluding_files/ -# 注释。通配符:* 匹配0到若干个字符,包括代表目录的/。? 匹配1个字符,包括/。 -# seafile-ignore.txt 只能控制在客户端需要忽略哪些文件。你依然可以在 seahub 的 web 界面创建这些被客户端忽略的文件。 -# 在这种情况下, -# 这些文件会被同步到客户端,但是用户在客户端对这些文件的后续修改会被忽略,不会被同步回服务器。 -# 文件在服务器端的后续更改会被同步到客户端,如果客户端也同时修改了这些文件,系统会生成冲突文件。 -# seafile-ignore.txt 只能忽略还没有被同步的文件。对于已经被同步的文件,如果后来把它添加到 seafile-ignore.txt 中,系统只会忽略后续更改,已经上传的版本不会受影响。 - -# 自定义的后缀名,凡有 sfignore 后缀的都不进行同步 -*.sfignore -*.sfignore.* -*.sfignore/ -*.sfignore.*/ - -.DS_Store -*/.DS_Store - -.thumbnails -*/.thumbnails - -Thumbs.db -*/Thumbs.db -thumbs.db -*/thumbs.db - -_desktop.ini -*/_desktop.ini - -._* -*/._* - -.$* -*/.$* - -~$* -*/~$* - -node_modules/ -*/node_modules/ -package-lock.json - -pages4loader.json5 - -.svn/ -*/.svn/ - -.deploy_git/ -*/.deploy_git/ - -unpackage/ -*/unpackage/ - -Icon -OneDrive/Icon +# https://help.seafile.com/syncing_client/excluding_files/ +# 注释。通配符:* 匹配0到若干个字符,包括代表目录的/。? 匹配1个字符,包括/。 +# seafile-ignore.txt 只能控制在客户端需要忽略哪些文件。你依然可以在 seahub 的 web 界面创建这些被客户端忽略的文件。 +# 在这种情况下, +# 这些文件会被同步到客户端,但是用户在客户端对这些文件的后续修改会被忽略,不会被同步回服务器。 +# 文件在服务器端的后续更改会被同步到客户端,如果客户端也同时修改了这些文件,系统会生成冲突文件。 +# seafile-ignore.txt 只能忽略还没有被同步的文件。对于已经被同步的文件,如果后来把它添加到 seafile-ignore.txt 中,系统只会忽略后续更改,已经上传的版本不会受影响。 + +### seafile-ignore_global ### + +# 自定义的后缀名,凡有 sfignore 后缀的都不进行同步 +*.sfignore +*.sfignore.* +*.sfignore/ +*.sfignore.*/ + +.DS_Store +*/.DS_Store + +.thumbnails +*/.thumbnails + +Thumbs.db +*/Thumbs.db +thumbs.db +*/thumbs.db + +_desktop.ini +*/_desktop.ini + +._* +*/._* + +.$* +*/.$* + +~$* +*/~$* + +node_modules/ +*/node_modules/ +package-lock.json + +pages4loader.json5 + +.deploy_git/ +*/.deploy_git/ + +# HBuilder 目录 +unpackage/ +*/unpackage/ + +Icon +OneDrive/Icon + +### seafile-ignore_local ### + diff --git a/unitool.js b/unitool.js index 7f60ff1..5448118 100644 --- a/unitool.js +++ b/unitool.js @@ -85,7 +85,7 @@ export default { uni.setNavigationBarTitle({ title: navibarTitle }) } - //#ifdef H5 + //#ifdef WEB //// 设置窗口标题栏 document.title //// navibarTitle 也会被用于浏览器的标签标题,可用 document.title 去覆盖。必须放在 setNavigationBarTitle 之后。 //// 但这个方案,在电脑上,还是会显示 navibarTitle 在浏览器窗口顶栏,不知为何。 @@ -106,10 +106,10 @@ export default { wo?.pagesJson?.tabBar?.list?.forEach((tab, tabIndex) => { if (tab.i18nText && tab.i18nText[langNow]) { uni.setTabBarItem({ - // #ifdef H5 + // #ifdef WEB index: tabIndex, // + ((wo?.pagesJson?.tabBar?.midButton?.iconPath && tabIndex >= midIndex)?1:0), // H5 里,如果使用了 midButton,tabBarItem的index出现错位,需hack调整。推测,在H5里 midButton 作为一个普通tab被插入到 tabBar 里,导致 tabBar 的 index 和 wo?.pagesJson.tabBar.list 的 index 错位了。[20211031] 注意到,从 HBuilderX 3.2.12.20211029 起,在 H5 里也没有错位了。 // #endif - // #ifndef H5 + // #ifndef WEB index: tabIndex, // #endif text: tab.i18nText[langNow], @@ -281,11 +281,11 @@ export default { let [errorChoose, { tempFilePath }] = await uni.chooseVideo({ sourceType }) filePath = tempFilePath } else { - // #ifdef H5 + // #ifdef WEB let [errorChoose, { tempFilePaths, tempFiles } = {}] = await uni.chooseFile({ count, type: 'all' }) filePath = tempFilePaths?.[0] // #endif - // #ifndef H5 + // #ifndef WEB return { _state: 'UNKNOWN_MEDIATYPE' } // #endif } @@ -337,12 +337,12 @@ export default { // uni.showModal({ title: 'tempFilePaths[0]=' + tempFilePaths[0] }) filePath = tempFilePaths?.[0] // 在 H5 上并不是文件路径名,而是类似 "blob:http://localhost:8080/f0d3e54d-0694-4803-8097-641d76a10b0d“。// 在 iOS 上是 "_doc/uniapp_temp_1598593902955/compressed/1598593925815.png", 有时还包含从 file:/// 开始的完整路径名 let random = crypto.randomBytes(16).toString('hex') - // #ifndef H5 + // #ifndef WEB // let [errorGetImageInfo, { path, width, height, orientation, type }] = await uni.getImageInfo({ src: filePath }) // cloudPath = path // 完整路径,包含后缀名。形如 file:///var/mobile/Containers/Data/Application/55A76332-44F5-4D5F-A9F6-3F857D584883/Documents/Pandora/apps/D064A425A8BEC13F9D8F741B98B37BC5/doc/uniapp_temp_1598593902955/compressed/1598593925815.png cloudPath = `APP_${wo.envar.clientInfo.osName}_${random}${path.extname(filePath || '')}` // #endif - // #ifdef H5 + // #ifdef WEB cloudPath = `WEB_${wo.envar.clientInfo.osName}_${random}${path.extname(tempFiles?.[0]?.name || '')}` // name is available in H5 only. 只包含文件名和后缀名,不包含路径。 // #endif if (!path.extname(cloudPath)) cloudPath += '.jpg' @@ -353,10 +353,10 @@ export default { // uni.showModal({ title: 'tempFilePath=' + tempFilePath }) filePath = tempFilePath // 在 iOS 上形如 "file:///var/mobile/Containers/Data/Application/55A76332-44F5-4D5F-A9F6-3F857D584883/Documents/Pandora/apps/26B43CD2F587D37FC6799108434A6F84/doc/uniapp_temp_1598596171580/gallery/IMG_3082.MOV" let random = crypto.randomBytes(16).toString('hex') - // #ifndef H5 + // #ifndef WEB cloudPath = `APP_${wo.envar.clientInfo.osName}_${random}_dur${duration}${path.extname(filePath || '')}` // #endif - // #ifdef H5 + // #ifdef WEB cloudPath = `WEB_${wo.envar.clientInfo.osName}_${random}_dur${duration}${path.extname(name || '')}` // tempFile and name are H5 only // #endif // iOS 上测试,filePath 为 *.MOV,而阿里云只允许 *.mp4, 所以默认添加 .mp4 后缀。参见 https://uniapp.dcloud.net.cn/uniCloud/storage?id=clouduploadfile @@ -422,16 +422,16 @@ export default { open_url_in_browser (url) { url = this.localizeText?.(url) || url - // #ifdef APP-PLUS + // #ifdef APP plus.runtime.openURL(url) // #endif - // #ifdef H5 + // #ifdef WEB window.open(url, '_blank') // #endif }, parse_ua_to_browser () { - // #ifdef H5 + // #ifdef WEB let userAgent = globalThis.window?.navigator?.userAgent?.toLowerCase?.() return /msie/.test(userAgent) && !/opera/.test(userAgent) ? 'msie' @@ -469,11 +469,11 @@ export default { showToast ({ tool, type = 'success', image, title, duration = 2000, wo = globalThis.wo, ...rest } = {}) { title = this.localizeText(title) if (tool === 'uni') { - // #ifdef APP-PLUS + // #ifdef APP uni.showToast({ icon: 'none', title, duration, ...rest }) // plus.nativeUI.toast( title, { align: center/left/right, verticalAlign: bottom/center/top, duration:long/short, icon, iconWidth, iconHeight, style: block/inline, type:text/richtext }) // #endif - // #ifndef APP-PLUS + // #ifndef APP uni.showToast({ icon: 'none', image, title, duration, ...rest }) // #endif return @@ -491,12 +491,19 @@ export default { } }, + showModal (option) { + // #ifdef APP + if (option.content) option.content = '\n' + option.content + // #endif + uni.showModal(option) + }, + showLoading ({ title = { zhCN: '加载中...', enUS: 'Loading...' }, mask } = {}) { title = this.localizeText(title) - // #ifndef APP-PLUS + // #ifndef APP uni.showLoading({ title, mask }) // #endif - // #ifdef APP-PLUS + // #ifdef APP // 在安卓应用里,uni.showLoading() 重复调用,导致不断闪烁跳动。 // plus.nativeUI.showWaiting() 调用多了则导致死机。 // 还好,showWaiting() 返回 waiting 对象,可以 waiting.setTitle() @@ -504,10 +511,10 @@ export default { // #endif }, hideLoading () { - // #ifndef APP-PLUS + // #ifndef APP uni.hideLoading() // #endif - // #ifdef APP-PLUS + // #ifdef APP plus.nativeUI.closeWaiting() // #endif },