More small fixes for Github.qml/About.qml

This commit is contained in:
Ly-sec 2025-08-14 15:42:34 +02:00
parent f8ec879270
commit bad205f5f6
2 changed files with 13 additions and 7 deletions

View file

@ -11,7 +11,7 @@ ColumnLayout {
id: root
property string latestVersion: GitHub.latestVersion
property string currentVersion: "v2.0.0" // Fallback version
property string currentVersion: "Unknown" // Fallback version
property var contributors: GitHub.contributors
spacing: 0

View file

@ -18,7 +18,7 @@ Singleton {
property var contributors: []
FileView {
objectName: "githubDataFileView"
id: githubDataFileView
path: githubDataFile
watchChanges: true
onFileChanged: reload()
@ -80,12 +80,16 @@ Singleton {
// --------------------------------
function saveData() {
data.timestamp = Time.timestamp
console.log("[GitHub] Saving data to cache file:", githubDataFile)
console.log("[GitHub] Data to save - version:", data.version, "contributors:", data.contributors.length)
// Ensure cache directory exists
Quickshell.execDetached(["mkdir", "-p", Settings.cacheDir])
Qt.callLater(() => {
// Access the FileView's writeAdapter method
var fileView = root.children.find(child => child.objectName === "githubDataFileView")
if (fileView) {
fileView.writeAdapter()
}
// Use direct ID reference to the FileView
githubDataFileView.writeAdapter()
console.log("[GitHub] Cache file written successfully")
})
}
@ -140,8 +144,10 @@ Singleton {
onStreamFinished: {
try {
const response = text
console.log("[GitHub] Raw contributors response length:", response ? response.length : 0)
if (response && response.trim()) {
const data = JSON.parse(response)
console.log("[GitHub] Parsed contributors data type:", typeof data, "length:", Array.isArray(data) ? data.length : "not array")
root.data.contributors = data || []
root.contributors = root.data.contributors
console.log("[GitHub] Contributors fetched from GitHub:", root.contributors.length)