This commit is contained in:
lunaticbum 2025-07-23 18:12:30 +09:00
parent f56c43d82b
commit 668d33543c
10 changed files with 211 additions and 82 deletions

View File

@ -1,4 +1,3 @@
const list = ["?page=2","?page=3","?page=4","?page=5","?page=6"];
const port = browser.runtime.connectNative("browser"); const port = browser.runtime.connectNative("browser");
port.onMessage.addListener(response => { port.onMessage.addListener(response => {
var type= response["type"]; var type= response["type"];
@ -237,9 +236,9 @@ function sendMessage(msg) {
function toast(msg) { function toast(msg) {
port.postMessage(JSON.stringify({type:"MSG",msg:msg})); port.postMessage(JSON.stringify({type:"MSG",msg:msg}));
} }
var time1 = null
if (port) { if (port) {
setTimeout( time1 = setTimeout(
function(){ function(){
if (location.hostname.search("clien") > -1 && document.querySelectorAll('[class^="view_top"]')) { if (location.hostname.search("clien") > -1 && document.querySelectorAll('[class^="view_top"]')) {
document.querySelectorAll('[class^="view_top"]').forEach(e => e.remove()) document.querySelectorAll('[class^="view_top"]').forEach(e => e.remove())
@ -342,7 +341,11 @@ if (port) {
var title = ""; var title = "";
try { try {
title = e.querySelector(".name").querySelector("a").querySelector("span").textContent.trim(); e.querySelector(".name").querySelector("a").querySelectorAll("span").forEach(function (e) {
if (e.hasAttribute("class") == false) {
title = e.textContent.trim();
}
})
}catch (e) { }catch (e) {
} }
@ -367,10 +370,10 @@ if (port) {
"title" : title, "title" : title,
"description" : desc, "description" : desc,
"originPage" : originPage, "originPage" : originPage,
"magnet" : magnet, "magnet_link" : magnet,
"thumbnail" : thumb, "thumbnail" : thumb,
"pubDate" : date, "pubDate" : date,
"screenshots" : screenshots, "screenshotsUrl" : screenshots,
"chosung" : "", "chosung" : "",
"category" : "PRIVATE" "category" : "PRIVATE"
}); });
@ -387,24 +390,48 @@ if (port) {
},1500) },1500)
} }
var targetUrl = ""
var time2 = null
function gotoNext() { function gotoNext() {
if (location.href.search("page") < 0) { clearTimeout(time1)
targetUrl = location.protocol + "//" + location.hostname + "/" + list[0] try{
}else {
var targetUrl = "" var url = new URL(location.href);
for (i = 0; i < list.length - 1; i++) { var params = url.searchParams;
var keys = Array.from(params.keys());
console.log("targetUrl :: " + params);
console.log("targetUrl :: " + keys.length);
if (keys.length === 0 && location.href.search("page") < 0) {
targetUrl = location.protocol + "//" + location.hostname + "/?page=2"
} else {
try { try {
if (location.href.search(list[i]) > -1) { var lastValue = params.get("page");
targetUrl = location.protocol + "//" + location.hostname + list[i + 1] console.log("targetUrl :: " + lastValue);
var numValue = Number(lastValue);
console.log("targetUrl :: " + numValue);
if (numValue < Number("5")) {
params.set("page", (numValue + 1).toString());
console.log("targetUrl :: " + params);
url.search = params.toString();
console.log("targetUrl :: " + url.search);
targetUrl = url.toString();
} else {
console.log("targetUrl :: ");
} }
}catch (e) { } catch (e) {
console.error(e) console.error(e)
} }
}
console.log("targetUrl :: " + targetUrl);
time2 = setTimeout(function () {
clearTimeout(time2)
if (targetUrl.length > 5) {
console.log("targetUrl :: " + targetUrl);
location.href = targetUrl
}
}, 5000);
} catch (e) {
} }
}
if (targetUrl.length > 5) {
setTimeout(function () {location.href = targetUrl},3000)
}
} }

View File

@ -36,7 +36,9 @@ import bums.lunatic.launcher.tokiz.view.JxEvent
import bums.lunatic.launcher.utils.Blog import bums.lunatic.launcher.utils.Blog
import bums.lunatic.launcher.utils.afterDay import bums.lunatic.launcher.utils.afterDay
import bums.lunatic.launcher.workers.WorkersDb import bums.lunatic.launcher.workers.WorkersDb
import bums.lunatic.launcher.workers.WorkersDb.getRealm
import com.google.gson.Gson import com.google.gson.Gson
import io.realm.kotlin.UpdatePolicy
import org.json.JSONException import org.json.JSONException
import org.json.JSONObject import org.json.JSONObject
import org.jsoup.Jsoup import org.jsoup.Jsoup
@ -472,9 +474,14 @@ class GeckoWeb : BWebview {
} }
"PRIVATES"->{ "PRIVATES"->{
lPortMessage.privates?.forEach { lPortMessage.privates?.forEach {
Blog.LOGE("Item screenshots >>> ${it.screenshots}") Blog.LOGE("Item screenshots >>> ${it.getScreen()}")
it.pubDate = afterDay(it.pubDate) it.pubDate = afterDay(it.pubDate)
WorkersDb.insertData(it) // WorkersDb.insertData(it)
getRealm().apply {
this.writeBlocking {
copyToRealm(it, UpdatePolicy.ALL)
}
}
} }
} }
"PagerContents" -> { "PagerContents" -> {

View File

@ -59,8 +59,11 @@ import bums.lunatic.launcher.utils.SimpleFingerGestures
import bums.lunatic.launcher.utils.beforeDay import bums.lunatic.launcher.utils.beforeDay
import bums.lunatic.launcher.utils.beforeOneDay import bums.lunatic.launcher.utils.beforeOneDay
import bums.lunatic.launcher.workers.WorkersDb import bums.lunatic.launcher.workers.WorkersDb
import bums.lunatic.launcher.workers.WorkersDb.prvClear
import com.bumptech.glide.Glide import com.bumptech.glide.Glide
import com.bumptech.glide.load.engine.DiskCacheStrategy
import com.google.android.material.imageview.ShapeableImageView import com.google.android.material.imageview.ShapeableImageView
import com.google.gson.Gson
import io.realm.kotlin.UpdatePolicy import io.realm.kotlin.UpdatePolicy
import io.realm.kotlin.ext.query import io.realm.kotlin.ext.query
import io.realm.kotlin.notifications.InitialResults import io.realm.kotlin.notifications.InitialResults
@ -268,13 +271,34 @@ internal class RssHome : Fragment() {
} else { } else {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.VANILLA_ICE_CREAM) { if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.VANILLA_ICE_CREAM) {
if (lasted.size > 0) {
lasted?.removeFirst()?.let { lasted?.removeFirst()?.let {
Blog.LOGE("removeFirst >>> ${Gson().toJson(it)}")
binding.layoutRssSummary.root.visibility = View.VISIBLE binding.layoutRssSummary.root.visibility = View.VISIBLE
binding.layoutRssSummary.title.text = it.title() it.title()?.let {
binding.layoutRssSummary.desc.text = it.description() Blog.LOGE(it)
binding.layoutRssSummary.link.text = it.originPage() binding.layoutRssSummary.title.text = it
loadImage(binding.layoutRssSummary.cover,it.thumbnailUrl()) }
loadImage(binding.layoutRssSummary.screen,it.getScreen())
it.description()?.let {
Blog.LOGE(it)
binding.layoutRssSummary.desc.text = it
}
it.getMagnet().let {
Blog.LOGE(it)
binding.layoutRssSummary.link.text = it
}
it.thumbnailUrl().let {
Blog.LOGE(it)
loadImage(binding.layoutRssSummary.cover, it)
}
it.getScreen().let {
Blog.LOGE(it)
loadImage(binding.layoutRssSummary.screen, it)
}
}
} else {
binding.home.performClick()
} }
} }
@ -360,6 +384,10 @@ internal class RssHome : Fragment() {
binding.prv.setOnClickListener { binding.prv.setOnClickListener {
queryPrevate() queryPrevate()
} }
binding.layoutRssSummary.close.setOnClickListener {
binding.home.performClick()
}
queryInfos() queryInfos()
binding.geckoWeb.progress = binding.progressBar binding.geckoWeb.progress = binding.progressBar
binding.geckoWeb.jxInteface = { jxEvent -> binding.geckoWeb.jxInteface = { jxEvent ->
@ -598,14 +626,15 @@ fun loadImage(imageView: ImageView, url: String?) {
Blog.LOGE("loadImage >>> $it") Blog.LOGE("loadImage >>> $it")
Glide.with(imageView.context) Glide.with(imageView.context)
.load(url) .load(url)
.diskCacheStrategy(DiskCacheStrategy.ALL)
.fitCenter() .fitCenter()
.into(imageView) .into(imageView)
imageView.visibility = View.VISIBLE imageView.visibility = View.VISIBLE
} else { } else {
imageView.visibility = View.GONE imageView.visibility = View.INVISIBLE
} }
} ?: { } ?: {
imageView.visibility = View.GONE imageView.visibility = View.INVISIBLE
} }
} }

View File

@ -39,6 +39,14 @@ class Clien : DcInside() {
} }
class Arca : RssDataInterface { class Arca : RssDataInterface {
override fun getScreen(): String {
return ""
}
override fun getMagnet(): String {
return ""
}
var link : String? = null var link : String? = null
var title : String? = null var title : String? = null
var thumbnail : String? = null var thumbnail : String? = null
@ -160,6 +168,14 @@ open class DcInside : RssDataInterface {
return desc ?: "" return desc ?: ""
} }
override fun getScreen(): String {
return ""
}
override fun getMagnet(): String {
return ""
}
override fun pubDate(): Long { override fun pubDate(): Long {
if (dateTiemL < 1L) { if (dateTiemL < 1L) {
if (dateTiem?.length ?: 0 < 1) return 0L if (dateTiem?.length ?: 0 < 1) return 0L
@ -219,11 +235,15 @@ class RssData : RealmObject, RssDataInterface {
var thumbnail : String? = null var thumbnail : String? = null
var pubDate : Long = 0L var pubDate : Long = 0L
var category : String? = null var category : String? = null
var magnet : String? = null var magnet_link : String? = null
var screenshots : String? = null var screenshotsUrl : String? = null
fun getScreen() : String {
Blog.LOGE("getScreen $screenshots") override fun getScreen() : String {
return screenshots ?: "" return screenshotsUrl ?: ""
}
override fun getMagnet(): String {
return magnet_link ?: ""
} }
var chosung : String? = null var chosung : String? = null
@ -239,18 +259,15 @@ class RssData : RealmObject, RssDataInterface {
} }
else -> title ?: "" else -> title ?: ""
}.apply { }.apply {
Blog.LOGE("title $this")
chosung = JamoUtils.split(title).joinToString("") chosung = JamoUtils.split(title).joinToString("")
} }
} }
override fun thumbnailUrl(): String { override fun thumbnailUrl(): String {
Blog.LOGE("thumbnail $thumbnail")
return thumbnail ?: "" return thumbnail ?: ""
} }
override fun originPage(): String { override fun originPage(): String {
Blog.LOGE("originPage $originPage")
return originPage ?: "" return originPage ?: ""
} }
@ -288,6 +305,13 @@ open class Dotax(var pageLink : String,
var dateTime : String, var dateTime : String,
var title : String, var title : String,
var thumbnail : String) : RssDataInterface { var thumbnail : String) : RssDataInterface {
override fun getScreen(): String {
return ""
}
override fun getMagnet(): String {
return ""
}
var updateDateTime = 0L var updateDateTime = 0L
override fun title(): String { override fun title(): String {
return title return title

View File

@ -3,7 +3,13 @@ package bums.lunatic.launcher.model
import bums.lunatic.launcher.utils.JamoUtils import bums.lunatic.launcher.utils.JamoUtils
class NewsData : RssDataInterface { class NewsData : RssDataInterface {
override fun getScreen(): String {
return ""
}
override fun getMagnet(): String {
return ""
}
var title : String? = "" var title : String? = ""
var link : String? = "" var link : String? = ""
var guid : String? = "" var guid : String? = ""

View File

@ -69,4 +69,6 @@ interface RssDataInterface {
fun pubDate() : Long fun pubDate() : Long
fun category() : RssDataType fun category() : RssDataType
fun getCho() : String? fun getCho() : String?
fun getScreen() : String
fun getMagnet() : String
} }

View File

@ -124,6 +124,13 @@ class CrosspostParentList {
} }
class Data : RssDataInterface { class Data : RssDataInterface {
override fun getScreen(): String {
return ""
}
override fun getMagnet(): String {
return ""
}
var after: String? = null var after: String? = null
var dist: Int = 0 var dist: Int = 0
var modhash: String? = null var modhash: String? = null

View File

@ -506,6 +506,13 @@ class GridChannelRenderer {
} }
class GridVideoRenderer : VideoRenderer() { class GridVideoRenderer : VideoRenderer() {
override fun getScreen(): String {
return ""
}
override fun getMagnet(): String {
return ""
}
// var videoId: String? = null // var videoId: String? = null
// var thumbnail: Thumbnail? = null // var thumbnail: Thumbnail? = null
// var title: Title? = null // var title: Title? = null
@ -1567,6 +1574,13 @@ class VideoCountText {
} }
open class VideoRenderer : RssDataInterface { open class VideoRenderer : RssDataInterface {
override fun getScreen(): String {
return ""
}
override fun getMagnet(): String {
return ""
}
var videoId: String? = null var videoId: String? = null
var thumbnail: Thumbnail? = null var thumbnail: Thumbnail? = null
var title: Title? = null var title: Title? = null

View File

@ -55,11 +55,12 @@ class CustMigration : AutomaticSchemaMigration {
Blog.LOGE(migrationContext.oldRealm.configuration.schemaVersion.toString()) Blog.LOGE(migrationContext.oldRealm.configuration.schemaVersion.toString())
Blog.LOGE(migrationContext.newRealm.configuration.schemaVersion.toString()) Blog.LOGE(migrationContext.newRealm.configuration.schemaVersion.toString())
} }
} }
object WorkersDb { object WorkersDb {
val clazz : Set<KClass<out BaseRealmObject>> = setOf(RssData::class, NotificationItem::class, AppInfo::class,SimpleContact::class, RecentCall::class, RecentSms::class, CurrentPlayItem::class, val clazz : Set<KClass<out BaseRealmObject>> = setOf(
RssData::class, NotificationItem::class, AppInfo::class,SimpleContact::class, RecentCall::class, RecentSms::class, CurrentPlayItem::class,
TelegramBotUpdate::class, TelegramData::class, TelegramMessage::class, TelegramChat::class, BotCommandEentitie::class, TelegramFrom::class, TelegramBotUpdate::class, TelegramData::class, TelegramMessage::class, TelegramChat::class, BotCommandEentitie::class, TelegramFrom::class,
WeatherForcast::class, Location::class, Current::class, Forecast::class, Condition::class, Forecastday::class, Day::class, Astro::class, Hour::class, WeatherForcast::class, Location::class, Current::class, Forecast::class, Condition::class, Forecastday::class, Day::class, Astro::class, Hour::class,
LocationLog::class, LocationLog::class,
@ -88,21 +89,11 @@ object WorkersDb {
getRealm().apply { getRealm().apply {
this.writeBlocking { this.writeBlocking {
try { try {
if (rssData.category().equals(RssDataType.PRIVATE)) {
this.copyToRealm(rssData, UpdatePolicy.ALL)
Blog.LOGE("rssData >> $rssData ${rssData.getScreen()}")
} else {
if (query<RssData>("originPage == $0", rssData.originPage).find() if (query<RssData>("originPage == $0", rssData.originPage).find()
.isEmpty() .isEmpty()
) { ) {
this.copyToRealm(rssData, UpdatePolicy.ERROR) this.copyToRealm(rssData, UpdatePolicy.ERROR)
} }
}
try {
query<RssData>("originPage == $0",rssData.originPage).find()?.first()?.let {
Blog.LOGE("SAVED CHECK ${Gson().toJson(this.copyFromRealm(it))}")
}
}catch (e: Exception) {e.printStackTrace()}
} catch (e : Exception) { } catch (e : Exception) {
} }
@ -110,7 +101,7 @@ object WorkersDb {
} }
} }
// val blockKeyword = arrayListOf<String>("붕괴 스타레일","붕괴 스타일","트릭컬 RE:VIVE","원신","메이플스토리","") // val blockKeyword = arrayListOf<String>("붕괴 스타레일","붕괴 스타일","트릭컬 RE:VIVE","원신","메이플스토리","")
fun insertBulkData(rssDatas: Collection<RssData>) { fun insertBulkData(rssDatas: Collection<RssData>) {
rssDatas.forEach { rssDatas.forEach {
try { try {
@ -225,7 +216,13 @@ object WorkersDb {
} }
} }
} }
fun prvClear() {
getRealm().writeBlocking {
var results = query<RssData>().query("category == $0 ",
RssDataType.PRIVATE.name).find()
delete(results)
}
}
fun getPrivate() = getRealm().query<RssData>().query("category == $0 ", fun getPrivate() = getRealm().query<RssData>().query("category == $0 ",
RssDataType.PRIVATE.name).distinct("originPage", "title").sort("pubDate", Sort.DESCENDING) RssDataType.PRIVATE.name).distinct("originPage", "title").sort("pubDate", Sort.DESCENDING)

View File

@ -8,61 +8,77 @@
name="rss" name="rss"
type="bums.lunatic.launcher.model.RssData" /> type="bums.lunatic.launcher.model.RssData" />
</data> </data>
<FrameLayout <androidx.constraintlayout.widget.ConstraintLayout
android:background="#000"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent"> android:layout_height="match_parent">
<ScrollView <ScrollView
android:layout_width="match_parent" app:layout_constraintTop_toTopOf="parent"
android:layout_height="match_parent" app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="parent"
android:layout_width="0dp"
android:layout_height="0dp"
tools:ignore="UselessParent"> tools:ignore="UselessParent">
<LinearLayout <androidx.constraintlayout.widget.ConstraintLayout
android:layout_gravity="center" android:divider="@color/white"
android:gravity="center" android:showDividers="middle"
android:orientation="vertical"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content"> android:layout_height="wrap_content">
<TextView <TextView
app:layout_constraintTop_toTopOf="parent"
android:id="@+id/title" android:id="@+id/title"
android:singleLine="false" android:singleLine="false"
android:lines="0"
android:background="#000" android:background="#000"
android:textSize="@dimen/_20sp" android:textSize="@dimen/_20sp"
android:textColor="@color/white" android:textColor="@color/white"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="150dp"/> android:layout_height="wrap_content"/>
<ImageView <ImageView
android:alpha="0.05" app:layout_constraintTop_toBottomOf="@id/title"
android:id="@+id/cover" android:alpha="0.6"
android:adjustViewBounds="true" android:adjustViewBounds="true"
app:layout_constraintLeft_toLeftOf="parent" android:scaleType="fitCenter"
app:layout_constraintTop_toTopOf="parent" android:id="@+id/cover"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content"/> android:layout_height="wrap_content"/>
<TextView <TextView
app:layout_constraintTop_toBottomOf="@id/cover"
android:id="@+id/desc" android:id="@+id/desc"
android:singleLine="false" android:singleLine="false"
android:lines="0"
android:background="#000" android:background="#000"
android:textSize="@dimen/_20sp" android:textSize="@dimen/_20sp"
android:textColor="@color/white" android:textColor="@color/white"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="150dp"/> android:layout_height="wrap_content"/>
<ImageView <ImageView
app:layout_constraintTop_toBottomOf="@id/desc"
android:id="@+id/screen" android:id="@+id/screen"
android:alpha="0.05" android:alpha="0.6"
android:adjustViewBounds="true" android:adjustViewBounds="true"
android:scaleType="fitCenter"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content"/> android:layout_height="wrap_content"/>
<TextView <TextView
app:layout_constraintTop_toBottomOf="@id/screen"
android:id="@+id/link" android:id="@+id/link"
android:singleLine="false" android:singleLine="false"
android:lines="0"
android:background="#000" android:background="#000"
android:textSize="@dimen/_20sp" android:textSize="@dimen/_20sp"
android:textColor="@color/white" android:textColor="@color/white"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="150dp"/> android:layout_height="wrap_content"/>
</LinearLayout> </androidx.constraintlayout.widget.ConstraintLayout>
</ScrollView> </ScrollView>
</FrameLayout> <ImageButton
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toTopOf="parent"
android:tint="@color/white"
android:background="@null"
android:id="@+id/close"
android:foregroundTint="@color/white"
android:src="@drawable/close_vector"
android:layout_width="wrap_content"
android:layout_height="wrap_content"/>
</androidx.constraintlayout.widget.ConstraintLayout>
</layout> </layout>