8000 Sora js core by cranci1 · Pull Request #11 · cranci1/Sora · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Sora js core #11

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 32 commits into from
Jan 11, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
32 commits
Select commit Hold shift + click to select a range
4f9d80c
first public commit of Sora-JS 🎱
cranci1 Jan 5, 2025
e8f1a7d
Huge things frfrfrf
cranci1 Jan 5, 2025
dd3b97b
bug fixes
cranci1 Jan 5, 2025
d519fc6
added UserAgent support
cranci1 Jan 5, 2025
ee75542
Media Info view
cranci1 Jan 5, 2025
e7faec0
test
cranci1 Jan 5, 2025
90e571c
Update README.md
cranci1 Jan 5, 2025
89038d3
Update build-JS.yml
cranci1 Jan 5, 2025
836bc19
Update ipabuild.sh
cranci1 Jan 5, 2025
2189faa
Update build-JS.yml
cranci1 Jan 5, 2025
9ad3632
Update README.md
cranci1 Jan 6, 2025
250d1ce
Update README.md
cranci1 Jan 6, 2025
0a14a55
nothing
cranci1 Jan 6, 2025
2533835
fixed workspace
cranci1 Jan 6, 2025
a84bdf6
uh?
cranci1 Jan 6, 2025
fdbb3e1
added mediainfoView UI
cranci1 Jan 6, 2025
0d9ff05
does even work yay
cranci1 Jan 7, 2025
c28a47a
added http support for "unsecure" sites
cranci1 Jan 8, 2025
3ebf986
im so dumb i swear
cranci1 Jan 8, 2025
ac66da8
thank god man thank god
cranci1 Jan 8, 2025
4ae5517 8000
little UI thing
cranci1 Jan 9, 2025
06cf7b9
im cooked
cranci1 Jan 9, 2025
020b792
no results found display
cranci1 Jan 9, 2025
9f1d8f8
New search results method
hamzenis Jan 10, 2025
c643e02
Merge pull request #9 from hamzenis/Sora-JSCore
cranci1 Jan 10, 2025
d3fc29d
New fetching details method
hamzenis Jan 11, 2025
85d2499
Merge pull request #10 from hamzenis/Sora-JSCore
cranci1 Jan 11, 2025
166767a
clean up
cranci1 Jan 11, 2025
76d23e2
update thing
cranci1 Jan 11, 2025
6bbe269
Revert "update thing"
cranci1 Jan 11, 2025
bb9bb5d
Reapply "update thing"
cranci1 Jan 11, 2025
ffc3821
yes
cranci1 Jan 11, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,16 +28,16 @@ A modular web scraping app, **Still in early builds** under the GPLv3.0 License
## Frequently Asked Questions

1. **What is Sora?**
- Sora is a module based web scraping app, made to work with modules only
- Sora is a modular web scraping app designed to work exclusively with modules.

2. **Is Sora safe?**
- Yes, Sora is open-source and does not store user data on external servers.

3. **Will Sora ever be paid?**
- No, Sora will always remain free without subscriptions, paid content, or any type of login.
- No, Sora will always remain free, with no subscriptions, paid content, or required logins.

4. **How can i get module?**
- I do not provide any module for the app. Search for them on google or i dont know. I only created 1 module to watch videos of my school.
4. **Where can I get modules?**
- I do not provide any modules for the app. Search for them on google or elsewhere. I only created 1 module to watch videos of my school.

## Acknowledgements

Expand Down
460 changes: 166 additions & 294 deletions Sora.xcodeproj/project.pbxproj

Large diffs are not rendered by default.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Binary file not shown.

This file was deleted.

Binary file not shown.
92 changes: 3 additions & 89 deletions Sora/ContentView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,13 @@
// ContentView.swift
// Sora
//
// Created by Francesco on 18/12/24.
// Created by Francesco on 06/01/25.
//

import SwiftUI
import Kingfisher

struct ContentView: View {
@EnvironmentObject var modulesManager: ModulesManager

var body: some View {
TabView {
HomeView()
Expand All @@ -26,93 +25,8 @@ struct ContentView: View {
}
SettingsView()
.tabItem {
Label("Settings", systemImage: "gearshape")
Label("Settings", systemImage: "gear")
}
}
.onAppear {
checkForUpdate()
Logger.shared.log("Started Sora")
}
}

func checkForUpdate() {
fetchLatestRelease { release in
guard let release = release else { return }

let latestVersion = release.tagName
let currentVersion = Bundle.main.infoDictionary?["CFBundleShortVersionString"] as? String ?? "0.1.1"

if latestVersion.compare(currentVersion, options: .numeric) == .orderedDescending {
DispatchQueue.main.async {
showUpdateAlert(release: release)
}
}
}
}

func fetchLatestRelease(completion: @escaping (GitHubRelease?) -> Void) {
let url = URL(string: "https://api.github.com/repos/cranci1/Sora/releases/latest")!

URLSession.custom.dataTask(with: url) { data, _, error in
guard let data = data, error == nil else {
completion(nil)
return
}

let release = try? JSONDecoder().decode(GitHubRelease.self, from: data)
completion(release)
}.resume()
}

func showUpdateAlert(release: GitHubRelease) {
let alert = UIAlertController(title: "Update Available", message: "A new version (\(release.tagName)) is available. Would you like to update Sora?", preferredStyle: .alert)

alert.addAction(UIAlertAction(title: "Update", style: .default, handler: { _ in
self.showInstallOptionsAlert(release: release)
}))

alert.addAction(UIAlertAction(title: "Cancel", style: .cancel, handler: nil))

if let windowScene = UIApplication.shared.connectedScenes.first as? UIWindowScene,
let rootViewController = windowScene.windows.first?.rootViewController {
rootViewController.present(alert, animated: true, completion: nil)
}
}

func showInstallOptionsAlert(release: GitHubRelease) {
let installAlert = UIAlertController(title: "Install Update", message: "Choose an installation method:", preferredStyle: .alert)

let downloadUrl = release.assets.first?.browserDownloadUrl ?? ""

installAlert.addAction(UIAlertAction(title: "Install in AltStore", style: .default, handler: { _ in
if let url = URL(string: "altstore://install?url=\(downloadUrl)") {
UIApplication.shared.open(url)
}
}))

installAlert.addAction(UIAlertAction(title: "Install in Sidestore", style: .default, handler: { _ in
if let url = URL(string: "sidestore://install?url=\(downloadUrl)") {
UIApplication.shared.open(url)
}
}))

installAlert.addAction(UIAlertAction(title: "Open in Safari", style: .default, handler: { _ in
if let url = URL(string: downloadUrl) {
UIApplication.shared.open(url)
}
}))

installAlert.addAction(UIAlertAction(title: "Cancel", style: .cancel, handler: nil))

if let windowScene = UIApplication.shared.connectedScenes.first as? UIWindowScene,
let rootViewController = windowScene.windows.first?.rootViewController {
rootViewController.present(installAlert, animated: true, completion: nil)
}
}
}

struct ContentView_Previews: PreviewProvider {
static var previews: some View {
ContentView()
}
}
22 changes: 5 additions & 17 deletions Sora/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -2,22 +2,10 @@
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>CFBundleURLTypes</key>
<array>
<dict>
<key>CFBundleTypeRole</key>
<string>Editor</string>
<key>CFBundleURLName</key>
<string>me.cranci.scheme</string>
<key>CFBundleURLSchemes</key>
<array>
<string>ryu</string>
</array>
</dict>
</array>
<key>UIBackgroundModes</key>
<array>
<string>audio</string>
</array>
<key>NSAppTransportSecurity</key>
<dict>
<key>NSAllowsArbitraryLoads</key>
<true/>
</dict>
</dict>
</plist>
Original file line number Diff line number Diff line change
Expand Up @@ -32,22 +32,24 @@ struct CustomMediaPlayer: View {
@State private var showControls = false
@State private var inactivityTimer: Timer?
@State private var timeObserverToken: Any?
@State private var isVideoLoaded = false
@State private var showWatchNextButton = true
@Environment(\.presentationMode) var presentationMode

let module: ModuleStruct
let module: ScrapingModule
let fullUrl: String
let title: String
let episodeNumber: Int
let onWatchNext: () -> Void

init(module: ModuleStruct, urlString: String, fullUrl: String, title: String, episodeNumber: Int, onWatchNext: @escaping () -> Void) {
init(module: ScrapingModule, urlString: String, fullUrl: String, title: String, episodeNumber: Int, onWatchNext: @escaping () -> Void) {
guard let url = URL(string: urlString) else {
fatalError("Invalid URL string")
}

var request = URLRequest(url: url)
if urlString.contains("ascdn") {
request.addValue("\(module.module[0].details.baseURL)", forHTTPHeaderField: "Referer")
request.addValue("\(module.metadata.baseUrl)", forHTTPHeaderField: "Referer")
}

let asset = AVURLAsset(url: url, options: ["AVURLAssetHTTPHeaderFieldsKey": request.allHTTPHeaderFields ?? [:]])
Expand Down Expand Up @@ -76,6 +78,7 @@ struct CustomMediaPlayer: View {
currentTime = time.seconds
if let itemDuration = player.currentItem?.duration.seconds, itemDuration.isFinite && !itemDuration.isNaN {
duration = itemDuration
isVideoLoaded = true
}
}
startUpdatingCurrentTime()
Expand Down Expand Up @@ -152,7 +155,7 @@ struct CustomMediaPlayer: View {
.padding(.horizontal, 32)
}
Spacer()
if duration - currentTime <= duration * 0.10 && currentTime != duration {
if duration - currentTime <= duration * 0.10 && currentTime != duration && showWatchNextButton {
Button(action: {
player.pause()
presentationMode.wrappedValue.dismiss()
Expand All @@ -170,6 +173,13 @@ struct CustomMediaPlayer: View {
.cornerRadius(32)
}
.padding(.trailing, 10)
.onAppear {
if UserDefaults.standard.bool(forKey: "hideNextButton") {
DispatchQueue.main.asyncAfter(deadline: .now() + 5) {
showWatchNextButton = false
}
}
}
}
if showControls {
Menu {
Expand Down Expand Up @@ -203,13 +213,14 @@ struct CustomMediaPlayer: View {
emptyColor: .white.opacity(0.3),
height: 28,
onEditingChanged: { editing in
if !editing {
if !editing && isVideoLoaded {
player.seek(to: CMTime(seconds: currentTime, preferredTimescale: 600))
}
}
)
.padding(.horizontal, 32)
.padding(.bottom, 10)
.disabled(!isVideoLoaded)
}
}
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,23 +1,23 @@
//
// VideoPlayerView.swift
// VideoPlayer.swift
// Sora
//
// Created by Francesco on 18/12/24.
// Created by Francesco on 09/01/25.
//

import UIKit
import AVKit

class VideoPlayerViewController: UIViewController {
let module: ModuleStruct
let module: ScrapingModule

var player: AVPlayer?
var playerViewController: AVPlayerViewController?
var playerViewController: NormalPlayer?
var timeObserverToken: Any?
var streamUrl: String?
var fullUrl: String = ""

init(module: ModuleStruct) {
init(module: ScrapingModule) {
self.module = module
super.init(nibName: nil, bundle: nil)
}
Expand All @@ -35,7 +35,7 @@ class VideoPlayerViewController: UIViewController {

var request = URLRequest(url: url)
if streamUrl.contains("ascdn") {
request.addValue("\(module.module[0].details.baseURL)", forHTTPHeaderField: "Referer")
request.addValue("\(module.metadata.baseUrl)", forHTTPHeaderField: "Referer")
}

let asset = AVURLAsset(url: url, options: ["AVURLAssetHTTPHeaderFieldsKey": request.allHTTPHeaderFields ?? [:]])
Expand Down
10 changes: 0 additions & 10 deletions Sora/Sora.entitlements

This file was deleted.

Loading
0