mirror of
https://github.com/omnivore-app/omnivore.git
synced 2026-03-11 08:54:26 +00:00
remove auth token and env vars from webreader
This commit is contained in:
parent
16b3095527
commit
5db0cb12f0
4 changed files with 6 additions and 25 deletions
|
|
@ -10,8 +10,6 @@ struct WebReader: UIViewRepresentable {
|
|||
let openLinkAction: (URL) -> Void
|
||||
let webViewActionHandler: (WKScriptMessage, WKScriptMessageReplyHandler?) -> Void
|
||||
let navBarVisibilityRatioUpdater: (Double) -> Void
|
||||
let authToken: String
|
||||
let appEnv: AppEnvironment
|
||||
|
||||
@Binding var increaseFontActionID: UUID?
|
||||
@Binding var decreaseFontActionID: UUID?
|
||||
|
|
@ -35,10 +33,8 @@ struct WebReader: UIViewRepresentable {
|
|||
WebReaderContent(
|
||||
articleContent: articleContent,
|
||||
item: item,
|
||||
authToken: authToken,
|
||||
isDark: UITraitCollection.current.userInterfaceStyle == .dark,
|
||||
fontSize: fontSize(),
|
||||
appEnv: appEnv
|
||||
fontSize: fontSize()
|
||||
)
|
||||
.styledContent,
|
||||
baseURL: ViewsPackage.bundleURL
|
||||
|
|
|
|||
|
|
@ -21,7 +21,6 @@ struct WebReaderContainerView: View {
|
|||
@State var annotation = String()
|
||||
|
||||
@EnvironmentObject var dataService: DataService
|
||||
@EnvironmentObject var authenticator: Authenticator
|
||||
@Environment(\.presentationMode) var presentationMode: Binding<PresentationMode>
|
||||
@StateObject var viewModel = WebReaderViewModel()
|
||||
|
||||
|
|
@ -194,8 +193,6 @@ struct WebReaderContainerView: View {
|
|||
}
|
||||
navBarVisibilityRatio = $0
|
||||
},
|
||||
authToken: authenticator.authToken ?? "",
|
||||
appEnv: dataService.appEnvironment,
|
||||
increaseFontActionID: $increaseFontActionID,
|
||||
decreaseFontActionID: $decreaseFontActionID,
|
||||
annotationSaveTransactionID: $annotationSaveTransactionID,
|
||||
|
|
|
|||
|
|
@ -7,27 +7,19 @@ struct WebReaderContent {
|
|||
let articleContent: ArticleContent
|
||||
let item: FeedItem
|
||||
let themeKey: String
|
||||
let authToken: String
|
||||
let appEnv: AppEnvironment
|
||||
|
||||
init(
|
||||
articleContent: ArticleContent,
|
||||
item: FeedItem,
|
||||
authToken: String,
|
||||
isDark: Bool,
|
||||
fontSize: Int,
|
||||
appEnv: AppEnvironment
|
||||
fontSize: Int
|
||||
) {
|
||||
self.textFontSize = fontSize
|
||||
self.articleContent = articleContent
|
||||
self.item = item
|
||||
self.themeKey = isDark ? "Gray" : "LightGray"
|
||||
self.authToken = authToken
|
||||
self.appEnv = appEnv
|
||||
}
|
||||
|
||||
// <link rel="stylesheet" type="text/css" href="highlight\(themeKey == "Gray" ? "-dark" : "").css" />
|
||||
|
||||
// swiftlint:disable line_length
|
||||
var styledContent: String {
|
||||
"""
|
||||
|
|
@ -36,6 +28,9 @@ struct WebReaderContent {
|
|||
<head>
|
||||
<meta charset="utf-8" />
|
||||
<meta name='viewport' content='width=device-width, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0, user-scalable=no' />
|
||||
<style>
|
||||
@import url("highlight\(themeKey == "Gray" ? "-dark" : "").css");
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<div id="root" />
|
||||
|
|
@ -46,13 +41,6 @@ struct WebReaderContent {
|
|||
\(item.title)
|
||||
</div>
|
||||
<script type="text/javascript">
|
||||
window.omnivoreEnv = {
|
||||
"NEXT_PUBLIC_APP_ENV": "\(appEnv.rawValue)",
|
||||
"NEXT_PUBLIC_\(appEnv.rawValue.uppercased())_BASE_URL": "\(appEnv.webAppBaseURL.absoluteString)",
|
||||
"NEXT_PUBLIC_\(appEnv.rawValue.uppercased())_SERVER_BASE_URL": "\(appEnv.serverBaseURL.absoluteString)",
|
||||
"NEXT_PUBLIC_\(appEnv.rawValue.uppercased())_HIGHLIGHTS_BASE_URL": "\(appEnv.highlightsServerBaseURL.absoluteString)"
|
||||
}
|
||||
|
||||
window.omnivoreArticle = {
|
||||
id: "\(item.id)",
|
||||
linkId: "\(item.id)",
|
||||
|
|
@ -70,7 +58,6 @@ struct WebReaderContent {
|
|||
}
|
||||
|
||||
window.fontSize = \(textFontSize)
|
||||
window.localStorage.setItem("authToken", "\(authToken)")
|
||||
window.localStorage.setItem("theme", "\(themeKey)")
|
||||
</script>
|
||||
<script src="bundle.js"></script>
|
||||
|
|
|
|||
|
|
@ -3,6 +3,7 @@ import Foundation
|
|||
import Models
|
||||
import SwiftGraphQL
|
||||
|
||||
// swiftlint:disable:next function_body_length
|
||||
public extension DataService {
|
||||
func articleContentPublisher(username: String, slug: String) -> AnyPublisher<ArticleContent, ServerError> {
|
||||
enum QueryResult {
|
||||
|
|
|
|||
Loading…
Reference in a new issue