mirror of
https://github.com/tw93/Mole.git
synced 2026-02-04 15:04:42 +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:
@@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
<div align="center">
|
<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>
|
</div>
|
||||||
|
|
||||||
@@ -12,9 +12,9 @@
|
|||||||
|
|
||||||
| Attribute | Details |
|
| Attribute | Details |
|
||||||
|-----------|---------|
|
|-----------|---------|
|
||||||
| Audit Date | January 15, 2026 |
|
| Audit Date | January 17, 2026 |
|
||||||
| Audit Conclusion | **PASSED** |
|
| Audit Conclusion | **PASSED** |
|
||||||
| Mole Version | V1.21.0 |
|
| Mole Version | V1.22.0 |
|
||||||
| Audited Branch | `main` (HEAD) |
|
| Audited Branch | `main` (HEAD) |
|
||||||
| Scope | Shell scripts, Go binaries, Configuration |
|
| Scope | Shell scripts, Go binaries, Configuration |
|
||||||
| Methodology | Static analysis, Threat modeling, Code review |
|
| Methodology | Static analysis, Threat modeling, Code review |
|
||||||
|
|||||||
@@ -276,7 +276,8 @@ func (c *Collector) Collect() (MetricsSnapshot, error) {
|
|||||||
collect(func() (err error) { proxyStats = collectProxy(); return nil })
|
collect(func() (err error) { proxyStats = collectProxy(); return nil })
|
||||||
collect(func() (err error) { batteryStats, _ = collectBatteries(); return nil })
|
collect(func() (err error) { batteryStats, _ = collectBatteries(); return nil })
|
||||||
collect(func() (err error) { thermalStats = collectThermal(); 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) { gpuStats, err = c.collectGPU(now); return })
|
||||||
collect(func() (err error) {
|
collect(func() (err error) {
|
||||||
// Bluetooth is slow; cache for 30s.
|
// Bluetooth is slow; cache for 30s.
|
||||||
|
|||||||
@@ -10,8 +10,6 @@ import (
|
|||||||
"strconv"
|
"strconv"
|
||||||
"strings"
|
"strings"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"github.com/shirou/gopsutil/v4/sensors"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
var (
|
var (
|
||||||
@@ -283,29 +281,3 @@ func collectThermal() ThermalStatus {
|
|||||||
|
|
||||||
return thermal
|
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
|
|
||||||
}
|
|
||||||
|
|||||||
@@ -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 {
|
func renderCPUCard(cpu CPUStatus, thermal ThermalStatus) cardData {
|
||||||
var lines []string
|
var lines []string
|
||||||
|
|
||||||
@@ -411,9 +402,10 @@ func buildCards(m MetricsSnapshot, width int) []cardData {
|
|||||||
renderProcessCard(m.TopProcesses),
|
renderProcessCard(m.TopProcesses),
|
||||||
renderNetworkCard(m.Network, m.NetworkHistory, m.Proxy, width),
|
renderNetworkCard(m.Network, m.NetworkHistory, m.Proxy, width),
|
||||||
}
|
}
|
||||||
if hasSensorData(m.Sensors) {
|
// Sensors card disabled - redundant with CPU temp
|
||||||
cards = append(cards, renderSensorsCard(m.Sensors))
|
// if hasSensorData(m.Sensors) {
|
||||||
}
|
// cards = append(cards, renderSensorsCard(m.Sensors))
|
||||||
|
// }
|
||||||
return cards
|
return cards
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -600,20 +592,6 @@ func renderBatteryCard(batts []BatteryStatus, thermal ThermalStatus) cardData {
|
|||||||
return cardData{icon: iconBattery, title: "Power", lines: lines}
|
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 {
|
func renderCard(data cardData, width int, height int) string {
|
||||||
titleText := data.icon + " " + data.title
|
titleText := data.icon + " " + data.title
|
||||||
lineLen := max(width-lipgloss.Width(titleText)-2, 4)
|
lineLen := max(width-lipgloss.Width(titleText)-2, 4)
|
||||||
|
|||||||
@@ -316,7 +316,7 @@ start_inline_spinner() {
|
|||||||
exit 0
|
exit 0
|
||||||
) &
|
) &
|
||||||
INLINE_SPINNER_PID=$!
|
INLINE_SPINNER_PID=$!
|
||||||
disown 2> /dev/null || true
|
disown "$INLINE_SPINNER_PID" 2> /dev/null || true
|
||||||
else
|
else
|
||||||
echo -n " ${BLUE}|${NC} $message" >&2 || true
|
echo -n " ${BLUE}|${NC} $message" >&2 || true
|
||||||
fi
|
fi
|
||||||
|
|||||||
2
mole
2
mole
@@ -13,7 +13,7 @@ source "$SCRIPT_DIR/lib/core/commands.sh"
|
|||||||
trap cleanup_temp_files EXIT INT TERM
|
trap cleanup_temp_files EXIT INT TERM
|
||||||
|
|
||||||
# Version and update helpers
|
# Version and update helpers
|
||||||
VERSION="1.22.0"
|
VERSION="1.22.1"
|
||||||
MOLE_TAGLINE="Deep clean and optimize your Mac."
|
MOLE_TAGLINE="Deep clean and optimize your Mac."
|
||||||
|
|
||||||
is_touchid_configured() {
|
is_touchid_configured() {
|
||||||
|
|||||||
Reference in New Issue
Block a user