Skip to content

Commit

Permalink
fix: feedback token injected during ci
Browse files Browse the repository at this point in the history
Github expires token in source code so we have to hide it away in CI (for now)
  • Loading branch information
louis.pontoise authored and lwouis committed Mar 10, 2020
1 parent debd3ae commit effdc5f
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 5 deletions.
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ script:
- npm ci
- npx commitlint-travis
- if [ $IS_RELEASE ]; then scripts/determine_version_and_changelog.sh; fi
- if [ $IS_RELEASE ]; then scripts/set_version_in_app.sh; fi
- if [ $IS_RELEASE ]; then scripts/replace_environment_variables_in_app.sh; fi
- pod install
- scripts/import_codesign_certificate_into_keychain.sh
- xcodebuild -workspace alt-tab-macos.xcworkspace -scheme Release
Expand Down
2 changes: 2 additions & 0 deletions Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -38,5 +38,7 @@
<string>true</string>
<key>SUPublicEDKey</key>
<string>2e9SQOBoaKElchSa/4QDli/nvYkyuDNfynfzBF6vJK4=</string>
<key>FeedbackToken</key>
<string>#FEEDBACK_TOKEN#</string>
</dict>
</plist>
4 changes: 2 additions & 2 deletions alt-tab-macos.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@
D04BAC159731F80FDAF4EA6C /* 1-row.jpg */ = {isa = PBXFileReference; lastKnownFileType = image.jpeg; path = "1-row.jpg"; sourceTree = "<group>"; };
D04BAC2FEF7248B7BF9579E2 /* CollectionViewFlowLayout.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = CollectionViewFlowLayout.swift; sourceTree = "<group>"; };
D04BAC34CFD42A7F6F1F01C0 /* CGWindow.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = CGWindow.swift; sourceTree = "<group>"; };
D04BAC6AFC7F06D1A567F27A /* set_version_in_app.sh */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.script.sh; path = set_version_in_app.sh; sourceTree = "<group>"; };
D04BAC6AFC7F06D1A567F27A /* replace_environment_variables_in_app.sh */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.script.sh; path = replace_environment_variables_in_app.sh; sourceTree = "<group>"; };
D04BACABD048E62EBE4576CC /* DebugProfile.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = DebugProfile.swift; sourceTree = "<group>"; };
D04BACD976030676FD0761D5 /* Windows.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Windows.swift; sourceTree = "<group>"; };
D04BACE22DC907F03D193075 /* ShortcutsTab.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ShortcutsTab.swift; sourceTree = "<group>"; };
Expand Down Expand Up @@ -396,7 +396,7 @@
children = (
D04BA7ECCE728582D9ECA613 /* determine_version_and_changelog.sh */,
D04BA4B5292629AA6B560216 /* package_and_notarize_release.sh */,
D04BAC6AFC7F06D1A567F27A /* set_version_in_app.sh */,
D04BAC6AFC7F06D1A567F27A /* replace_environment_variables_in_app.sh */,
D04BAE93A5854C501639C640 /* update_homebrew_cask.sh */,
D04BA5E819181CB83C5602C7 /* generate_selfsigned_codesign_certificate.sh */,
D04BA0AAAE82C72855DBBA26 /* update_appcast.sh */,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,6 @@
set -exu

version="$(cat $VERSION_FILE)"
# set the version in the app meta-data for the AppStore and app "Get Info" panel

sed -i '' -e "s/#VERSION#/$version/" Info.plist
sed -i '' -e "s/#FEEDBACK_TOKEN#/$FEEDBACK_TOKEN/" Info.plist
3 changes: 2 additions & 1 deletion src/ui/FeedbackWindow.swift
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import Cocoa

class FeedbackWindow: NSWindow {
static let token = Bundle.main.object(forInfoDictionaryKey: "FeedbackToken") as! String
var body: TextArea!
var email: TextArea!
var sendButton: NSButton!
Expand Down Expand Up @@ -83,7 +84,7 @@ class FeedbackWindow: NSWindow {
request.addValue("application/json", forHTTPHeaderField: "Content-Type")
request.addValue("application/json", forHTTPHeaderField: "Accept")
// access token of the alt-tab-macos-bot github account, with scope repo > public_repo
request.addValue("token 231413d7bf0e6cc533aae851c83dca25afed86bb", forHTTPHeaderField: "Authorization")
request.addValue("token " + FeedbackWindow.token, forHTTPHeaderField: "Authorization")
request.httpBody = try! JSONSerialization.data(withJSONObject: [
"title": "[In-app feedback]",
"body": assembleBody()
Expand Down

0 comments on commit effdc5f

Please sign in to comment.