1
0
mirror of https://github.com/tw93/Mole.git synced 2026-02-04 12:41:46 +00:00

chore: remove redundant sensors card and bump version to 1.22.1

- Disable sensors data collection (CPU temp already shown in CPU card)
- Remove unused sensor-related functions (collectSensors, prettifyLabel, hasSensorData, renderSensorsCard)
- Remove unused gopsutil/sensors import
- Fix inline spinner disown call with explicit PID
- Update version from 1.22.0 to 1.22.1
- Update SECURITY_AUDIT.md to match new version and date
This commit is contained in:
Tw93
2026-01-17 10:46:11 +08:00
parent d39d787c83
commit 72f42a363e
6 changed files with 11 additions and 60 deletions

View File

@@ -2,7 +2,7 @@
<div align="center">
**Status:** PASSED | **Risk Level:** LOW | **Version:** 1.21.0 (2026-01-15)
**Status:** PASSED | **Risk Level:** LOW | **Version:** 1.22.1 (2026-01-17)
</div>
@@ -12,9 +12,9 @@
| Attribute | Details |
|-----------|---------|
| Audit Date | January 15, 2026 |
| Audit Date | January 17, 2026 |
| Audit Conclusion | **PASSED** |
| Mole Version | V1.21.0 |
| Mole Version | V1.22.0 |
| Audited Branch | `main` (HEAD) |
| Scope | Shell scripts, Go binaries, Configuration |
| Methodology | Static analysis, Threat modeling, Code review |

View File

@@ -276,7 +276,8 @@ func (c *Collector) Collect() (MetricsSnapshot, error) {
collect(func() (err error) { proxyStats = collectProxy(); return nil })
collect(func() (err error) { batteryStats, _ = collectBatteries(); return nil })
collect(func() (err error) { thermalStats = collectThermal(); return nil })
collect(func() (err error) { sensorStats, _ = collectSensors(); return nil })
// Sensors disabled - CPU temp already shown in CPU card
// collect(func() (err error) { sensorStats, _ = collectSensors(); return nil })
collect(func() (err error) { gpuStats, err = c.collectGPU(now); return })
collect(func() (err error) {
// Bluetooth is slow; cache for 30s.

View File

@@ -10,8 +10,6 @@ import (
"strconv"
"strings"
"time"
"github.com/shirou/gopsutil/v4/sensors"
)
var (
@@ -283,29 +281,3 @@ func collectThermal() ThermalStatus {
return thermal
}
func collectSensors() ([]SensorReading, error) {
temps, err := sensors.SensorsTemperatures()
if err != nil {
return nil, err
}
var out []SensorReading
for _, t := range temps {
if t.Temperature <= 0 || t.Temperature > 150 {
continue
}
out = append(out, SensorReading{
Label: prettifyLabel(t.SensorKey),
Value: t.Temperature,
Unit: "°C",
})
}
return out, nil
}
func prettifyLabel(key string) string {
key = strings.TrimSpace(key)
key = strings.TrimPrefix(key, "TC")
key = strings.ReplaceAll(key, "_", " ")
return key
}

View File

@@ -201,15 +201,6 @@ func getScoreStyle(score int) lipgloss.Style {
}
}
func hasSensorData(sensors []SensorReading) bool {
for _, s := range sensors {
if s.Note == "" && s.Value > 0 {
return true
}
}
return false
}
func renderCPUCard(cpu CPUStatus, thermal ThermalStatus) cardData {
var lines []string
@@ -411,9 +402,10 @@ func buildCards(m MetricsSnapshot, width int) []cardData {
renderProcessCard(m.TopProcesses),
renderNetworkCard(m.Network, m.NetworkHistory, m.Proxy, width),
}
if hasSensorData(m.Sensors) {
cards = append(cards, renderSensorsCard(m.Sensors))
}
// Sensors card disabled - redundant with CPU temp
// if hasSensorData(m.Sensors) {
// cards = append(cards, renderSensorsCard(m.Sensors))
// }
return cards
}
@@ -600,20 +592,6 @@ func renderBatteryCard(batts []BatteryStatus, thermal ThermalStatus) cardData {
return cardData{icon: iconBattery, title: "Power", lines: lines}
}
func renderSensorsCard(sensors []SensorReading) cardData {
var lines []string
for _, s := range sensors {
if s.Note != "" {
continue
}
lines = append(lines, fmt.Sprintf("%-12s %s", shorten(s.Label, 12), colorizeTemp(s.Value)+s.Unit))
}
if len(lines) == 0 {
lines = append(lines, subtleStyle.Render("No sensors"))
}
return cardData{icon: iconSensors, title: "Sensors", lines: lines}
}
func renderCard(data cardData, width int, height int) string {
titleText := data.icon + " " + data.title
lineLen := max(width-lipgloss.Width(titleText)-2, 4)

View File

@@ -316,7 +316,7 @@ start_inline_spinner() {
exit 0
) &
INLINE_SPINNER_PID=$!
disown 2> /dev/null || true
disown "$INLINE_SPINNER_PID" 2> /dev/null || true
else
echo -n " ${BLUE}|${NC} $message" >&2 || true
fi

2
mole
View File

@@ -13,7 +13,7 @@ source "$SCRIPT_DIR/lib/core/commands.sh"
trap cleanup_temp_files EXIT INT TERM
# Version and update helpers
VERSION="1.22.0"
VERSION="1.22.1"
MOLE_TAGLINE="Deep clean and optimize your Mac."
is_touchid_configured() {