From 1e7174f3a75dd644a56dd0544c1f635e8e229b82 Mon Sep 17 00:00:00 2001 From: Svend Date: Thu, 23 Jul 2020 15:47:41 +0800 Subject: [PATCH 1/5] update README --- README-cn.md | 4 ++-- README.md | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/README-cn.md b/README-cn.md index e553da8..56f2132 100644 --- a/README-cn.md +++ b/README-cn.md @@ -11,14 +11,14 @@ [![Travis Build Status](https://img.shields.io/travis/gee1k/uPic.svg?style=flat-square&logo=Travis)](https://travis-ci.org/gee1k/uPic) [![GitHub release](https://img.shields.io/github/release/gee1k/uPic?label=version&style=flat-square&logo=GitHub)](https://github.com/gee1k/uPic/releases/latest) [![Downloads](https://img.shields.io/github/downloads/gee1k/uPic/total.svg?style=flat-square)](https://github.com/gee1k/uPic/releases) [![MIT](https://img.shields.io/github/license/gee1k/uPic?style=flat-square)](https://github.com/gee1k/uPic/blob/master/LICENSE) -[![Donate on PayPal](https://img.shields.io/badge/support-PayPal-blue?style=flat-square&logo=PayPal)](https://paypal.me/geeee1k) [![Chat on Telegram](https://img.shields.io/badge/chat-Telegram-blueviolet?style=flat-square&logo=Telegram)](https://t.me/upic_host) [![Follow My Twitter](https://img.shields.io/badge/follow-Tweet-blue?style=flat-square&logo=Twitter)](https://twitter.com/geee1k) [![Follow My Twitter](https://img.shields.io/badge/follow-Weibo-red?style=flat-square&logo=sina-weibo)](https://weibo.com/6436660358) +[![Donate on PayPal](https://img.shields.io/badge/support-PayPal-blue?style=flat-square&logo=PayPal)](https://paypal.me/geeee1k) [![Chat on Telegram](https://img.shields.io/badge/chat-Telegram-blueviolet?style=flat-square&logo=Telegram)](https://t.me/upic_host) [![Follow My Twitter](https://img.shields.io/badge/follow-Tweet-blue?style=flat-square&logo=Twitter)](https://twitter.com/realSvend) [![Follow My Twitter](https://img.shields.io/badge/follow-Weibo-red?style=flat-square&logo=sina-weibo)](https://weibo.com/6436660358)

----- -**👬联系: _[Telegram](https://t.me/upic_host), [Twitter](https://twitter.com/geee1k), [微博](https://weibo.com/6436660358), [微信群](https://raw.githubusercontent.com/gee1k/oss/master/personal/geee1k.JPG)_** +**👬联系: _[Telegram](https://t.me/upic_host), [Twitter](https://twitter.com/realSvend), [微博](https://weibo.com/6436660358), [微信群](https://raw.githubusercontent.com/gee1k/oss/master/personal/geee1k.JPG)_** **☕️赞助: _[Paypal](https://paypal.me/geeee1k), [支付宝](https://raw.githubusercontent.com/gee1k/oss/master/qrcode/alipay.JPG), [微信支付](https://raw.githubusercontent.com/gee1k/oss/master/qrcode/wechat_pay.JPG)_** diff --git a/README.md b/README.md index f715f35..062a474 100644 --- a/README.md +++ b/README.md @@ -11,14 +11,14 @@ [![Travis Build Status](https://img.shields.io/travis/gee1k/uPic.svg?style=flat-square&logo=Travis)](https://travis-ci.org/gee1k/uPic) [![GitHub release](https://img.shields.io/github/release/gee1k/uPic?label=version&style=flat-square&logo=GitHub)](https://github.com/gee1k/uPic/releases/latest) [![Downloads](https://img.shields.io/github/downloads/gee1k/uPic/total.svg?style=flat-square)](https://github.com/gee1k/uPic/releases) [![MIT](https://img.shields.io/github/license/gee1k/uPic?style=flat-square)](https://github.com/gee1k/uPic/blob/master/LICENSE) -[![Donate on PayPal](https://img.shields.io/badge/support-PayPal-blue?style=flat-square&logo=PayPal)](https://paypal.me/geeee1k) [![Chat on Telegram](https://img.shields.io/badge/chat-Telegram-blueviolet?style=flat-square&logo=Telegram)](https://t.me/upic_host) [![Follow My Twitter](https://img.shields.io/badge/follow-Tweet-blue?style=flat-square&logo=Twitter)](https://twitter.com/geee1k) [![Follow My Twitter](https://img.shields.io/badge/follow-Weibo-red?style=flat-square&logo=sina-weibo)](https://weibo.com/6436660358) +[![Donate on PayPal](https://img.shields.io/badge/support-PayPal-blue?style=flat-square&logo=PayPal)](https://paypal.me/geeee1k) [![Chat on Telegram](https://img.shields.io/badge/chat-Telegram-blueviolet?style=flat-square&logo=Telegram)](https://t.me/upic_host) [![Follow My Twitter](https://img.shields.io/badge/follow-Tweet-blue?style=flat-square&logo=Twitter)](https://twitter.com/realSvend) [![Follow My Twitter](https://img.shields.io/badge/follow-Weibo-red?style=flat-square&logo=sina-weibo)](https://weibo.com/6436660358)

----- -**👬Chat: _[Telegram](https://t.me/upic_host), [Twitter](https://twitter.com/geee1k), [Weibo](https://weibo.com/6436660358), [Wechat Group](https://raw.githubusercontent.com/gee1k/oss/master/personal/geee1k.JPG)_** +**👬Chat: _[Telegram](https://t.me/upic_host), [Twitter](https://twitter.com/realSvend), [Weibo](https://weibo.com/6436660358), [Wechat Group](https://raw.githubusercontent.com/gee1k/oss/master/personal/geee1k.JPG)_** **☕️Donate: _[Paypal](https://paypal.me/geeee1k), [Alipay](https://raw.githubusercontent.com/gee1k/oss/master/qrcode/alipay.JPG), [WechatPay](https://raw.githubusercontent.com/gee1k/oss/master/qrcode/wechat_pay.JPG)_** From 16c5f2e8d3635a167cc579e69b720e5b02fc8874 Mon Sep 17 00:00:00 2001 From: Licardo <1014660822@qq.com> Date: Mon, 27 Jul 2020 11:17:45 +0800 Subject: [PATCH 2/5] add Output format URL Encode function --- Podfile.lock | 28 ++-- uPic.xcodeproj/project.pbxproj | 12 +- .../xcshareddata/xcschemes/uPic.xcscheme | 2 +- uPic/Base.lproj/Main.storyboard | 34 ++++- uPic/General/Managers/ConfigManager.swift | 6 +- uPic/General/Utils/PreferenceKey.swift | 15 ++- uPic/Models/OutputType.swift | 17 ++- .../Base.lproj/Preferences.storyboard | 126 +++++++++--------- uPic/Views/StatusMenuController.swift | 47 ++++++- uPic/en.lproj/Localizable.strings | 3 + uPic/en.lproj/Main.strings | 12 ++ uPic/zh-Hans.lproj/Localizable.strings | 3 + uPic/zh-Hans.lproj/Main.strings | 12 ++ uPic/zh-Hant.lproj/Localizable.strings | 3 + uPic/zh-Hant.lproj/Main.strings | 13 ++ 15 files changed, 221 insertions(+), 112 deletions(-) diff --git a/Podfile.lock b/Podfile.lock index e29a4b6..467c1bc 100644 --- a/Podfile.lock +++ b/Podfile.lock @@ -1,11 +1,11 @@ PODS: - - Alamofire (5.0.2) - - CryptoSwift (1.3.0) - - Kingfisher (5.13.2): - - Kingfisher/Core (= 5.13.2) - - Kingfisher/Core (5.13.2) + - Alamofire (5.0.5) + - CryptoSwift (1.3.1) + - Kingfisher (5.14.1): + - Kingfisher/Core (= 5.14.1) + - Kingfisher/Core (5.14.1) - libminipng (0.5.6) - - LoginServiceKit (2.1.0) + - LoginServiceKit (2.2.0) - MASShortcut (2.4.0) - SnapKit (5.0.1) - Sparkle (1.23.0) @@ -55,21 +55,21 @@ EXTERNAL SOURCES: CHECKOUT OPTIONS: CryptoSwift: - :commit: a842251aee9047b2b335afe0ae0b5b44daf95219 + :commit: e793a595747c8f9b97b8de4ebde7b2a440f2d594 :git: https://github.com/krzyzanowskim/CryptoSwift LoginServiceKit: - :commit: be0b910d825f826d3c64d6ff1207209ec7dea0fa + :commit: 17a916dc09f1aab0f13e6edd1f77cdecee4d0ae8 :git: https://github.com/Clipy/LoginServiceKit.git SwiftyXMLParser: - :commit: bc85162ecee60d6eb94b778648bc4c51e1c4d34f + :commit: 9d82653e535a13a518b411934c0a5c0c84406c22 :git: https://github.com/yahoojapan/SwiftyXMLParser.git SPEC CHECKSUMS: - Alamofire: 3ba7a4db18b4f62c4a1c0e1cb39d7f3d52e10ada - CryptoSwift: 1283821600233bdbeb96d7b389c3288c3bf77211 - Kingfisher: d342c8354c10c3d85a27d6d4c42c41285924b898 + Alamofire: df2f8f826963b08b9a870791ad48e07a10090b2e + CryptoSwift: 27c1f79acf3410c697981c2443076ad0880a62b4 + Kingfisher: 8050bc6f7f68cbf3908bd04df7ccbac188f6d6d6 libminipng: a44c35d06b9d54d6640acdf97f4500c034748abb - LoginServiceKit: 9a8b258c3111fa0d9585615052f778b08be92302 + LoginServiceKit: 3c86ce2f2bcd1e373326839d6d863d8a6a5915b4 MASShortcut: d9e4909e878661cc42877cc9d6efbe638273ab57 SnapKit: 97b92857e3df3a0c71833cce143274bf6ef8e5eb Sparkle: 55b1a87ba69d56913375a281546b7c82dec95bb0 @@ -81,4 +81,4 @@ SPEC CHECKSUMS: PODFILE CHECKSUM: 4101e450e6b2d21bac70b5245d209294f573f3bb -COCOAPODS: 1.9.1 +COCOAPODS: 1.9.3 diff --git a/uPic.xcodeproj/project.pbxproj b/uPic.xcodeproj/project.pbxproj index 11ef212..d8b3367 100644 --- a/uPic.xcodeproj/project.pbxproj +++ b/uPic.xcodeproj/project.pbxproj @@ -323,7 +323,7 @@ 68BBB2F5FAEEFFF55935F022 /* AmazonS3Util.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = AmazonS3Util.swift; sourceTree = ""; }; 68BBB5C4550545707614BE4D /* AmazonS3Uploader.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = AmazonS3Uploader.swift; sourceTree = ""; }; 68BBB8CF2838A67CA1AD438F /* AmazonS3HostConfig.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = AmazonS3HostConfig.swift; sourceTree = ""; }; - 9667517C240D2BA6007C7012 /* en */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = en; path = en.lproj/Main.strings; sourceTree = ""; }; + 96319C6E24CE7CEB004A6E62 /* en */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = en; path = en.lproj/Main.strings; sourceTree = ""; }; 968ECC08240DFCF900B2D78C /* en */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = en; path = en.lproj/InfoPlist.strings; sourceTree = ""; }; 968ECC0A240DFCFA00B2D78C /* zh-Hans */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = "zh-Hans"; path = "zh-Hans.lproj/InfoPlist.strings"; sourceTree = ""; }; 969018A3240D998400B545B2 /* en */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = en; path = en.lproj/Preferences.strings; sourceTree = ""; }; @@ -1102,8 +1102,8 @@ children = ( 1648A215238E742600B99B9D /* Base */, 1648A218238E743200B99B9D /* zh-Hans */, - 9667517C240D2BA6007C7012 /* en */, 1605DDD8246D993C00262C89 /* zh-Hant */, + 96319C6E24CE7CEB004A6E62 /* en */, ); name = Main.storyboard; sourceTree = ""; @@ -1261,7 +1261,7 @@ CODE_SIGN_STYLE = Automatic; COMBINE_HIDPI_IMAGES = YES; CURRENT_PROJECT_VERSION = 20200723; - DEVELOPMENT_TEAM = W863J6W8DZ; + DEVELOPMENT_TEAM = 2U23P5CPX2; ENABLE_HARDENED_RUNTIME = YES; INFOPLIST_FILE = "$(SRCROOT)/uPic/Supporting Files/Info.plist"; LD_RUNPATH_SEARCH_PATHS = ( @@ -1291,7 +1291,7 @@ CODE_SIGN_STYLE = Automatic; COMBINE_HIDPI_IMAGES = YES; CURRENT_PROJECT_VERSION = 20200723; - DEVELOPMENT_TEAM = W863J6W8DZ; + DEVELOPMENT_TEAM = 2U23P5CPX2; ENABLE_HARDENED_RUNTIME = YES; INFOPLIST_FILE = "$(SRCROOT)/uPic/Supporting Files/Info.plist"; LD_RUNPATH_SEARCH_PATHS = ( @@ -1317,7 +1317,7 @@ CODE_SIGN_STYLE = Automatic; COMBINE_HIDPI_IMAGES = YES; CURRENT_PROJECT_VERSION = 20200723; - DEVELOPMENT_TEAM = W863J6W8DZ; + DEVELOPMENT_TEAM = 2U23P5CPX2; ENABLE_HARDENED_RUNTIME = YES; INFOPLIST_FILE = uPicFinderExtension/Info.plist; LD_RUNPATH_SEARCH_PATHS = ( @@ -1344,7 +1344,7 @@ CODE_SIGN_STYLE = Automatic; COMBINE_HIDPI_IMAGES = YES; CURRENT_PROJECT_VERSION = 20200723; - DEVELOPMENT_TEAM = W863J6W8DZ; + DEVELOPMENT_TEAM = 2U23P5CPX2; ENABLE_HARDENED_RUNTIME = YES; INFOPLIST_FILE = uPicFinderExtension/Info.plist; LD_RUNPATH_SEARCH_PATHS = ( diff --git a/uPic.xcodeproj/xcshareddata/xcschemes/uPic.xcscheme b/uPic.xcodeproj/xcshareddata/xcschemes/uPic.xcscheme index 2083a7f..dbf5952 100644 --- a/uPic.xcodeproj/xcshareddata/xcschemes/uPic.xcscheme +++ b/uPic.xcodeproj/xcshareddata/xcschemes/uPic.xcscheme @@ -1,6 +1,6 @@ - + - + @@ -105,7 +105,8 @@ - + + @@ -151,25 +152,44 @@ - + - + - + - + + + + + + + + + + + + + + + + + + + + diff --git a/uPic/General/Managers/ConfigManager.swift b/uPic/General/Managers/ConfigManager.swift index 171b6cd..1327e08 100644 --- a/uPic/General/Managers/ConfigManager.swift +++ b/uPic/General/Managers/ConfigManager.swift @@ -88,15 +88,15 @@ extension ConfigManager { extension ConfigManager { func getOutputType() -> OutputType { - return OutputType(value: Defaults[.ouputFormat]) + OutputType(value: Defaults[.outputFormat]) } func setOutputType(_ outputType: OutputType) { - Defaults[.ouputFormat] = outputType.rawValue + Defaults[.outputFormat] = outputType.rawValue } func setOutputType(_ outputTypeRawValue: Int) { - Defaults[.ouputFormat] = outputTypeRawValue + Defaults[.outputFormat] = outputTypeRawValue } } diff --git a/uPic/General/Utils/PreferenceKey.swift b/uPic/General/Utils/PreferenceKey.swift index 5765f13..b1f80d4 100644 --- a/uPic/General/Utils/PreferenceKey.swift +++ b/uPic/General/Utils/PreferenceKey.swift @@ -12,7 +12,8 @@ struct Keys { static let firstUsage = "uPic_FirstUsage" static let hostItems = "uPic_hostItems" static let defaultHostId = "uPic_DefaultHostId" - static let ouputFormat = "uPic_OutputFormat" + static let outputFormat = "uPic_OutputFormat" + static let outputFormatEncoded = "uPic_OutputFormatEncoded" static let historyList = "uPic_HistoryList_New" static let historyLimit = "uPic_HistoryLimit_New" static let compressFactor = "uPic_CompressFactor" @@ -48,7 +49,8 @@ extension DefaultsKeys { static let firstUsage = DefaultsKey(Keys.firstUsage) static let hostItems = DefaultsKey<[Host]>(Keys.hostItems) static let defaultHostId = DefaultsKey(Keys.defaultHostId) - static let ouputFormat = DefaultsKey(Keys.ouputFormat) + static let outputFormat = DefaultsKey(Keys.outputFormat) + static let outputFormatEncoded = DefaultsKey(Keys.outputFormatEncoded) static let historyList = DefaultsKey<[[String: Any]]>(Keys.historyList) static let historyLimit = DefaultsKey(Keys.historyLimit) static let compressFactor = DefaultsKey(Keys.compressFactor) @@ -64,6 +66,15 @@ extension DefaultsKeys { let Defaults = UserDefaults.standard extension UserDefaults { + subscript(key: DefaultsKey) -> Bool? { + get { + bool(forKey: key._key) + } + set { + set(newValue, forKey: key._key) + } + } + subscript(key: DefaultsKey) -> String? { get { return string(forKey: key._key) diff --git a/uPic/Models/OutputType.swift b/uPic/Models/OutputType.swift index 6497579..3782cbc 100644 --- a/uPic/Models/OutputType.swift +++ b/uPic/Models/OutputType.swift @@ -47,28 +47,27 @@ enum OutputType: Int { } func formatUrl(_ url: String) -> String { - let url = url.urlDecoded() + var formatUrl = url + if Defaults[.outputFormatEncoded]! { + formatUrl = url.urlEncoded() + } var filename = url.lastPathComponent.deletingPathExtension.trim() let tempArr = filename.components(separatedBy: .whitespaces).map{ $0.trim() }.filter{ !$0.isEmpty } filename = tempArr.joined(separator: "") - - let encodedUrl = url.urlOutputEncoded() var outputUrl = "" switch self { case .html: - outputUrl = "\(filename)" + outputUrl = "\(filename)" break case .markdown: - outputUrl = "![\(filename)](\(encodedUrl))" + outputUrl = "![\(filename)](\(formatUrl))" break case .ubb: - outputUrl = "[img]\(encodedUrl)[/img]" + outputUrl = "[img]\(formatUrl)[/img]" break default: - outputUrl = encodedUrl - + outputUrl = formatUrl } - return outputUrl } } diff --git a/uPic/PreferencesWindow/Base.lproj/Preferences.storyboard b/uPic/PreferencesWindow/Base.lproj/Preferences.storyboard index 7266461..c0f12d8 100644 --- a/uPic/PreferencesWindow/Base.lproj/Preferences.storyboard +++ b/uPic/PreferencesWindow/Base.lproj/Preferences.storyboard @@ -1,8 +1,8 @@ - + - + @@ -69,17 +69,17 @@ - + @@ -87,13 +87,13 @@ - + - + - + @@ -101,7 +101,7 @@ - + @@ -115,7 +115,7 @@ - + @@ -185,10 +185,10 @@ - + - + @@ -196,7 +196,7 @@ - + @@ -223,7 +223,7 @@ - + @@ -250,7 +250,7 @@ - + @@ -277,7 +277,7 @@ - + @@ -285,7 +285,7 @@ - + @@ -364,7 +364,7 @@ - + @@ -443,7 +443,7 @@ - + @@ -476,7 +476,7 @@ - + @@ -509,23 +509,23 @@ - + - + Supports {year} {month} {day} {hour} {minute} {second} {since_second} {since_millisecond} {random} {filename} {.suffix} {suffix} {mimetype} {saveKey} and etc. @@ -1248,7 +1248,7 @@ Gw - + @@ -1263,7 +1263,7 @@ Gw - + @@ -1277,7 +1277,7 @@ Gw - +