Skip to content

Commit

Permalink
Don't send DDC/CI request for locked values
Browse files Browse the repository at this point in the history
Also keep using DSA too until we have a good adoption rate of the edDSA versions.
  • Loading branch information
alin23 committed Mar 23, 2019
1 parent a259ae3 commit 8649477
Show file tree
Hide file tree
Showing 13 changed files with 114 additions and 32 deletions.
4 changes: 3 additions & 1 deletion .gitattributes
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ PreBuiltFrameworks/NSPageControl.framework.zip filter=lfs diff=lfs merge=lfs -te
PreBuiltFrameworks/Solar.framework.zip filter=lfs diff=lfs merge=lfs -text
PreBuiltFrameworks/Sparkle.framework.zip filter=lfs diff=lfs merge=lfs -text
PreBuiltFrameworks/SwiftyBeaver.framework.zip filter=lfs diff=lfs merge=lfs -text
Releases/Lunar-latest.dmg filter=lfs diff=lfs merge=lfs -text
Releases/Lunar-2.3.1.dmg filter=lfs diff=lfs merge=lfs -text
LegacyReleases/Lunar-2.1.1.dmg filter=lfs diff=lfs merge=lfs -text
LegacyReleases/Lunar-2.2.0.dmg filter=lfs diff=lfs merge=lfs -text
Expand All @@ -34,3 +33,6 @@ LegacyReleases/Lunar-1.0.0.dmg filter=lfs diff=lfs merge=lfs -text
LegacyReleases/Lunar-2.0.3.dmg filter=lfs diff=lfs merge=lfs -text
LegacyReleases/Lunar-2.1.0.dmg filter=lfs diff=lfs merge=lfs -text
LegacyReleases/Lunar-2.1.2.dmg filter=lfs diff=lfs merge=lfs -text
Releases/Lunar-2.3.2.dmg filter=lfs diff=lfs merge=lfs -text
Releases/Lunar2.3.2-2.3.1.delta filter=lfs diff=lfs merge=lfs -text
Lunar.dmg filter=lfs diff=lfs merge=lfs -text
3 changes: 3 additions & 0 deletions Lunar.dmg
Git LFS file not shown
4 changes: 4 additions & 0 deletions Lunar.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@
C794E1641FEE84DF00549462 /* ToggleButton.swift in Sources */ = {isa = PBXBuildFile; fileRef = C794E1631FEE84DF00549462 /* ToggleButton.swift */; };
C794E1741FEFE31A00549462 /* ScrollableTextField.swift in Sources */ = {isa = PBXBuildFile; fileRef = C794E1731FEFE31A00549462 /* ScrollableTextField.swift */; };
C794E1771FF01EF500549462 /* Model.xcdatamodeld in Sources */ = {isa = PBXBuildFile; fileRef = C794E1751FF01EF500549462 /* Model.xcdatamodeld */; };
C7A2574220EA249B003B3A84 /* dsa_pub.pem in Resources */ = {isa = PBXBuildFile; fileRef = C7A2574120EA249B003B3A84 /* dsa_pub.pem */; };
C7A2BDDA223FC8D100C910E3 /* Surge.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = C7A2BDD9223FC8D100C910E3 /* Surge.framework */; };
C7A2BDDB223FC8D100C910E3 /* Surge.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = C7A2BDD9223FC8D100C910E3 /* Surge.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; };
C7A2BDEC22411E9500C910E3 /* Charts.framework.dSYM in CopyFiles */ = {isa = PBXBuildFile; fileRef = C7A2BDDF22411E9300C910E3 /* Charts.framework.dSYM */; };
Expand Down Expand Up @@ -206,6 +207,7 @@
C794E1631FEE84DF00549462 /* ToggleButton.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ToggleButton.swift; sourceTree = "<group>"; };
C794E1731FEFE31A00549462 /* ScrollableTextField.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ScrollableTextField.swift; sourceTree = "<group>"; };
C794E1761FF01EF500549462 /* Model.xcdatamodel */ = {isa = PBXFileReference; lastKnownFileType = wrapper.xcdatamodel; path = Model.xcdatamodel; sourceTree = "<group>"; };
C7A2574120EA249B003B3A84 /* dsa_pub.pem */ = {isa = PBXFileReference; lastKnownFileType = text; name = dsa_pub.pem; path = Lunar/Resources/dsa_pub.pem; sourceTree = "<group>"; };
C7A2BDD9223FC8D100C910E3 /* Surge.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Surge.framework; path = Frameworks/Surge.framework; sourceTree = "<group>"; };
C7A2BDDF22411E9300C910E3 /* Charts.framework.dSYM */ = {isa = PBXFileReference; lastKnownFileType = wrapper.dsym; name = Charts.framework.dSYM; path = Frameworks/Charts.framework.dSYM; sourceTree = "<group>"; };
C7A2BDE022411E9300C910E3 /* SwiftyJSON.framework.dSYM */ = {isa = PBXFileReference; lastKnownFileType = wrapper.dsym; name = SwiftyJSON.framework.dSYM; path = Frameworks/SwiftyJSON.framework.dSYM; sourceTree = "<group>"; };
Expand Down Expand Up @@ -374,6 +376,7 @@
C750833C2222865E0020270E /* SwiftyBeaver.framework */,
C750833A2222865E0020270E /* SwiftyJSON.framework */,
C75083342222865D0020270E /* WAYWindow.framework */,
C7A2574120EA249B003B3A84 /* dsa_pub.pem */,
C750835D2222BEAA0020270E /* Crashlytics.framework */,
C750835E2222BEAA0020270E /* Fabric.framework */,
C7AEC7F71FD0B4350039B562 /* Lunar */,
Expand Down Expand Up @@ -539,6 +542,7 @@
files = (
C7AEC7FD1FD0B4350039B562 /* Assets.xcassets in Resources */,
C7AEC8001FD0B4350039B562 /* Main.storyboard in Resources */,
C7A2574220EA249B003B3A84 /* dsa_pub.pem in Resources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
Expand Down
8 changes: 2 additions & 6 deletions Lunar/Data/Display.swift
Original file line number Diff line number Diff line change
Expand Up @@ -473,16 +473,12 @@ class Display: NSManagedObject {
}

var changed = false
if lockedBrightness {
setValue(brightness, forKey: "brightness")
} else if brightness != newBrightness {
if !lockedBrightness, brightness != newBrightness {
setValue(newBrightness, forKey: "brightness")
changed = true
}

if lockedContrast {
setValue(contrast, forKey: "contrast")
} else if contrast != newContrast {
if !lockedContrast, contrast != newContrast {
setValue(newContrast, forKey: "contrast")
changed = true
}
Expand Down
6 changes: 4 additions & 2 deletions Lunar/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,9 @@
<key>CFBundlePackageType</key>
<string>APPL</string>
<key>CFBundleShortVersionString</key>
<string>2.3.1</string>
<string>2.3.2</string>
<key>CFBundleVersion</key>
<string>2.3.1</string>
<string>2.3.2</string>
<key>Fabric</key>
<dict>
<key>Kits</key>
Expand Down Expand Up @@ -75,6 +75,8 @@
<string>NSApplication</string>
<key>SUFeedURL</key>
<string>https://lunarapp.site/appcast.xml</string>
<key>SUPublicDSAKeyFile</key>
<string>dsa_pub.pem</string>
<key>SUPublicEDKey</key>
<string>lqnO6tg2A9evTIFo2SC9ArZ6NS84gtBshcAWdwh12xQ=</string>
</dict>
Expand Down
36 changes: 36 additions & 0 deletions Lunar/Resources/dsa_pub.pem
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
-----BEGIN PUBLIC KEY-----
MIIGRjCCBDkGByqGSM44BAEwggQsAoICAQCpmxA66ecgzztldxWI0Zv6tnNx4hbN
kACRfWM/Qvk383T/xcYYWLaKUXaSUGqVtqko7IbXnnVPiM6TcmvaNR4ZrBosThgx
w1NT2vdSEdGEQMbtesORkUlPINEKObJt4HSWycM7RtFWQ61jXGUe8Sa4UIk27v2/
Uuz6141f69rwEOoxjdSl547R/pTD1+6kWGaKZdNtntf9fX6bs9sHuIlsv8jjjtha
rFCe98pkq4wCr3shEDhhhDW4267++p6nQJvJciVeJIMlGUIbYLYx6L6MP0LVV8yW
TZtwYVVou2sn/b1K3oD0rKfEd8+uKnnnEqa2MAiD0uEsUE4EVZ2sBuAl6QAYhd4G
3TWJXzZqXrYIBkB21YG4qgSOiFg0NpFbQAhG0hG7C3qXBuurGz8P3sXIhE8Jpa5P
wyBhzWlI8PeRPnNpTLNOpnhHAvLXySd7F9j+uhAqVvdMnlz6EoHQ8bVNzJ2VT5fy
cSHhhd0teZDjp+VN5GlS7LNvK9erXPat8C1u6NISFi/MELn+H8tsx3YCn7qzs+5T
WRf8WwMVV5GyclLofla1wJF3lM2YVI6IiAc7ALwzUvklj7Efwz1G41tsPiESbhOC
C8i696Mp17SnoHR376kMZkIe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Swsg
stJoy4s3V2ZhK+bKHkBYIyjIWOm932V1wawqhO7uS5hnNXyhrlHKTzC4mwNAlRKG
ctQz/4CHcmGpLbiXYVzN3W2yHEKqAiB6pbLfdQl8X0hphkV30Ceuihp8pa/AXrJS
9U6S8upFqQf86PPqfNFbJ52Sbp7w0TuMsiuxvI402b+DTfW4JlIWDzif5svm1jZg
/HfHDMcBqvnuiFBJJmSTG2yJ4uxJSWN7dX3KM7PDfCIQ1oA3NFqR3IGvL/RtcR3a
KNveZdJPKB5D48axCfJPUYW6PeybW5nE8p3/rc0nBj3HwaIMKofzmKYbn4gALjNo
ob8cfw2lUR3mskl99YiEUPui4K2Jc7ldgb1OFKYL9SOH3UygESnlS/PTV11xUvcO
PjFF/W4wTaPnIkjt9gXkxF/K9FDkkSpbI1U=
-----END PUBLIC KEY-----
3 changes: 3 additions & 0 deletions ReleaseNotes/2.3.2.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
## Fixes

- Don't send DDC/CI request for locked value
3 changes: 3 additions & 0 deletions Releases/Lunar-2.3.2.dmg
Git LFS file not shown
3 changes: 0 additions & 3 deletions Releases/Lunar-latest.dmg

This file was deleted.

3 changes: 3 additions & 0 deletions Releases/Lunar2.3.2-2.3.1.delta
Git LFS file not shown
16 changes: 14 additions & 2 deletions Releases/appcast.xml
Original file line number Diff line number Diff line change
@@ -1,15 +1,27 @@
<?xml version="1.0" encoding="ASCII" standalone="yes"?>
<?xml version='1.0' encoding='ASCII' standalone='yes'?>
<rss version="2.0" xmlns:sparkle="http://www.andymatuschak.org/xml-namespaces/sparkle">
<channel>
<title>Lunar</title>
<item>
<title>2.3.1</title>
<pubDate>Sat, 23 Mar 2019 14:55:46 +0200</pubDate>
<sparkle:minimumSystemVersion>10.11</sparkle:minimumSystemVersion>
<enclosure length="14406819" sparkle:dsaSignature="MEQCICH3nWJH/bG/FPB82pvdYS5j5XswjpLMT+U4s/2thg0AAiAlo0ZVt7mANxBlL3bIDdi4GjC2pLni2gNhJxFCV7PTvw==" sparkle:edSignature="xCdmaVYMkHmcehUjr7QkbwsWJmVknCr9PgzdiaEF26Lal1o8hJZc6tGR3YdHWqNH9D87K9h0ANBe/DMzOnXZBQ==" sparkle:shortVersionString="2.3.1" sparkle:version="2.3.1" type="application/octet-stream" url="https://lunarapp.site/download/2.3.1"/>
<enclosure length="14406819" sparkle:dsaSignature="MEQCICbTUij+eux3By1L3ErHdkDvmP5MFrfMIdRvogwWBxS9AiBkFGUPLA4/pAgaEy1g3WPmudcdRsTE6K1Arp1tWgDGzw==" sparkle:edSignature="xCdmaVYMkHmcehUjr7QkbwsWJmVknCr9PgzdiaEF26Lal1o8hJZc6tGR3YdHWqNH9D87K9h0ANBe/DMzOnXZBQ==" sparkle:shortVersionString="2.3.1" sparkle:version="2.3.1" type="application/octet-stream" url="https://lunarapp.site/download/2.3.1"/>
<description>
<![CDATA[<div><style>* { font-family: Menlo, monospace; color: #333333; } a { color: #1DA1F2; } a:hover { color: #0077b5; } h2#features { color: #EDB44B; } h2#improvements { color: #3E3E70; } h2#fixes { color: #E14283; }</style><div><h2 id="fixes">Fixes</h2><ul><li>Check chart entries bounds before updating</li></ul><h2 id="improvements">Improvements</h2><ul><li>Move to edDSA key for signing updates</li></ul></div></div>]]>
</description>
</item>
<item>
<title>2.3.2</title>
<pubDate>Sat, 23 Mar 2019 16:33:17 +0200</pubDate>
<sparkle:minimumSystemVersion>10.11</sparkle:minimumSystemVersion>
<enclosure length="14402892" sparkle:dsaSignature="MEQCIBwMXccsqIiz6mDiur6Cd2xqekFmuBaXMNpcaqVJrM83AiB3CxY4PBrB5WRHMeJXRRJqGC/1DvzQDoKy2sXk+lU6JQ==" sparkle:edSignature="zbzpN4NuC9QMZ/A1vKtl1Hg4CXWkgGDcB/x1NRz8oBf28GhicxnTRIl6wWEVecsm5eGOS9BuFT7C0Zc/yRyqBw==" sparkle:shortVersionString="2.3.2" sparkle:version="2.3.2" type="application/octet-stream" url="https://lunarapp.site/download/2.3.2"/>
<description>
<![CDATA[<div><style>* { font-family: Menlo, monospace; color: #333333; } a { color: #1DA1F2; } a:hover { color: #0077b5; } h2#features { color: #EDB44B; } h2#improvements { color: #3E3E70; } h2#fixes { color: #E14283; }</style><div><h2 id="fixes">Fixes</h2><ul><li>Don't send DDC/CI request for locked value</li></ul></div></div>]]>
</description>
<sparkle:deltas>
<enclosure length="77215" sparkle:deltaFrom="2.3.1" sparkle:dsaSignature="MEUCIBmw3pKQWH8RhCq4xwgLTJusmX7H9Ip7v+dl+4wV+mwKAiEAjWImJMb5iExTxP95kQZ+VhgNlGIjDg5ownsRknxkaR0=" sparkle:edSignature="k02kohsMxqqQRaq1yJEBz90rsDnt0B7yD/H2YvfBWYA3wF9VmHQpyITCwsJL5Ll7LY1py/rjpC6z/nzQLAExAw==" sparkle:shortVersionString="2.3.2" sparkle:version="2.3.2" type="application/octet-stream" url="https://lunarapp.site/delta/2.3.2/2.3.1"/>
</sparkle:deltas>
</item>
</channel>
</rss>
2 changes: 1 addition & 1 deletion pack
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ rm -rf $tmpDir/*
cp -R /private/tmp/DerivedData/Lunar-awgakuaxmexierhhqifxvodvwpri/Build/Products/Release/Lunar.app $tmpDir/Lunar.app

set -l appVersion (/usr/libexec/PlistBuddy -c "Print CFBundleShortVersionString" $tmpDir/Lunar.app/Contents/Info.plist)
set -l appLatestDmg $releaseDir/Lunar-latest.dmg
set -l appLatestDmg $releaseDir/../Lunar.dmg
set -l appDmg $releaseDir/Lunar-$appVersion.dmg
set -l appTmpDmg /tmp/Lunar-$appVersion.dmg

Expand Down
55 changes: 38 additions & 17 deletions update_appcast.py
Original file line number Diff line number Diff line change
@@ -1,19 +1,27 @@
#!/usr/bin/env python3

# pylint: disable=no-member
import re
import subprocess
import sys
from pathlib import Path

from lxml import etree, html
from lxml.builder import ElementMaker
from markdown2 import markdown_path

try:
key_path = Path(sys.argv[1])
except:
key_path = None

release_notes = Path.cwd() / "ReleaseNotes"
appcast_path = Path.cwd() / "Releases" / "appcast.xml"

parser = etree.XMLParser(strip_cdata=False)
appcast = etree.parse(str(appcast_path), parser=parser)
LUNAR_SITE = "https://lunarapp.site"
SPARKLE = "http://www.andymatuschak.org/xml-namespaces/sparkle"
SIGNER = "/usr/local/sbin/sign_update"
DELTA_PATTERN = re.compile(
r"Lunar([0-9]+\.[0-9]+\.[0-9]+)-([0-9]+\.[0-9]+\.[0-9]+).delta"
)
Expand Down Expand Up @@ -54,17 +62,29 @@ def sparkle(attr):
return f"{{{SPARKLE}}}{attr}"


def get_signature(file):
print("Signing", file)
return (
subprocess.check_output([SIGNER, file, str(key_path)])
.decode()
.replace("\n", "")
)


for item in appcast.iter("item"):
enclosure = item.find("enclosure")
description = item.find("description")

url = enclosure.attrib["url"]
version = enclosure.attrib[sparkle("version")]
enclosure.set("url", f"https://lunarapp.site/download/{version}")
enclosure.set("url", f"{LUNAR_SITE}/download/{version}")

if key_path:
dmg = appcast_path.with_name(f"Lunar-{version}.dmg")
enclosure.set(sparkle("dsaSignature"), get_signature(dmg))

release_notes_file = release_notes / f"{version}.md"
if description is None and release_notes_file.exists():

changelog = html.fromstring(
markdown_path(str(release_notes_file), extras=["header-ids"])
)
Expand All @@ -78,20 +98,21 @@ def sparkle(attr):
item.append(description)

for delta in item.findall(sparkle("deltas")):
item.remove(delta)

delta_enclosures = []
for delta in appcast_path.parent.glob(f"Lunar{version}-*.delta"):
new_version, old_version = DELTA_PATTERN.match(delta.name).groups()
enclosure = E.enclosure(
url=f"https://lunarapp.site/delta/{new_version}/{old_version}",
length=str(delta.stat().st_size),
type="application/octet-stream",
**{sparkle("version"): new_version, sparkle("deltaFrom"): old_version},
)
delta_enclosures.append(enclosure)
if delta_enclosures:
item.append(E.deltas(*delta_enclosures))
for enclosure in delta.findall("enclosure"):
new_version = enclosure.attrib[sparkle("version")]
old_version = enclosure.attrib[sparkle("deltaFrom")]
enclosure.set("url", f"{LUNAR_SITE}/delta/{new_version}/{old_version}")

if key_path:
enclosure.set(
sparkle("dsaSignature"),
get_signature(
appcast_path.with_name(
f"Lunar{new_version}-{old_version}.delta"
)
),
)


appcast.write(
str(appcast_path),
Expand Down

0 comments on commit 8649477

Please sign in to comment.