Compare commits

..

11 Commits

Author SHA1 Message Date
Luk
e8efeeca91 u 2026-02-07 11:36:09 +08:00
Luk
9a9f3f970d ignore *nogit* and *nosf* 2024-09-22 15:52:05 +08:00
Luk
97db352795 improve gitignore and seafile-ignore 2024-04-24 14:18:46 +08:00
Luk
7cb60d71b0 add an ending comma in console.xxx({_at,...}, '\n,') 2024-02-05 11:41:21 +08:00
Luk
e0ba1e32be console.log({_at, ...}) 2024-02-05 09:50:01 +08:00
Luk
599f656646 updated .gitignore and seafile-ignore.txt using npm/sysconfig/*-ignore-find2merge.sh 2024-01-28 12:18:47 +08:00
Luk Lu
5275e4e70f update seafile-ignore.txt 2023-09-12 14:20:11 +08:00
Luk Lu
7e45d021d7 update .gitignore to ignore *.gitignore.* instead of envar-*.gitignore.js 2023-03-11 08:26:26 +08:00
Luk Lu
f329492b38 'add seafile-ignore.txt to every git repo' 2023-01-12 20:09:25 +08:00
Luk Lu
cb76afcda1 update to standard .gitignore 2022-12-10 19:12:53 +08:00
Luk Lu
9a6278db82 update [.gitignore] to ignore /unpackage/* except for !/unpackage/res/ 2022-10-06 20:06:43 +08:00
3 changed files with 190 additions and 56 deletions

132
.gitignore vendored
View File

@@ -1,63 +1,113 @@
# 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
node_modules/
/test/unit/coverage/
/test/e2e/reports/
### .gitignore.global.txt ###
# Self defined pattern to ignore
?*.gitignore
?*.gitignore/
?*.gitignore.*
?*.gitignore.*/
*.gitomit
*.gitomit.*
*.gitomit/
*.gitomit.*/
*.nogit
*.nogit.*
*.nogit/
*.nogit.*/
# 保留
!.gitignore
!.gitignore.*
!.gitkeep
# 通用
.svn/
.deploy_git/
.idea/
.sass-cache/
.deploy_git/
.wrangler
/test/unit/coverage/
/test/e2e/reports/
node_modules/
*.aab
*.apk
*.ipa
*.min.js
*.min.css
*.min.html
*.iml
*.njsproj
*.ntvs*
*.sw*
*.sln
*.suo
.gitattributes
_desktop.ini
.DS_Store
.thumbnails
Thumbs.db
thumbs.db
.umi
.umi-production
npm-debug.log*
yarn-debug.log*
yarn-error.log*
yarn.lock
selenium-debug.log
package-lock.json
*.iml
*.njsproj
*.ntvs*
*.sln
*.suo
._*
.$*
~$*
Thumbs.db
thumbs.db
_desktop.ini
.bashrc_custom
# vue-cli 项目
/dist/
# 来自 vue-cli 创建项目的 .gitignore
.project
# hexo
db.json
/public/
# 客户端 uniapp 项目
/unpackage/dist
/unpackage/release
/unpackage/cache
# Hardhat
/artifacts/
/cache/
# seafile 临时文件
._*
.$*
# office 暂存文件
~$*
# 用户shell配置脚本
.bashrc_custom
# 苹果系统临时文件
.DS_Store
# 安卓缓存文件夹
.thumbnails
# local env files
.env.local
.env.*.local
# hexo
/db.json
# wo
# 服务端
/_archive/*
/_datastore/*
/_logstore/*
/_filestore/*
/_logstore/*
/_webroot/*
/dist/
*.apk
*.min.js
*.min.css
*.min.html
/pages4loader.json5
envar-web-custom.js
envar-deploy-secret.js
/_ssl/*
# uniapp 客户端
/unpackage/*
!/unpackage/res/
package-lock.json
pages4loader.json5
# hexo 项目
public/
### .gitignore.local.txt ###
# 服务端(server or uniapp-uniCloud)项目
envar-base-custom.js
envar-base-dynamic.js
envar-base-secret.js
!.gitkeep

View File

@@ -4,24 +4,24 @@ const { randomBytes } = require('crypto')
// 建议把 onopen, onerror, onclose, onmessage 保留给系统使用例如reconnecting。用户使用 on(event, listener)
const DAD = (module.exports = class RpcSocket extends ws {
constructor(address, protocols, options) {
constructor (address, protocols, options) {
let ws = super(address, protocols, options)
DAD.upgrade(ws)
}
static upgrade(ws) {
static upgrade (ws) {
ws.__proto__ = DAD.prototype
ws.sid = randomBytes(16).toString('hex')
ws.onmessage = async ({ data }) => {
// console.log('[onmessage] 被调用在 data =', data)
// globalThis.wo?.cclog?.({ about:'[onmessage] 被调用在 data =', data})
try {
let { rpcType, rpcHow, rpcWhat, randomEvent, rpcResult } = JSON.parse(data)
// console.log('message data parsed to ', {rpcType, rpcHow, rpcWhat, randomEvent, rpcResult})
// globalThis.wo?.cclog?.({ about:'message data parsed', rpcType, rpcHow, rpcWhat, randomEvent, rpcResult})
switch (rpcType) {
case 'SEND_REQUEST':
// 接收到异步的远程调用
// console.log(`被调方 收到 SEND_REQUEST: rpcHow=${rpcHow}, rpcWhat=${JSON.stringify(rpcWhat)}`)
// globalThis.wo?.cclog?.({ about:'被调方 收到 SEND_REQUEST', rpcHow, rpcWhat})
if (ws.hasOwnProperty(rpcHow)) rpcResult = await ws[rpcHow](rpcWhat)
else rpcResult = { _state: 'ERROR', _stateMsg: `unknown rpcHow=${rpcHow}` }
if (randomEvent) {
@@ -30,20 +30,20 @@ const DAD = (module.exports = class RpcSocket extends ws {
break
case 'SEND_RESULT':
// 接收到远程返回的结果
// console.log('主调方 收到 SEND_RESULT: rpcResult=', rpcResult)
// globalThis.wo?.cclog?.({ about:'主调方 收到 SEND_RESULT', rpcResult})
ws.emit(randomEvent, rpcResult)
break
case 'SEND_NOTIFY':
default:
// 接收到同步的远程调用 或者 标准ws的send(...)
// console.log(`被调方 收到 SEND_NOFITY: rpcHow=${rpcHow}, rpcWhat=${JSON.stringify(rpcWhat)}`)
// globalThis.wo?.cclog?.({ about:'被调方 收到 SEND_NOFITY', rpcHow, rpcWhat})
if (ws.hasOwnProperty(rpcHow)) ws[rpcHow](rpcWhat)
else if (ws.eventNames().indexOf(rpcHow) >= 0) ws.emit(rpcHow, rpcWhat)
else console.error('[onmessage] unknown rpc: ', rpcHow, rpcWhat)
else globalThis.wo?.ccerror?.({ about: '[onmessage] unknown rpc', rpcHow, rpcWhat })
break
}
} catch (exception) {
console.error('[onmessage] invalid rpc data: ', data, exception)
globalThis.wo?.ccerror?.({ about: '[onmessage] invalid rpc data', data, exception })
return
}
}
@@ -51,7 +51,7 @@ const DAD = (module.exports = class RpcSocket extends ws {
return ws
}
static connectAsync(url) {
static connectAsync (url) {
return new Promise(function (resolve, reject) {
let socket = new DAD(url)
socket.onopen = () => resolve(socket)
@@ -59,7 +59,7 @@ const DAD = (module.exports = class RpcSocket extends ws {
})
}
reconnectAsync(url) {
reconnectAsync (url) {
if (this.readyState === ws.CONNECTING || this.readyState === ws.OPEN) {
return Promise.resolve(this)
}
@@ -70,19 +70,19 @@ const DAD = (module.exports = class RpcSocket extends ws {
})
}
sendNotify({ rpcHow, rpcWhat, options, callback } = {}) {
sendNotify ({ rpcHow, rpcWhat, options, callback } = {}) {
// 发起同步的远程调用
this.send(JSON.stringify({ rpcType: 'SEND_NOTIFY', rpcHow, rpcWhat }), options, callback)
}
sendRequest({ rpcHow, rpcWhat, rpcCallback, timeout = 5000 } = {}) {
sendRequest ({ rpcHow, rpcWhat, rpcCallback, timeout = 5000 } = {}) {
// 发起异步的远程调用
let randomEvent = randomBytes(16).toString('hex')
// console.log('randomEvent is randomized: ', randomEvent)
// globalThis.wo?.cclog?.({ about:'randomEvent is randomized', randomEvent})
if (typeof rpcCallback === 'function') {
// 有回调
this.send(JSON.stringify({ rpcType: 'SEND_REQUEST', rpcHow, rpcWhat, randomEvent }), () => {
// console.log('in callback, randomEvent=', randomEvent)
// globalThis.wo?.cclog?.({ about:'in callback', randomEvent})
this.once(randomEvent, rpcCallback)
setTimeout(() => {
if (this.eventNames().indexOf(randomEvent) >= 0) {

84
seafile-ignore.txt Normal file
View File

@@ -0,0 +1,84 @@
# https://help.seafile.com/syncing_client/excluding_files/
# 注释。通配符:* 匹配0到若干个字符包括代表目录的/。? 匹配1个字符包括/。
# seafile-ignore.txt 只能控制在客户端需要忽略哪些文件。你依然可以在 seahub 的 web 界面创建这些被客户端忽略的文件。
# 在这种情况下,
# 这些文件会被同步到客户端,但是用户在客户端对这些文件的后续修改会被忽略,不会被同步回服务器。
# 文件在服务器端的后续更改会被同步到客户端,如果客户端也同时修改了这些文件,系统会生成冲突文件。
# seafile-ignore.txt 只能忽略还没有被同步的文件。对于已经被同步的文件,如果后来把它添加到 seafile-ignore.txt 中,系统只会忽略后续更改,已经上传的版本不会受影响。
### seafile-ignore.global.txt ###
# 自定义的后缀名,凡有 sfignore 后缀的都不进行同步
*.sfignore
*.sfignore/
*.sfignore.*
*.sfignore.*/
*.sfomit
*.sfomit.*
*.sfomit/
*.sfomit.*/
*.nosf
*.nosf.*
*.nosf/
*.nosf.*/
## everything 'git pull or fetch' will update `.git/FETCH_HEAD`, even if the content doesn't change. To avoid too many useless updates of this file in Seafile history:
FETCH_HEAD
*/FETCH_HEAD
.Trash/
.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
*/package-lock.json
pages4loader.json5
*/pages4loader.json5
.deploy_git/
*/.deploy_git/
# next.js 项目
.next/
*/.next/
# HBuilder 目录
unpackage/
*/unpackage/
Icon
OneDrive/Icon
# wrangler project
.dev.vars*
*/.dev.vars*
.wrangler/
*/.wrangler/
### seafile-ignore.local.txt ###