2017-05-27 19:43:27 +02:00
|
|
|
|
//
|
|
|
|
|
// ArticleRenderer.swift
|
2018-08-29 07:18:24 +02:00
|
|
|
|
// NetNewsWire
|
2017-05-27 19:43:27 +02:00
|
|
|
|
//
|
|
|
|
|
// Created by Brent Simmons on 9/8/15.
|
|
|
|
|
// Copyright © 2015 Ranchero Software, LLC. All rights reserved.
|
|
|
|
|
//
|
|
|
|
|
|
|
|
|
|
import Foundation
|
2020-03-13 00:07:40 +01:00
|
|
|
|
#if os(iOS)
|
|
|
|
|
import UIKit
|
|
|
|
|
#endif
|
2017-05-27 19:43:27 +02:00
|
|
|
|
import RSCore
|
2018-07-24 03:29:08 +02:00
|
|
|
|
import Articles
|
2018-07-28 21:16:14 +02:00
|
|
|
|
import Account
|
2017-05-27 19:43:27 +02:00
|
|
|
|
|
2019-02-11 07:06:03 +01:00
|
|
|
|
struct ArticleRenderer {
|
2018-11-27 06:38:14 +01:00
|
|
|
|
|
2020-01-30 13:10:45 +01:00
|
|
|
|
typealias Rendering = (style: String, html: String, title: String, baseURL: String)
|
2020-03-17 23:18:24 +01:00
|
|
|
|
|
|
|
|
|
struct Page {
|
|
|
|
|
let url: URL
|
|
|
|
|
let baseURL: URL
|
|
|
|
|
let html: String
|
|
|
|
|
|
|
|
|
|
init(name: String) {
|
|
|
|
|
url = Bundle.main.url(forResource: name, withExtension: "html")!
|
|
|
|
|
baseURL = url.deletingLastPathComponent()
|
|
|
|
|
html = try! NSString(contentsOfFile: url.path, encoding: String.Encoding.utf8.rawValue) as String
|
|
|
|
|
}
|
|
|
|
|
}
|
2019-09-21 19:36:35 +02:00
|
|
|
|
|
2019-11-07 21:29:16 +01:00
|
|
|
|
static var imageIconScheme = "nnwImageIcon"
|
|
|
|
|
|
2020-03-17 23:18:24 +01:00
|
|
|
|
static var blank = Page(name: "blank")
|
|
|
|
|
static var page = Page(name: "page")
|
2019-09-21 19:36:35 +02:00
|
|
|
|
|
2018-11-27 06:38:14 +01:00
|
|
|
|
private let article: Article?
|
2019-09-19 01:15:55 +02:00
|
|
|
|
private let extractedArticle: ExtractedArticle?
|
2021-09-07 23:58:06 +02:00
|
|
|
|
private let articleTheme: ArticleTheme
|
2018-11-27 06:38:14 +01:00
|
|
|
|
private let title: String
|
2019-09-19 01:15:55 +02:00
|
|
|
|
private let body: String
|
2019-04-14 21:54:17 +02:00
|
|
|
|
private let baseURL: String?
|
2021-09-17 21:10:33 +02:00
|
|
|
|
|
|
|
|
|
private static let longDateTimeFormatter: DateFormatter = {
|
|
|
|
|
let formatter = DateFormatter()
|
|
|
|
|
formatter.dateStyle = .long
|
|
|
|
|
formatter.timeStyle = .medium
|
|
|
|
|
return formatter
|
|
|
|
|
}()
|
|
|
|
|
|
|
|
|
|
private static let mediumDateTimeFormatter: DateFormatter = {
|
|
|
|
|
let formatter = DateFormatter()
|
|
|
|
|
formatter.dateStyle = .medium
|
|
|
|
|
formatter.timeStyle = .short
|
|
|
|
|
return formatter
|
|
|
|
|
}()
|
|
|
|
|
|
|
|
|
|
private static let shortDateTimeFormatter: DateFormatter = {
|
|
|
|
|
let formatter = DateFormatter()
|
|
|
|
|
formatter.dateStyle = .short
|
|
|
|
|
formatter.timeStyle = .short
|
|
|
|
|
return formatter
|
|
|
|
|
}()
|
|
|
|
|
|
|
|
|
|
private static let longDateFormatter: DateFormatter = {
|
|
|
|
|
let formatter = DateFormatter()
|
|
|
|
|
formatter.dateStyle = .long
|
|
|
|
|
formatter.timeStyle = .none
|
|
|
|
|
return formatter
|
|
|
|
|
}()
|
|
|
|
|
|
|
|
|
|
private static let mediumDateFormatter: DateFormatter = {
|
|
|
|
|
let formatter = DateFormatter()
|
|
|
|
|
formatter.dateStyle = .medium
|
|
|
|
|
formatter.timeStyle = .none
|
|
|
|
|
return formatter
|
|
|
|
|
}()
|
|
|
|
|
|
|
|
|
|
private static let shortDateFormatter: DateFormatter = {
|
|
|
|
|
let formatter = DateFormatter()
|
|
|
|
|
formatter.dateStyle = .short
|
|
|
|
|
formatter.timeStyle = .none
|
|
|
|
|
return formatter
|
|
|
|
|
}()
|
|
|
|
|
|
|
|
|
|
private static let longTimeFormatter: DateFormatter = {
|
|
|
|
|
let formatter = DateFormatter()
|
|
|
|
|
formatter.dateStyle = .none
|
|
|
|
|
formatter.timeStyle = .long
|
|
|
|
|
return formatter
|
|
|
|
|
}()
|
|
|
|
|
|
|
|
|
|
private static let mediumTimeFormatter: DateFormatter = {
|
|
|
|
|
let formatter = DateFormatter()
|
|
|
|
|
formatter.dateStyle = .none
|
|
|
|
|
formatter.timeStyle = .medium
|
|
|
|
|
return formatter
|
|
|
|
|
}()
|
|
|
|
|
|
|
|
|
|
private static let shortTimeFormatter: DateFormatter = {
|
|
|
|
|
let formatter = DateFormatter()
|
|
|
|
|
formatter.dateStyle = .none
|
|
|
|
|
formatter.timeStyle = .short
|
|
|
|
|
return formatter
|
|
|
|
|
}()
|
2018-11-27 06:38:14 +01:00
|
|
|
|
|
2021-09-07 23:58:06 +02:00
|
|
|
|
private init(article: Article?, extractedArticle: ExtractedArticle?, theme: ArticleTheme) {
|
2017-05-27 19:43:27 +02:00
|
|
|
|
self.article = article
|
2019-09-19 01:15:55 +02:00
|
|
|
|
self.extractedArticle = extractedArticle
|
2021-09-07 23:58:06 +02:00
|
|
|
|
self.articleTheme = theme
|
2020-04-30 09:36:32 +02:00
|
|
|
|
self.title = article?.sanitizedTitle() ?? ""
|
2019-09-19 01:15:55 +02:00
|
|
|
|
if let content = extractedArticle?.content {
|
|
|
|
|
self.body = content
|
2019-09-20 00:41:56 +02:00
|
|
|
|
self.baseURL = extractedArticle?.url
|
2019-09-19 01:15:55 +02:00
|
|
|
|
} else {
|
|
|
|
|
self.body = article?.body ?? ""
|
2019-09-20 00:41:56 +02:00
|
|
|
|
self.baseURL = article?.baseURL?.absoluteString
|
2019-09-19 01:15:55 +02:00
|
|
|
|
}
|
2017-05-27 19:43:27 +02:00
|
|
|
|
}
|
2019-02-11 07:06:03 +01:00
|
|
|
|
|
|
|
|
|
// MARK: - API
|
|
|
|
|
|
2021-09-07 23:58:06 +02:00
|
|
|
|
static func articleHTML(article: Article, extractedArticle: ExtractedArticle? = nil, theme: ArticleTheme) -> Rendering {
|
|
|
|
|
let renderer = ArticleRenderer(article: article, extractedArticle: extractedArticle, theme: theme)
|
2020-03-13 00:07:40 +01:00
|
|
|
|
return (renderer.articleCSS, renderer.articleHTML, renderer.title, renderer.baseURL ?? "")
|
2019-02-11 07:06:03 +01:00
|
|
|
|
}
|
|
|
|
|
|
2021-09-07 23:58:06 +02:00
|
|
|
|
static func multipleSelectionHTML(theme: ArticleTheme) -> Rendering {
|
|
|
|
|
let renderer = ArticleRenderer(article: nil, extractedArticle: nil, theme: theme)
|
2020-03-13 00:07:40 +01:00
|
|
|
|
return (renderer.articleCSS, renderer.multipleSelectionHTML, renderer.title, renderer.baseURL ?? "")
|
2019-02-11 07:06:03 +01:00
|
|
|
|
}
|
|
|
|
|
|
2021-09-07 23:58:06 +02:00
|
|
|
|
static func loadingHTML(theme: ArticleTheme) -> Rendering {
|
|
|
|
|
let renderer = ArticleRenderer(article: nil, extractedArticle: nil, theme: theme)
|
2020-03-13 00:07:40 +01:00
|
|
|
|
return (renderer.articleCSS, renderer.loadingHTML, renderer.title, renderer.baseURL ?? "")
|
2019-09-21 22:03:42 +02:00
|
|
|
|
}
|
|
|
|
|
|
2021-09-07 23:58:06 +02:00
|
|
|
|
static func noSelectionHTML(theme: ArticleTheme) -> Rendering {
|
|
|
|
|
let renderer = ArticleRenderer(article: nil, extractedArticle: nil, theme: theme)
|
2020-03-13 00:07:40 +01:00
|
|
|
|
return (renderer.articleCSS, renderer.noSelectionHTML, renderer.title, renderer.baseURL ?? "")
|
2019-02-12 07:36:31 +01:00
|
|
|
|
}
|
2019-09-01 00:03:03 +02:00
|
|
|
|
|
2021-09-07 23:58:06 +02:00
|
|
|
|
static func noContentHTML(theme: ArticleTheme) -> Rendering {
|
|
|
|
|
let renderer = ArticleRenderer(article: nil, extractedArticle: nil, theme: theme)
|
2020-03-13 00:07:40 +01:00
|
|
|
|
return (renderer.articleCSS, renderer.noContentHTML, renderer.title, renderer.baseURL ?? "")
|
2019-09-01 00:03:03 +02:00
|
|
|
|
}
|
2018-11-27 06:38:14 +01:00
|
|
|
|
}
|
2017-05-27 19:43:27 +02:00
|
|
|
|
|
2019-02-11 07:06:03 +01:00
|
|
|
|
// MARK: - Private
|
2017-05-27 19:43:27 +02:00
|
|
|
|
|
2018-11-27 06:38:14 +01:00
|
|
|
|
private extension ArticleRenderer {
|
2017-05-27 19:43:27 +02:00
|
|
|
|
|
2019-02-11 07:06:03 +01:00
|
|
|
|
private var articleHTML: String {
|
2020-03-13 00:07:40 +01:00
|
|
|
|
return try! MacroProcessor.renderedText(withTemplate: template(), substitutions: articleSubstitutions())
|
2019-02-11 07:06:03 +01:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private var multipleSelectionHTML: String {
|
|
|
|
|
let body = "<h3 class='systemMessage'>Multiple selection</h3>"
|
2020-01-30 13:10:45 +01:00
|
|
|
|
return body
|
2019-02-11 07:06:03 +01:00
|
|
|
|
}
|
|
|
|
|
|
2019-09-21 22:03:42 +02:00
|
|
|
|
private var loadingHTML: String {
|
|
|
|
|
let body = "<h3 class='systemMessage'>Loading...</h3>"
|
2020-01-30 13:10:45 +01:00
|
|
|
|
return body
|
2019-09-21 22:03:42 +02:00
|
|
|
|
}
|
|
|
|
|
|
2019-02-11 07:06:03 +01:00
|
|
|
|
private var noSelectionHTML: String {
|
|
|
|
|
let body = "<h3 class='systemMessage'>No selection</h3>"
|
2020-01-30 13:10:45 +01:00
|
|
|
|
return body
|
2019-02-11 07:06:03 +01:00
|
|
|
|
}
|
|
|
|
|
|
2019-09-01 00:03:03 +02:00
|
|
|
|
private var noContentHTML: String {
|
2020-01-30 13:10:45 +01:00
|
|
|
|
return ""
|
2019-09-01 00:03:03 +02:00
|
|
|
|
}
|
2020-03-13 00:07:40 +01:00
|
|
|
|
|
|
|
|
|
private var articleCSS: String {
|
2020-03-20 12:41:38 +01:00
|
|
|
|
return try! MacroProcessor.renderedText(withTemplate: styleString(), substitutions: styleSubstitutions())
|
2020-03-13 00:07:40 +01:00
|
|
|
|
}
|
2019-09-01 00:03:03 +02:00
|
|
|
|
|
2018-11-27 06:38:14 +01:00
|
|
|
|
static var defaultStyleSheet: String = {
|
|
|
|
|
let path = Bundle.main.path(forResource: "styleSheet", ofType: "css")!
|
|
|
|
|
let s = try! NSString(contentsOfFile: path, encoding: String.Encoding.utf8.rawValue)
|
|
|
|
|
return "\n\(s)\n"
|
|
|
|
|
}()
|
2017-05-27 19:43:27 +02:00
|
|
|
|
|
2018-11-27 06:38:14 +01:00
|
|
|
|
static let defaultTemplate: String = {
|
|
|
|
|
let path = Bundle.main.path(forResource: "template", ofType: "html")!
|
|
|
|
|
let s = try! NSString(contentsOfFile: path, encoding: String.Encoding.utf8.rawValue)
|
|
|
|
|
return s as String
|
|
|
|
|
}()
|
2017-12-30 02:10:50 +01:00
|
|
|
|
|
2018-11-27 06:38:14 +01:00
|
|
|
|
func styleString() -> String {
|
2021-09-07 23:58:06 +02:00
|
|
|
|
return articleTheme.css ?? ArticleRenderer.defaultStyleSheet
|
2017-05-27 19:43:27 +02:00
|
|
|
|
}
|
|
|
|
|
|
2018-11-27 06:38:14 +01:00
|
|
|
|
func template() -> String {
|
2021-09-07 23:58:06 +02:00
|
|
|
|
return articleTheme.template ?? ArticleRenderer.defaultTemplate
|
2017-12-29 20:31:47 +01:00
|
|
|
|
}
|
|
|
|
|
|
2019-09-19 01:15:55 +02:00
|
|
|
|
func articleSubstitutions() -> [String: String] {
|
2017-05-27 19:43:27 +02:00
|
|
|
|
var d = [String: String]()
|
|
|
|
|
|
2018-09-15 03:00:51 +02:00
|
|
|
|
guard let article = article else {
|
|
|
|
|
assertionFailure("Article should have been set before calling this function.")
|
|
|
|
|
return d
|
|
|
|
|
}
|
|
|
|
|
|
2018-03-01 07:38:29 +01:00
|
|
|
|
d["title"] = title
|
2021-09-17 21:10:33 +02:00
|
|
|
|
d["preferred_link"] = article.preferredLink ?? ""
|
2020-11-20 09:17:17 +01:00
|
|
|
|
|
2021-09-30 05:46:11 +02:00
|
|
|
|
if let externalLink = article.externalLink, externalLink != article.preferredLink {
|
2021-09-17 21:10:33 +02:00
|
|
|
|
d["external_link_label"] = NSLocalizedString("Link:", comment: "Link")
|
|
|
|
|
d["external_link_stripped"] = externalLink.strippingHTTPOrHTTPSScheme
|
|
|
|
|
d["external_link"] = externalLink
|
2020-11-20 09:17:17 +01:00
|
|
|
|
} else {
|
2021-09-17 21:10:33 +02:00
|
|
|
|
d["external_link_label"] = ""
|
|
|
|
|
d["external_link_stripped"] = ""
|
2020-11-20 09:17:17 +01:00
|
|
|
|
d["external_link"] = ""
|
|
|
|
|
}
|
|
|
|
|
|
2018-03-01 07:38:29 +01:00
|
|
|
|
d["body"] = body
|
2020-12-09 02:00:56 +01:00
|
|
|
|
|
|
|
|
|
#if os(macOS)
|
|
|
|
|
d["text_size_class"] = AppDefaults.shared.articleTextSize.cssClass
|
|
|
|
|
#endif
|
|
|
|
|
|
2020-02-09 02:21:55 +01:00
|
|
|
|
var components = URLComponents()
|
|
|
|
|
components.scheme = Self.imageIconScheme
|
|
|
|
|
components.path = article.articleID
|
|
|
|
|
if let imageIconURLString = components.string {
|
2021-09-17 00:11:16 +02:00
|
|
|
|
d["avatar_src"] = imageIconURLString
|
2020-02-09 02:21:55 +01:00
|
|
|
|
}
|
|
|
|
|
else {
|
2021-09-17 21:10:33 +02:00
|
|
|
|
d["avatar_src"] = ""
|
2020-02-09 02:21:55 +01:00
|
|
|
|
}
|
2020-08-19 22:44:40 +02:00
|
|
|
|
|
|
|
|
|
if self.title.isEmpty {
|
|
|
|
|
d["dateline_style"] = "articleDatelineTitle"
|
|
|
|
|
} else {
|
|
|
|
|
d["dateline_style"] = "articleDateline"
|
|
|
|
|
}
|
2017-12-30 02:10:50 +01:00
|
|
|
|
|
2021-09-17 21:10:33 +02:00
|
|
|
|
d["feed_link_title"] = article.webFeed?.nameForDisplay ?? ""
|
|
|
|
|
d["feed_link"] = article.webFeed?.homePageURL ?? ""
|
2017-12-29 20:31:47 +01:00
|
|
|
|
|
|
|
|
|
d["byline"] = byline()
|
|
|
|
|
|
2021-09-17 21:10:33 +02:00
|
|
|
|
let datePublished = article.logicalDatePublished
|
|
|
|
|
d["datetime_long"] = Self.longDateTimeFormatter.string(from: datePublished)
|
|
|
|
|
d["datetime_medium"] = Self.mediumDateTimeFormatter.string(from: datePublished)
|
|
|
|
|
d["datetime_short"] = Self.shortDateTimeFormatter.string(from: datePublished)
|
|
|
|
|
d["date_long"] = Self.longDateFormatter.string(from: datePublished)
|
|
|
|
|
d["date_medium"] = Self.mediumDateFormatter.string(from: datePublished)
|
|
|
|
|
d["date_short"] = Self.shortDateFormatter.string(from: datePublished)
|
|
|
|
|
d["time_long"] = Self.longTimeFormatter.string(from: datePublished)
|
|
|
|
|
d["time_medium"] = Self.mediumTimeFormatter.string(from: datePublished)
|
|
|
|
|
d["time_short"] = Self.shortTimeFormatter.string(from: datePublished)
|
|
|
|
|
|
2017-05-27 19:43:27 +02:00
|
|
|
|
return d
|
|
|
|
|
}
|
|
|
|
|
|
2018-11-27 06:38:14 +01:00
|
|
|
|
func byline() -> String {
|
2019-11-15 03:11:41 +01:00
|
|
|
|
guard let authors = article?.authors ?? article?.webFeed?.authors, !authors.isEmpty else {
|
2017-12-29 20:31:47 +01:00
|
|
|
|
return ""
|
|
|
|
|
}
|
|
|
|
|
|
2018-09-07 20:46:00 +02:00
|
|
|
|
// If the author's name is the same as the feed, then we don't want to display it.
|
|
|
|
|
// This code assumes that multiple authors would never match the feed name so that
|
|
|
|
|
// if there feed owner has an article co-author all authors are given the byline.
|
|
|
|
|
if authors.count == 1, let author = authors.first {
|
2019-11-15 03:11:41 +01:00
|
|
|
|
if author.name == article?.webFeed?.nameForDisplay {
|
2018-09-07 20:46:00 +02:00
|
|
|
|
return ""
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
var byline = ""
|
2017-12-29 20:31:47 +01:00
|
|
|
|
var isFirstAuthor = true
|
|
|
|
|
|
|
|
|
|
for author in authors {
|
|
|
|
|
if !isFirstAuthor {
|
|
|
|
|
byline += ", "
|
|
|
|
|
}
|
|
|
|
|
isFirstAuthor = false
|
|
|
|
|
|
2020-08-19 00:44:28 +02:00
|
|
|
|
var authorEmailAddress: String? = nil
|
|
|
|
|
if let emailAddress = author.emailAddress, !(emailAddress.contains("noreply@") || emailAddress.contains("no-reply@")) {
|
|
|
|
|
authorEmailAddress = emailAddress
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if let emailAddress = authorEmailAddress, emailAddress.contains(" ") {
|
2017-12-29 20:31:47 +01:00
|
|
|
|
byline += emailAddress // probably name plus email address
|
|
|
|
|
}
|
|
|
|
|
else if let name = author.name, let url = author.url {
|
2018-11-27 06:38:14 +01:00
|
|
|
|
byline += name.htmlByAddingLink(url)
|
2017-12-29 20:31:47 +01:00
|
|
|
|
}
|
2020-08-19 00:44:28 +02:00
|
|
|
|
else if let name = author.name, let emailAddress = authorEmailAddress {
|
2020-04-15 23:39:58 +02:00
|
|
|
|
byline += "\(name) <\(emailAddress)>"
|
2017-12-29 20:31:47 +01:00
|
|
|
|
}
|
|
|
|
|
else if let name = author.name {
|
|
|
|
|
byline += name
|
|
|
|
|
}
|
2020-08-19 00:44:28 +02:00
|
|
|
|
else if let emailAddress = authorEmailAddress {
|
2017-12-29 20:31:47 +01:00
|
|
|
|
byline += "<\(emailAddress)>" // TODO: mailto link
|
|
|
|
|
}
|
|
|
|
|
else if let url = author.url {
|
2018-11-27 06:38:14 +01:00
|
|
|
|
byline += String.htmlWithLink(url)
|
2017-12-29 20:31:47 +01:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2017-12-30 02:10:50 +01:00
|
|
|
|
return byline
|
2017-12-29 20:31:47 +01:00
|
|
|
|
}
|
|
|
|
|
|
2020-03-13 00:07:40 +01:00
|
|
|
|
#if os(iOS)
|
|
|
|
|
func styleSubstitutions() -> [String: String] {
|
|
|
|
|
var d = [String: String]()
|
2020-03-13 01:01:10 +01:00
|
|
|
|
let bodyFont = UIFont.preferredFont(forTextStyle: .body)
|
|
|
|
|
d["font-size"] = String(describing: bodyFont.pointSize)
|
2020-03-13 00:07:40 +01:00
|
|
|
|
return d
|
|
|
|
|
}
|
2020-03-20 12:41:38 +01:00
|
|
|
|
#else
|
|
|
|
|
func styleSubstitutions() -> [String: String] {
|
2020-12-09 02:00:56 +01:00
|
|
|
|
return [String: String]()
|
2020-03-20 12:41:38 +01:00
|
|
|
|
}
|
2020-03-13 00:07:40 +01:00
|
|
|
|
#endif
|
2018-11-27 06:38:14 +01:00
|
|
|
|
|
2017-05-27 19:43:27 +02:00
|
|
|
|
}
|
2019-04-14 21:54:17 +02:00
|
|
|
|
|
|
|
|
|
// MARK: - Article extension
|
|
|
|
|
|
|
|
|
|
private extension Article {
|
|
|
|
|
|
|
|
|
|
var baseURL: URL? {
|
2021-09-30 05:46:11 +02:00
|
|
|
|
var s = link
|
2019-04-14 21:54:17 +02:00
|
|
|
|
if s == nil {
|
2019-11-15 03:11:41 +01:00
|
|
|
|
s = webFeed?.homePageURL
|
2019-04-14 21:54:17 +02:00
|
|
|
|
}
|
|
|
|
|
if s == nil {
|
2019-11-15 03:11:41 +01:00
|
|
|
|
s = webFeed?.url
|
2019-04-14 21:54:17 +02:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
guard let urlString = s else {
|
|
|
|
|
return nil
|
|
|
|
|
}
|
|
|
|
|
var urlComponents = URLComponents(string: urlString)
|
|
|
|
|
if urlComponents == nil {
|
|
|
|
|
return nil
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Can’t use url-with-fragment as base URL. The webview won’t load. See scripting.com/rss.xml for example.
|
|
|
|
|
urlComponents!.fragment = nil
|
|
|
|
|
guard let url = urlComponents!.url, url.scheme == "http" || url.scheme == "https" else {
|
|
|
|
|
return nil
|
|
|
|
|
}
|
|
|
|
|
return url
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|