Merge branch 'master' into refactor/refs-from-property-values

pull/6529/head
Tienson Qin 2022-09-14 19:53:49 +08:00
commit 1a8c18488a
10 changed files with 98 additions and 60 deletions

2
.gitignore vendored
View File

@ -45,3 +45,5 @@ startup.png
/src/test/docs
~*~
ios/App/App/capacitor.config.json

View File

@ -1,32 +1,35 @@
import { CapacitorConfig } from '@capacitor/cli';
import { CapacitorConfig } from '@capacitor/cli'
const config: CapacitorConfig = {
appId: 'com.logseq.app',
appName: 'Logseq',
bundledWebRuntime: false,
webDir: 'public',
plugins: {
SplashScreen: {
launchShowDuration: 500,
launchAutoHide: false,
androidScaleType: "CENTER_CROP",
splashImmersive: false,
backgroundColor: "#002b36"
},
Keyboard: {
resize: "none"
}
appId: 'com.logseq.app',
appName: 'Logseq',
bundledWebRuntime: false,
webDir: 'public',
plugins: {
SplashScreen: {
launchShowDuration: 500,
launchAutoHide: false,
androidScaleType: 'CENTER_CROP',
splashImmersive: false,
backgroundColor: '#002b36'
},
ios: {
scheme: "Logseq"
Keyboard: {
resize: 'none'
}
// do not commit this into source control
// source: https://capacitorjs.com/docs/guides/live-reload
// , server: {
// url: process.env.LOGSEQ_APP_SERVER_URL,
// cleartext: true
// }
};
},
ios: {
scheme: 'Logseq'
}
}
if (process.env.LOGSEQ_APP_SERVER_URL) {
Object.assign(config, {
server: {
url: process.env.LOGSEQ_APP_SERVER_URL,
cleartext: true
}
})
}
export = config;

View File

@ -6,6 +6,7 @@ const path = require('path')
const gulp = require('gulp')
const cleanCSS = require('gulp-clean-css')
const del = require('del')
const ip = require('ip')
const outputPath = path.join(__dirname, 'static')
const resourcesPath = path.join(__dirname, 'resources')
@ -49,13 +50,13 @@ const common = {
syncAssetFiles (...params) {
return gulp.series(
() => gulp.src([
"./node_modules/@excalidraw/excalidraw/dist/excalidraw-assets/**",
"!**/*/i18n-*.js"
])
'./node_modules/@excalidraw/excalidraw/dist/excalidraw-assets/**',
'!**/*/i18n-*.js'
])
.pipe(gulp.dest(path.join(outputPath, 'js', 'excalidraw-assets'))),
() => gulp.src("node_modules/@tabler/icons/iconfont/tabler-icons.min.css")
() => gulp.src('node_modules/@tabler/icons/iconfont/tabler-icons.min.css')
.pipe(gulp.dest(path.join(outputPath, 'css'))),
() => gulp.src("node_modules/@tabler/icons/iconfont/fonts/**")
() => gulp.src('node_modules/@tabler/icons/iconfont/fonts/**')
.pipe(gulp.dest(path.join(outputPath, 'css', 'fonts'))),
)(...params)
},
@ -83,6 +84,41 @@ const common = {
path.join(outputPath, 'js/**'),
path.join(outputPath, 'css/**')
], { ignoreInitial: true }, common.syncJS_CSSinRt)
},
async runCapWithLocalDevServerEntry (cb) {
const mode = process.env.PLATFORM || 'ios'
const IP = ip.address()
const LOGSEQ_APP_SERVER_URL = `http://${IP}:3001`
if (typeof global.fetch === 'function') {
try {
await fetch(LOGSEQ_APP_SERVER_URL)
} catch (e) {
return cb(new Error(`/* ❌ Please check if the service is ON. (${LOGSEQ_APP_SERVER_URL}) ❌ */`))
}
}
console.log(`------ Cap ${mode.toUpperCase()} -----`)
console.log(`Dev serve at: ${LOGSEQ_APP_SERVER_URL}`)
console.log(`--------------------------------------`)
cp.execSync(`npx cap sync ${mode}`, {
stdio: 'inherit',
env: Object.assign(process.env, {
LOGSEQ_APP_SERVER_URL
})
})
cp.execSync(`npx cap run ${mode} --external`, {
stdio: 'inherit',
env: Object.assign(process.env, {
LOGSEQ_APP_SERVER_URL
})
})
cb()
}
}
@ -130,6 +166,7 @@ exports.electronMaker = async () => {
})
}
exports.cap = common.runCapWithLocalDevServerEntry
exports.clean = common.clean
exports.watch = gulp.series(common.syncResourceFile, common.syncAssetFiles, common.syncAllStatic,
gulp.parallel(common.keepSyncResourceFile, css.watchCSS))

View File

@ -225,13 +225,13 @@ public class FileSync: CAPPlugin, SyncDebugDelegate {
call.reject("required parameters: passphrase, content")
return
}
guard let ciphertext = content.data(using: .utf8) else {
guard let plaintext = content.data(using: .utf8) else {
call.reject("cannot decode ciphertext with utf8")
return
}
call.keepAlive = true
DispatchQueue.global(qos: .background).async {
if let encrypted = AgeEncryption.encryptWithPassphrase(ciphertext, passphrase, armor: true) {
DispatchQueue.global(qos: .default).async {
if let encrypted = AgeEncryption.encryptWithPassphrase(plaintext, passphrase, armor: true) {
call.resolve(["data": String(data: encrypted, encoding: .utf8) as Any])
} else {
call.reject("cannot encrypt with passphrase")
@ -251,7 +251,7 @@ public class FileSync: CAPPlugin, SyncDebugDelegate {
return
}
call.keepAlive = true
DispatchQueue.global(qos: .background).async {
DispatchQueue.global(qos: .default).async {
if let decrypted = AgeEncryption.decryptWithPassphrase(ciphertext, passphrase) {
call.resolve(["data": String(data: decrypted, encoding: .utf8) as Any])
} else {

View File

@ -1,21 +0,0 @@
{
"appId": "com.logseq.app",
"appName": "Logseq",
"bundledWebRuntime": false,
"webDir": "public",
"plugins": {
"SplashScreen": {
"launchShowDuration": 500,
"launchAutoHide": false,
"androidScaleType": "CENTER_CROP",
"splashImmersive": false,
"backgroundColor": "#002b36"
},
"Keyboard": {
"resize": "none"
}
},
"ios": {
"scheme": "Logseq"
}
}

View File

@ -26,7 +26,8 @@
"stylelint": "^13.8.0",
"stylelint-config-standard": "^20.0.0",
"tailwindcss": "2.2.16",
"typescript": "^4.4.3"
"typescript": "^4.4.3",
"ip": "1.1.8"
},
"scripts": {
"watch": "run-p gulp:watch cljs:watch",
@ -63,7 +64,9 @@
"cljs:debug": "clojure -M:cljs release app --debug",
"cljs:report": "clojure -M:cljs run shadow.cljs.build-report app report.html",
"cljs:build-electron": "clojure -A:cljs compile app electron",
"cljs:lint": "clojure -M:clj-kondo --parallel --lint src --cache false"
"cljs:lint": "clojure -M:clj-kondo --parallel --lint src --cache false",
"ios:dev": "cross-env PLATFORM=ios gulp cap",
"android:dev": "cross-env PLATFORM=android gulp cap"
},
"dependencies": {
"@capacitor/android": "3.2.2",

View File

@ -3,7 +3,7 @@
--ls-tag-text-hover-opacity: 1;
--ls-page-text-size: 1em;
--ls-page-title-size: 36px;
--ls-main-content-max-width: 1200px;
--ls-main-content-max-width: 810px;
--ls-main-content-max-width-wide: 100%;
--ls-font-family: Inter;
--ls-scrollbar-width: 6px;

View File

@ -182,7 +182,7 @@
status (:state sync-state)
status (or (nil? status) (keyword (name status)))
off? (or (nil? sync-state) (fs-sync/sync-state--stopped? sync-state))
off? (file-sync-handler/sync-off? sync-state)
full-syncing? (contains? #{:local->remote-full-sync :remote->local-full-sync} status)
syncing? (or full-syncing? (contains? #{:local->remote :remote->local} status))
idle? (contains? #{:idle} status)
@ -211,6 +211,7 @@
nil
(and synced-file-graph?
(file-sync-handler/graph-sync-off? current-repo)
(second @fs-sync/graphs-txid)
(async/<! (fs-sync/<check-remote-graph-exists (second @fs-sync/graphs-txid))))
(fs-sync/sync-start)

View File

@ -205,3 +205,11 @@
(defn reset-user-state! []
(vreset! *beta-unavailable? false)
(state/set-state! :file-sync/onboarding-state nil))
(defn sync-off?
[sync-state]
(or (nil? sync-state) (sync/sync-state--stopped? sync-state)))
(defn graph-sync-off?
[graph]
(sync-off? (state/get-file-sync-state graph)))

View File

@ -3706,6 +3706,11 @@ invert-kv@^2.0.0:
resolved "https://registry.yarnpkg.com/invert-kv/-/invert-kv-2.0.0.tgz#7393f5afa59ec9ff5f67a27620d11c226e3eec02"
integrity sha512-wPVv/y/QQ/Uiirj/vh3oP+1Ww+AWehmi1g5fFWGPF6IpCBCDVrhgHRMvrLfdYcwDh3QJbGXDW4JAuzxElLSqKA==
ip@1.1.8:
version "1.1.8"
resolved "https://registry.yarnpkg.com/ip/-/ip-1.1.8.tgz#ae05948f6b075435ed3307acce04629da8cdbf48"
integrity sha512-PuExPYUiu6qMBQb4l06ecm6T6ujzhmh+MeJcW9wa89PoAz5pvd4zPgN5WJV104mb6S2T1AwNIAaB70JNrLQWhg==
is-absolute@^1.0.0:
version "1.0.0"
resolved "https://registry.yarnpkg.com/is-absolute/-/is-absolute-1.0.0.tgz#395e1ae84b11f26ad1795e73c17378e48a301576"