-
-
Notifications
You must be signed in to change notification settings - Fork 240
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
🎨 Optimize - 重构自定义图床:更好的配置参数、可配置的结果URL获取规则。具体可看:https://blog.svend.cc/upic/tutorials/custom/ - 在偏好设置打开时,Dock栏会显示uPic应用。主要为了方便在配置图床时在切换了应用后能快速点击Dock栏图标回到偏好设置界面 🐛 Fix Bugs - 修复使用第三方软件截图后,不能通过上传已拷贝文件的bug - 修复其他一些小问题
- Loading branch information
Showing
13 changed files
with
361 additions
and
56 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
// | ||
// FlippedView.swift | ||
// uPic | ||
// | ||
// Created by Svend Jin on 2019/7/17. | ||
// Copyright © 2019 Svend Jin. All rights reserved. | ||
// | ||
|
||
import Cocoa | ||
|
||
class FlippedView: NSView { | ||
override var isFlipped:Bool { | ||
get { | ||
return true | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
// | ||
// CustomHostUtil.swift | ||
// uPic | ||
// | ||
// Created by Svend Jin on 2019/7/17. | ||
// Copyright © 2019 Svend Jin. All rights reserved. | ||
// | ||
|
||
import Foundation | ||
import SwiftyJSON | ||
|
||
class CustomHostUtil { | ||
|
||
/** | ||
解析请求头或者body字符串 | ||
*/ | ||
public static func parseHeadersOrBodys(_ str: String) -> [Dictionary<String, String>] { | ||
var arr: [Dictionary<String, String>] = [] | ||
if let json = try? JSON(data: str.data(using: String.Encoding.utf8)!) { | ||
if let jsonArr = json.array { | ||
for jsonItem in jsonArr { | ||
arr.append(jsonItem.dictionaryObject as! [String: String]) | ||
} | ||
} | ||
} | ||
return arr | ||
} | ||
|
||
/** | ||
格式化请求头或者body为字符串 | ||
*/ | ||
public static func formatHeadersOrBodys(_ arr: [Dictionary<String, String>]) -> String { | ||
return JSON(arr).rawString() ?? "" | ||
} | ||
|
||
/** | ||
获取json结果中的url | ||
*/ | ||
public static func parseResultUrl(_ json: JSON, _ resultPath: String) -> String { | ||
var retUrl = "" | ||
var retJson = json | ||
|
||
if !resultPath.isEmpty { | ||
if let pathJSON = try? JSON(data: resultPath.data(using: String.Encoding.utf8)!) { | ||
if let pathArr = pathJSON.arrayObject { | ||
var path: [JSONSubscriptType] = [] | ||
for p in pathArr { | ||
if (p is Int) { | ||
path.append(p as! Int) | ||
} else if (p is String) { | ||
path.append(p as! String) | ||
} | ||
} | ||
retUrl = retJson[path].rawString() ?? "" | ||
} | ||
} | ||
} | ||
|
||
return retUrl | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.