/WebShell

A shell could opreate WKWebView in Swift & JS, it run like internet worm, but not in harm way.

Primary LanguageSwift

WebShell

WebShell


Better way write worm code with Swift.

Downloading files from many cloud storage platforms can be cumbersome, requiring multiple page redirects. Through studying the download process, it was discovered that they are all patched together like monsters, and some of the download processes are the same. Theoretically, it is possible to solidify the necessary processes into different modules and link them together, which can be reused across different cloud storage platforms.

This framework serves as the foundation for other apps, and one of the core abilities of the app I am developing is to automatically parse download links and enable one-click downloads using this framework. In the future, more straightforward APIs will be updated.

Support Site Module Status
www.xueqiupan.com DownPagePHPLinks done
rosefile.net AppendDownPathFileIDStringInDomSearchGroupGeneralLinks done
www.xunniufile.com DownPagePHPLinks done
www.xingyaoclouds.com RedirectEnablePageActionDownPagePHPLinks done
www.rarp.cc HTTPStringRedirectEnablePageFileListURLRequestInPageGeneratorPHPLinks done
www.567file.com 'RedirectEnablePage'、'SignFileListURLRequestGenerator'、'PHPLinks' done
www.iycdn.com TowerGroup、'PHPLinks' done
www.xfpan.cc - host down
www.kufile.net - host down

Ussage

 let link = "http://www.xueqiupan.com/file-672734.html"
 cancellable = DownPage(.default)
    .join(PHPLinks())
    .join(Saver(.override))
    .publisher(for: link)
    .sink { complete in
        switch complete {
           case .finished:
               break
           case .failure(let error):
               print(">>> download error \(error)")
        }
    } receiveValue: { url in
        print(">>> download file at \(url)")
    }

The file will download at your Downloads folder.

Introduction examples

Just confirm Condom protocol make simple download HTML page operation become async module

struct DownloadWebPage: Condom {
    typealias Input = URL
    typealias Output = String
    
    public func publisher(for inputValue: Input) -> AnyPublisher<Output, Error> {
        // tool for data -> string 
        StringParserDataTask(request: .init(url: inputValue), encoding: .utf8)
            .publisher()
    }
    
    public func empty() -> AnyPublisher<Output, Error> {
        Fail(error: URLError(.badURL)).eraseToAnyPublisher()
    }
}

Then get publisher out of it,and sink to fire it up!

DownloadWebPage()
    .publisher(for: link)
    .sink { complete in
        switch complete {
           case .finished:
               break
           case .failure(let error):
               print(">>> download error \(error)")
        }
    } receiveValue: { text in
        print(">>> html: \(text)")
    }

Installation

carthage

Carthage is a simple, decentralized dependency manager for Cocoa.

Specify WebShell into your project's Cartfile:

github "0xfeedface1993/WebShell" ~> 3.0

Swift Package Manager (SPM)

From Xcode, select from the menu File > Swift Packages > Add Package Dependency Specify the URL https://github.com/0xfeedface1993/WebShell

As you can see, this project need more work, so if you want join me, any pull request will be helpful!

Thanks! Have a good day!