Use HTMLStreamer instead of SwiftSoup
This commit is contained in:
parent
a812afee4e
commit
9dd449fe1a
|
@ -13,15 +13,15 @@
|
||||||
D626E6CF28724259000E1AF5 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = D626E6CE28724259000E1AF5 /* Assets.xcassets */; };
|
D626E6CF28724259000E1AF5 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = D626E6CE28724259000E1AF5 /* Assets.xcassets */; };
|
||||||
D626E6D228724259000E1AF5 /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = D626E6D028724259000E1AF5 /* LaunchScreen.storyboard */; };
|
D626E6D228724259000E1AF5 /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = D626E6D028724259000E1AF5 /* LaunchScreen.storyboard */; };
|
||||||
D626E6D8287242F0000E1AF5 /* MastoSearchCore in Frameworks */ = {isa = PBXBuildFile; productRef = D626E6D7287242F0000E1AF5 /* MastoSearchCore */; };
|
D626E6D8287242F0000E1AF5 /* MastoSearchCore in Frameworks */ = {isa = PBXBuildFile; productRef = D626E6D7287242F0000E1AF5 /* MastoSearchCore */; };
|
||||||
D626E6DA287242F2000E1AF5 /* SwiftSoup in Frameworks */ = {isa = PBXBuildFile; productRef = D626E6D9287242F2000E1AF5 /* SwiftSoup */; };
|
|
||||||
D626E6DC28724610000E1AF5 /* StatusTableRowCollectionViewCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = D626E6DB28724610000E1AF5 /* StatusTableRowCollectionViewCell.swift */; };
|
D626E6DC28724610000E1AF5 /* StatusTableRowCollectionViewCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = D626E6DB28724610000E1AF5 /* StatusTableRowCollectionViewCell.swift */; };
|
||||||
D626E6DE28724D4C000E1AF5 /* StatusTableHeaderView.swift in Sources */ = {isa = PBXBuildFile; fileRef = D626E6DD28724D4C000E1AF5 /* StatusTableHeaderView.swift */; };
|
D626E6DE28724D4C000E1AF5 /* StatusTableHeaderView.swift in Sources */ = {isa = PBXBuildFile; fileRef = D626E6DD28724D4C000E1AF5 /* StatusTableHeaderView.swift */; };
|
||||||
D626E6E028725940000E1AF5 /* UIColor+App.swift in Sources */ = {isa = PBXBuildFile; fileRef = D626E6DF28725940000E1AF5 /* UIColor+App.swift */; };
|
D626E6E028725940000E1AF5 /* UIColor+App.swift in Sources */ = {isa = PBXBuildFile; fileRef = D626E6DF28725940000E1AF5 /* UIColor+App.swift */; };
|
||||||
D6451241276981A40046CCD2 /* WindowController.swift in Sources */ = {isa = PBXBuildFile; fileRef = D6451240276981A40046CCD2 /* WindowController.swift */; };
|
D6451241276981A40046CCD2 /* WindowController.swift in Sources */ = {isa = PBXBuildFile; fileRef = D6451240276981A40046CCD2 /* WindowController.swift */; };
|
||||||
|
D650FB972C874E73001453CD /* HTMLStreamer in Frameworks */ = {isa = PBXBuildFile; productRef = D650FB962C874E73001453CD /* HTMLStreamer */; };
|
||||||
|
D650FB992C874F14001453CD /* HTMLStreamer in Frameworks */ = {isa = PBXBuildFile; productRef = D650FB982C874F14001453CD /* HTMLStreamer */; };
|
||||||
D6559A5228721BAF000EEB4D /* MastoSearchCore in Frameworks */ = {isa = PBXBuildFile; productRef = D6559A5128721BAF000EEB4D /* MastoSearchCore */; };
|
D6559A5228721BAF000EEB4D /* MastoSearchCore in Frameworks */ = {isa = PBXBuildFile; productRef = D6559A5128721BAF000EEB4D /* MastoSearchCore */; };
|
||||||
D669039E2769236F00819C4D /* ViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = D669039C2769236F00819C4D /* ViewController.swift */; };
|
D669039E2769236F00819C4D /* ViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = D669039C2769236F00819C4D /* ViewController.swift */; };
|
||||||
D66903BE2769250B00819C4D /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = D66903BD2769250B00819C4D /* Main.storyboard */; };
|
D66903BE2769250B00819C4D /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = D66903BD2769250B00819C4D /* Main.storyboard */; };
|
||||||
D66903C127692EAB00819C4D /* SwiftSoup in Frameworks */ = {isa = PBXBuildFile; productRef = D66903C027692EAB00819C4D /* SwiftSoup */; };
|
|
||||||
D6A4B8B027C2B1770016F458 /* MastoSearchTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = D6A4B8AF27C2B1770016F458 /* MastoSearchTests.swift */; };
|
D6A4B8B027C2B1770016F458 /* MastoSearchTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = D6A4B8AF27C2B1770016F458 /* MastoSearchTests.swift */; };
|
||||||
D6A4B8B727C2B18C0016F458 /* ImportControllerTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = D6A4B8B627C2B18C0016F458 /* ImportControllerTests.swift */; };
|
D6A4B8B727C2B18C0016F458 /* ImportControllerTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = D6A4B8B627C2B18C0016F458 /* ImportControllerTests.swift */; };
|
||||||
D6B24DE927640CE100BA23B8 /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = D6B24DE827640CE100BA23B8 /* AppDelegate.swift */; };
|
D6B24DE927640CE100BA23B8 /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = D6B24DE827640CE100BA23B8 /* AppDelegate.swift */; };
|
||||||
|
@ -68,7 +68,7 @@
|
||||||
buildActionMask = 2147483647;
|
buildActionMask = 2147483647;
|
||||||
files = (
|
files = (
|
||||||
D626E6D8287242F0000E1AF5 /* MastoSearchCore in Frameworks */,
|
D626E6D8287242F0000E1AF5 /* MastoSearchCore in Frameworks */,
|
||||||
D626E6DA287242F2000E1AF5 /* SwiftSoup in Frameworks */,
|
D650FB992C874F14001453CD /* HTMLStreamer in Frameworks */,
|
||||||
);
|
);
|
||||||
runOnlyForDeploymentPostprocessing = 0;
|
runOnlyForDeploymentPostprocessing = 0;
|
||||||
};
|
};
|
||||||
|
@ -83,7 +83,7 @@
|
||||||
isa = PBXFrameworksBuildPhase;
|
isa = PBXFrameworksBuildPhase;
|
||||||
buildActionMask = 2147483647;
|
buildActionMask = 2147483647;
|
||||||
files = (
|
files = (
|
||||||
D66903C127692EAB00819C4D /* SwiftSoup in Frameworks */,
|
D650FB972C874E73001453CD /* HTMLStreamer in Frameworks */,
|
||||||
D6559A5228721BAF000EEB4D /* MastoSearchCore in Frameworks */,
|
D6559A5228721BAF000EEB4D /* MastoSearchCore in Frameworks */,
|
||||||
);
|
);
|
||||||
runOnlyForDeploymentPostprocessing = 0;
|
runOnlyForDeploymentPostprocessing = 0;
|
||||||
|
@ -176,7 +176,7 @@
|
||||||
name = MastoSearchMobile;
|
name = MastoSearchMobile;
|
||||||
packageProductDependencies = (
|
packageProductDependencies = (
|
||||||
D626E6D7287242F0000E1AF5 /* MastoSearchCore */,
|
D626E6D7287242F0000E1AF5 /* MastoSearchCore */,
|
||||||
D626E6D9287242F2000E1AF5 /* SwiftSoup */,
|
D650FB982C874F14001453CD /* HTMLStreamer */,
|
||||||
);
|
);
|
||||||
productName = MastoSearchMobile;
|
productName = MastoSearchMobile;
|
||||||
productReference = D626E6C328724258000E1AF5 /* MastoSearchMobile.app */;
|
productReference = D626E6C328724258000E1AF5 /* MastoSearchMobile.app */;
|
||||||
|
@ -214,8 +214,8 @@
|
||||||
);
|
);
|
||||||
name = MastoSearch;
|
name = MastoSearch;
|
||||||
packageProductDependencies = (
|
packageProductDependencies = (
|
||||||
D66903C027692EAB00819C4D /* SwiftSoup */,
|
|
||||||
D6559A5128721BAF000EEB4D /* MastoSearchCore */,
|
D6559A5128721BAF000EEB4D /* MastoSearchCore */,
|
||||||
|
D650FB962C874E73001453CD /* HTMLStreamer */,
|
||||||
);
|
);
|
||||||
productName = MastoSearch;
|
productName = MastoSearch;
|
||||||
productReference = D6B24DE527640CE100BA23B8 /* MastoSearch.app */;
|
productReference = D6B24DE527640CE100BA23B8 /* MastoSearch.app */;
|
||||||
|
@ -254,7 +254,7 @@
|
||||||
mainGroup = D6B24DDC27640CE100BA23B8;
|
mainGroup = D6B24DDC27640CE100BA23B8;
|
||||||
packageReferences = (
|
packageReferences = (
|
||||||
D6B24DF527640D2600BA23B8 /* XCRemoteSwiftPackageReference "fmdb" */,
|
D6B24DF527640D2600BA23B8 /* XCRemoteSwiftPackageReference "fmdb" */,
|
||||||
D66903BF27692EAB00819C4D /* XCRemoteSwiftPackageReference "SwiftSoup" */,
|
D650FB952C874E73001453CD /* XCRemoteSwiftPackageReference "HTMLStreamer" */,
|
||||||
);
|
);
|
||||||
productRefGroup = D6B24DE627640CE100BA23B8 /* Products */;
|
productRefGroup = D6B24DE627640CE100BA23B8 /* Products */;
|
||||||
projectDirPath = "";
|
projectDirPath = "";
|
||||||
|
@ -668,12 +668,12 @@
|
||||||
/* End XCConfigurationList section */
|
/* End XCConfigurationList section */
|
||||||
|
|
||||||
/* Begin XCRemoteSwiftPackageReference section */
|
/* Begin XCRemoteSwiftPackageReference section */
|
||||||
D66903BF27692EAB00819C4D /* XCRemoteSwiftPackageReference "SwiftSoup" */ = {
|
D650FB952C874E73001453CD /* XCRemoteSwiftPackageReference "HTMLStreamer" */ = {
|
||||||
isa = XCRemoteSwiftPackageReference;
|
isa = XCRemoteSwiftPackageReference;
|
||||||
repositoryURL = "https://github.com/scinfu/SwiftSoup";
|
repositoryURL = "https://git.shadowfacts.net/shadowfacts/HTMLStreamer.git";
|
||||||
requirement = {
|
requirement = {
|
||||||
kind = upToNextMinorVersion;
|
kind = exactVersion;
|
||||||
minimumVersion = 2.3.4;
|
version = 0.3.0;
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
D6B24DF527640D2600BA23B8 /* XCRemoteSwiftPackageReference "fmdb" */ = {
|
D6B24DF527640D2600BA23B8 /* XCRemoteSwiftPackageReference "fmdb" */ = {
|
||||||
|
@ -691,20 +691,20 @@
|
||||||
isa = XCSwiftPackageProductDependency;
|
isa = XCSwiftPackageProductDependency;
|
||||||
productName = MastoSearchCore;
|
productName = MastoSearchCore;
|
||||||
};
|
};
|
||||||
D626E6D9287242F2000E1AF5 /* SwiftSoup */ = {
|
D650FB962C874E73001453CD /* HTMLStreamer */ = {
|
||||||
isa = XCSwiftPackageProductDependency;
|
isa = XCSwiftPackageProductDependency;
|
||||||
package = D66903BF27692EAB00819C4D /* XCRemoteSwiftPackageReference "SwiftSoup" */;
|
package = D650FB952C874E73001453CD /* XCRemoteSwiftPackageReference "HTMLStreamer" */;
|
||||||
productName = SwiftSoup;
|
productName = HTMLStreamer;
|
||||||
|
};
|
||||||
|
D650FB982C874F14001453CD /* HTMLStreamer */ = {
|
||||||
|
isa = XCSwiftPackageProductDependency;
|
||||||
|
package = D650FB952C874E73001453CD /* XCRemoteSwiftPackageReference "HTMLStreamer" */;
|
||||||
|
productName = HTMLStreamer;
|
||||||
};
|
};
|
||||||
D6559A5128721BAF000EEB4D /* MastoSearchCore */ = {
|
D6559A5128721BAF000EEB4D /* MastoSearchCore */ = {
|
||||||
isa = XCSwiftPackageProductDependency;
|
isa = XCSwiftPackageProductDependency;
|
||||||
productName = MastoSearchCore;
|
productName = MastoSearchCore;
|
||||||
};
|
};
|
||||||
D66903C027692EAB00819C4D /* SwiftSoup */ = {
|
|
||||||
isa = XCSwiftPackageProductDependency;
|
|
||||||
package = D66903BF27692EAB00819C4D /* XCRemoteSwiftPackageReference "SwiftSoup" */;
|
|
||||||
productName = SwiftSoup;
|
|
||||||
};
|
|
||||||
/* End XCSwiftPackageProductDependency section */
|
/* End XCSwiftPackageProductDependency section */
|
||||||
};
|
};
|
||||||
rootObject = D6B24DDD27640CE100BA23B8 /* Project object */;
|
rootObject = D6B24DDD27640CE100BA23B8 /* Project object */;
|
||||||
|
|
|
@ -1,25 +1,23 @@
|
||||||
{
|
{
|
||||||
"object": {
|
|
||||||
"pins" : [
|
"pins" : [
|
||||||
{
|
{
|
||||||
"package": "FMDB",
|
"identity" : "fmdb",
|
||||||
"repositoryURL": "https://github.com/ccgus/fmdb",
|
"kind" : "remoteSourceControl",
|
||||||
|
"location" : "https://github.com/ccgus/fmdb",
|
||||||
"state" : {
|
"state" : {
|
||||||
"branch": null,
|
|
||||||
"revision" : "61e51fde7f7aab6554f30ab061cc588b28a97d04",
|
"revision" : "61e51fde7f7aab6554f30ab061cc588b28a97d04",
|
||||||
"version" : "2.7.7"
|
"version" : "2.7.7"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"package": "SwiftSoup",
|
"identity" : "htmlstreamer",
|
||||||
"repositoryURL": "https://github.com/scinfu/SwiftSoup",
|
"kind" : "remoteSourceControl",
|
||||||
|
"location" : "https://git.shadowfacts.net/shadowfacts/HTMLStreamer.git",
|
||||||
"state" : {
|
"state" : {
|
||||||
"branch": null,
|
"revision" : "68e43131b7fbf6cabfba540ed15798df378d9997",
|
||||||
"revision": "3fa09f4d79e5172b14cb50e02f1d5f115a2bbaef",
|
"version" : "0.3.0"
|
||||||
"version": "2.3.4"
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
]
|
],
|
||||||
},
|
"version" : 2
|
||||||
"version": 1
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -7,7 +7,7 @@
|
||||||
|
|
||||||
import Cocoa
|
import Cocoa
|
||||||
import Combine
|
import Combine
|
||||||
import SwiftSoup
|
import HTMLStreamer
|
||||||
import MastoSearchCore
|
import MastoSearchCore
|
||||||
|
|
||||||
class ViewController: NSViewController {
|
class ViewController: NSViewController {
|
||||||
|
@ -20,6 +20,8 @@ class ViewController: NSViewController {
|
||||||
}()
|
}()
|
||||||
private static let searchThread = DispatchQueue(label: "Search", qos: .userInitiated)
|
private static let searchThread = DispatchQueue(label: "Search", qos: .userInitiated)
|
||||||
|
|
||||||
|
private static let htmlConverter = TextConverter(configuration: .init(insertNewlines: false))
|
||||||
|
|
||||||
@IBOutlet weak var table: NSTableView!
|
@IBOutlet weak var table: NSTableView!
|
||||||
@IBOutlet weak var progressIndicator: NSProgressIndicator!
|
@IBOutlet weak var progressIndicator: NSProgressIndicator!
|
||||||
|
|
||||||
|
@ -45,8 +47,7 @@ class ViewController: NSViewController {
|
||||||
cell.textField!.stringValue = item.status.summary ?? ""
|
cell.textField!.stringValue = item.status.summary ?? ""
|
||||||
|
|
||||||
case .content:
|
case .content:
|
||||||
let doc = try! SwiftSoup.parse(item.status.content)
|
cell.textField!.stringValue = Self.htmlConverter.convert(html: item.status.content)
|
||||||
cell.textField!.stringValue = try! doc.text()
|
|
||||||
|
|
||||||
default:
|
default:
|
||||||
fatalError()
|
fatalError()
|
||||||
|
|
|
@ -7,7 +7,7 @@
|
||||||
|
|
||||||
import UIKit
|
import UIKit
|
||||||
import MastoSearchCore
|
import MastoSearchCore
|
||||||
import SwiftSoup
|
import HTMLStreamer
|
||||||
|
|
||||||
class StatusTableRowCollectionViewCell: UICollectionViewCell {
|
class StatusTableRowCollectionViewCell: UICollectionViewCell {
|
||||||
|
|
||||||
|
@ -26,6 +26,8 @@ class StatusTableRowCollectionViewCell: UICollectionViewCell {
|
||||||
.minute(.twoDigits)
|
.minute(.twoDigits)
|
||||||
}()
|
}()
|
||||||
|
|
||||||
|
private static let htmlConverter = TextConverter(configuration: .init(insertNewlines: false))
|
||||||
|
|
||||||
private let dateLabel = UILabel()
|
private let dateLabel = UILabel()
|
||||||
private let contentWarningLabel = UILabel()
|
private let contentWarningLabel = UILabel()
|
||||||
private let contentLabel = UILabel()
|
private let contentLabel = UILabel()
|
||||||
|
@ -76,8 +78,7 @@ class StatusTableRowCollectionViewCell: UICollectionViewCell {
|
||||||
func updateUI(status: Status) {
|
func updateUI(status: Status) {
|
||||||
dateLabel.text = status.published.formatted(StatusTableRowCollectionViewCell.dateStyle)
|
dateLabel.text = status.published.formatted(StatusTableRowCollectionViewCell.dateStyle)
|
||||||
contentWarningLabel.text = status.summary ?? ""
|
contentWarningLabel.text = status.summary ?? ""
|
||||||
let doc = try! SwiftSoup.parseBodyFragment(status.content)
|
contentLabel.text = Self.htmlConverter.convert(html: status.content)
|
||||||
contentLabel.text = try! doc.body()!.text()
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue