This commit is contained in:
lunaticbum 2025-08-22 15:01:17 +09:00
parent 4acc01b742
commit a11e40c56c
6 changed files with 165 additions and 85 deletions

View File

@ -306,14 +306,15 @@ document.addEventListener('DOMContentLoaded', function () {
} }
}) })
document.addEventListener('touchstart', function(e) { if(location.href.search("youtube") < 0) {
console.log('터치 시작'); document.addEventListener('touchstart', function(e) {
}); console.log('터치 시작');
});
document.addEventListener('touchend', function(e) {
autoScrollAndSave()
});
document.addEventListener('touchend', function(e) {
autoScrollAndSave()
});
}
function scrollToLazyImg(fastMode) { function scrollToLazyImg(fastMode) {
(function(autoScrollAndSave){ (function(autoScrollAndSave){
// 한 번에 이동할 픽셀 // 한 번에 이동할 픽셀
@ -463,20 +464,17 @@ function ytDown() {
function handleCommon() { function handleCommon() {
// 공통 광고 제거 // 공통 광고 제거
alert(JSON.stringify({COOKIES : document.cookie}))
if (document.querySelector(".top_google_ad_space")) document.querySelector(".top_google_ad_space").remove(); if (document.querySelector(".top_google_ad_space")) document.querySelector(".top_google_ad_space").remove();
document.querySelectorAll(".adv-group, [id^='div-gpt-ad'], [id^='div_adnmore_area'], [class^='adv-groupno'], [class^='code-block'], .ad-template").forEach(e => e.remove()); document.querySelectorAll(".adv-group, [id^='div-gpt-ad'], [id^='div_adnmore_area'], [class^='adv-groupno'], [class^='code-block'], .ad-template").forEach(e => e.remove());
if (document.querySelector('#xpromo-bottom-sheet')) document.querySelector('#xpromo-bottom-sheet').remove(); if (document.querySelector('#xpromo-bottom-sheet')) document.querySelector('#xpromo-bottom-sheet').remove();
document.querySelectorAll('iframe').forEach(e => { document.querySelectorAll('iframe').forEach(e => {
const src = e.getAttribute("src"); const src = e.getAttribute("src");
if (src != null && (src.includes("ads") || src.includes("coupang"))) e.remove(); if (src != null && (src.includes("ads") || src.includes("coupang"))) e.remove();
}); });
if (document.querySelectorAll('[data-banner^="coupang-"]')) { if (document.querySelectorAll('[data-banner^="coupang-"]')) {
document.querySelectorAll('[data-banner^="coupang-"]').forEach(e => e.remove()) document.querySelectorAll('[data-banner^="coupang-"]').forEach(e => e.remove())
} }
if (document.querySelectorAll('[id^="mobonDivBanner"]')) { if (document.querySelectorAll('[id^="mobonDivBanner"]')) {
document.querySelectorAll('[id^="mobonDivBanner"]').forEach(e => e.remove()) document.querySelectorAll('[id^="mobonDivBanner"]').forEach(e => e.remove())
} }
@ -491,7 +489,7 @@ function handleCommon() {
} }
if (document.querySelectorAll('[class^="col-md-4 mb-4 video-item"]').length > 1) { if (location.href.search("javt") > -1 &&document.querySelectorAll('[class^="col-md-4 mb-4 video-item"]').length > 1) {
var datas = [] var datas = []
document.querySelectorAll('[class^="col-md-4 mb-4 video-item"]').forEach(function (e) { document.querySelectorAll('[class^="col-md-4 mb-4 video-item"]').forEach(function (e) {
var date = 0 var date = 0

View File

@ -88,6 +88,9 @@ import com.yausername.ffmpeg.FFmpeg
import com.yausername.youtubedl_android.YoutubeDL import com.yausername.youtubedl_android.YoutubeDL
import com.yausername.youtubedl_android.YoutubeDLException import com.yausername.youtubedl_android.YoutubeDLException
import io.realm.kotlin.ext.query import io.realm.kotlin.ext.query
import kotlinx.coroutines.CoroutineScope
import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.launch
import kr.lunaticbum.utils.ui.DisplayUtil import kr.lunaticbum.utils.ui.DisplayUtil
import org.json.JSONObject import org.json.JSONObject
import org.jsoup.helper.DataUtil import org.jsoup.helper.DataUtil
@ -467,6 +470,9 @@ open class LauncherActivity : CommonActivity() {
try { try {
YoutubeDL.getInstance().init(this) YoutubeDL.getInstance().init(this)
FFmpeg.getInstance().init(this); FFmpeg.getInstance().init(this);
CoroutineScope(Dispatchers.IO).launch {
YoutubeDL.getInstance().updateYoutubeDL(this@LauncherActivity)
}
} catch (e: YoutubeDLException) { } catch (e: YoutubeDLException) {
Blog.LOGE("failed to initialize youtubedl-android", e) Blog.LOGE("failed to initialize youtubedl-android", e)
} }

View File

@ -180,7 +180,7 @@ class ForeGroundService : Service() {
) )
startForeground(NOTIF_ID, NotificationCompat.Builder(this, CHANNEL_ID) startForeground(NOTIF_ID, NotificationCompat.Builder(this, CHANNEL_ID)
.setContentTitle("BLE 서비스") .setContentTitle("BUM'S 서비스")
.setContentText(str) .setContentText(str)
.setPriority(NotificationCompat.PRIORITY_MAX) .setPriority(NotificationCompat.PRIORITY_MAX)
.setSmallIcon(R.drawable.ic_b) .setSmallIcon(R.drawable.ic_b)
@ -206,7 +206,7 @@ class ForeGroundService : Service() {
return null return null
} }
private val CHANNEL_ID = "ble_service_channel" private val CHANNEL_ID = "ble_service_channel"
private val CHANNEL_NAME = "BLE 서비스" private val CHANNEL_NAME = "BUM'S 서비스"
//페어링된 디바이스 정보 가져오기 //페어링된 디바이스 정보 가져오기

View File

@ -76,57 +76,84 @@ class NLService : NotificationListenerService() {
@RequiresApi(Build.VERSION_CODES.S) @RequiresApi(Build.VERSION_CODES.S)
override fun onNotificationPosted(sbn: StatusBarNotification) { override fun onNotificationPosted(sbn: StatusBarNotification) {
Blog.LOGE("onNotificationPosted ${sbn}") Blog.LOGE("onNotificationPosted ${sbn}")
val notification = sbn.notification if (sbn.packageName.contains("bums.lunatic.launcher") == false) {
val extras = notification.extras val notification = sbn.notification
val title = extras.getString(Notification.EXTRA_TITLE) ?: "" val extras = notification.extras
val text = extras.getCharSequence(Notification.EXTRA_TEXT)?.toString() ?: "" val title = extras.getString(Notification.EXTRA_TITLE) ?: ""
val bigText = extras.getCharSequence(Notification.EXTRA_BIG_TEXT)?.toString() ?: "" val text = extras.getCharSequence(Notification.EXTRA_TEXT)?.toString() ?: ""
val extraInfo = extras.getCharSequence(Notification.EXTRA_INFO_TEXT)?.toString() ?: "" val bigText = extras.getCharSequence(Notification.EXTRA_BIG_TEXT)?.toString() ?: ""
val subText = extras.getCharSequence(Notification.EXTRA_SUB_TEXT)?.toString() ?: "" val extraInfo = extras.getCharSequence(Notification.EXTRA_INFO_TEXT)?.toString() ?: ""
val conversationTitle = extras.getCharSequence(Notification.EXTRA_CONVERSATION_TITLE)?.toString() ?: "" val subText = extras.getCharSequence(Notification.EXTRA_SUB_TEXT)?.toString() ?: ""
val summaryText = extras.getCharSequence(Notification.EXTRA_SUMMARY_TEXT)?.toString() ?: "" val conversationTitle =
val verificationText = extras.getCharSequence(Notification.EXTRA_VERIFICATION_TEXT)?.toString() ?: "" extras.getCharSequence(Notification.EXTRA_CONVERSATION_TITLE)?.toString() ?: ""
val stringBuffer = StringBuffer() val summaryText =
stringBuffer.append(title).append("\n") extras.getCharSequence(Notification.EXTRA_SUMMARY_TEXT)?.toString() ?: ""
stringBuffer.append(text).append("\n") val verificationText =
stringBuffer.append(bigText).append("\n") extras.getCharSequence(Notification.EXTRA_VERIFICATION_TEXT)?.toString() ?: ""
stringBuffer.append(extraInfo).append("\n") val stringBuffer = StringBuffer()
stringBuffer.append(subText).append("\n") stringBuffer.append(title).append("\n")
stringBuffer.append(conversationTitle).append("\n") stringBuffer.append(text).append("\n")
stringBuffer.append(summaryText).append("\n") stringBuffer.append(bigText).append("\n")
stringBuffer.append(verificationText).append("\n") stringBuffer.append(extraInfo).append("\n")
Blog.LOGE("title >> ${title} text >> ${text} bigText >> ${bigText} extraInfo >> ${extraInfo} subText >> ${subText} conversationTitle >> ${conversationTitle} summaryText >> ${summaryText} verificationText >> ${verificationText}") stringBuffer.append(subText).append("\n")
mHourlyLogWriter?.writeLog("${sbn.packageName}\n${stringBuffer.toString()}") stringBuffer.append(conversationTitle).append("\n")
when (sbn.packageName){ stringBuffer.append(summaryText).append("\n")
"com.kakao.taxi" -> { stringBuffer.append(verificationText).append("\n")
var defaultMsg : StringBuffer? = StringBuffer("돼지 택시 ") Blog.LOGE("title >> ${title} text >> ${text} bigText >> ${bigText} extraInfo >> ${extraInfo} subText >> ${subText} conversationTitle >> ${conversationTitle} summaryText >> ${summaryText} verificationText >> ${verificationText}")
if (stringBuffer.contains("택시") && stringBuffer.contains("탑승") && stringBuffer.contains("완료")) { mHourlyLogWriter?.writeLog("${sbn.packageName}\n${stringBuffer.toString()}")
defaultMsg?.append("탔다요~!") when (sbn.packageName) {
}else if(stringBuffer.contains("택시") && stringBuffer.contains("자동결제") && stringBuffer.contains("물건")) { "com.kakao.taxi" -> {
defaultMsg?.append("거의 다 왔다요~!") var defaultMsg: StringBuffer? = StringBuffer("돼지 택시 ")
}else if(stringBuffer.contains("택시") && stringBuffer.contains("도착") && stringBuffer.contains("선택")) { if (stringBuffer.contains("택시") && stringBuffer.contains("탑승") && stringBuffer.contains(
defaultMsg?.append("내린다요~!") "완료"
} else { )
defaultMsg = null ) {
} defaultMsg?.append("탔다요~!")
defaultMsg?.let { } else if (stringBuffer.contains("택시") && stringBuffer.contains("자동결제") && stringBuffer.contains(
makeMsgByTransferInfomation(it) "물건"
} )
} ) {
"com.kakao.talk" -> { defaultMsg?.append("거의 다 왔다요~!")
if (stringBuffer.contains("카카오페이") && stringBuffer.contains("모바일") && stringBuffer.contains("교통카드") && stringBuffer.contains("사용 내역")) { } else if (stringBuffer.contains("택시") && stringBuffer.contains("도착") && stringBuffer.contains(
var usePublicTransportation = PrefBoolean.usePublicTransportation.get(false) "선택"
PrefBoolean.usePublicTransportation.set(!usePublicTransportation) )
var defaultMsg = StringBuffer("돼지가 대중교통에${if (!usePublicTransportation){" 탑승 "} else {" 하차"}} 했다요~!") ) {
KakaoPublicTransfer(stringBuffer.toString()).let { defaultMsg?.append("내린다요~!")
defaultMsg.append("\n${it.transportType}(${it.transportName})") } else {
defaultMsg.append("\n${it.dateTime}") defaultMsg = null
}
defaultMsg?.let {
makeMsgByTransferInfomation(it)
} }
makeMsgByTransferInfomation(defaultMsg)
} }
}
"kakaopay.app" -> {
"com.kakao.talk" -> {
if (stringBuffer.contains("카카오페이") && stringBuffer.contains("모바일") && stringBuffer.contains(
"교통카드"
) && stringBuffer.contains("사용 내역")
) {
var usePublicTransportation = PrefBoolean.usePublicTransportation.get(false)
PrefBoolean.usePublicTransportation.set(!usePublicTransportation)
var defaultMsg = StringBuffer(
"돼지가 대중교통에${
if (!usePublicTransportation) {
" 탑승 "
} else {
"서 하차"
}
} 했다요~!"
)
KakaoPublicTransfer(stringBuffer.toString()).let {
defaultMsg.append("\n${it.transportType}(${it.transportName})")
defaultMsg.append("\n${it.dateTime}")
}
makeMsgByTransferInfomation(defaultMsg)
}
}
"kakaopay.app" -> {
}
} }
} }
} }

View File

@ -59,6 +59,7 @@ import bums.lunatic.launcher.databinding.BooktokiBinding
import bums.lunatic.launcher.home.toast import bums.lunatic.launcher.home.toast
import bums.lunatic.launcher.tokiz.data.model.FakeSession import bums.lunatic.launcher.tokiz.data.model.FakeSession
import bums.lunatic.launcher.tokiz.data.model.FakeSessions import bums.lunatic.launcher.tokiz.data.model.FakeSessions
import bums.lunatic.launcher.tokiz.view.BWebview
import bums.lunatic.launcher.utils.Blog import bums.lunatic.launcher.utils.Blog
import bums.lunatic.launcher.workers.WorkersDb import bums.lunatic.launcher.workers.WorkersDb
import com.google.gson.Gson import com.google.gson.Gson
@ -71,6 +72,7 @@ import org.json.JSONObject
import org.mozilla.gecko.util.ThreadUtils import org.mozilla.gecko.util.ThreadUtils
import org.mozilla.geckoview.GeckoResult import org.mozilla.geckoview.GeckoResult
import org.mozilla.geckoview.GeckoSession import org.mozilla.geckoview.GeckoSession
import org.mozilla.geckoview.GeckoSessionSettings
import org.mozilla.geckoview.MediaSession import org.mozilla.geckoview.MediaSession
import org.mozilla.geckoview.WebExtension import org.mozilla.geckoview.WebExtension
import org.mozilla.geckoview.WebExtension.MessageDelegate import org.mozilla.geckoview.WebExtension.MessageDelegate
@ -81,6 +83,7 @@ import java.lang.System.currentTimeMillis
import java.net.URL import java.net.URL
import java.text.SimpleDateFormat import java.text.SimpleDateFormat
import java.util.Date import java.util.Date
import java.util.UUID
import kotlin.collections.ArrayList import kotlin.collections.ArrayList
import kotlin.collections.List import kotlin.collections.List
import kotlin.collections.MutableList import kotlin.collections.MutableList
@ -333,31 +336,40 @@ abstract class BaseToki : Fragment(), PagedTextViewInterface {
// No extension registered yet, let's ignore this message // No extension registered yet, let's ignore this message
return return
} }
binding.menuWeb.postDelayed({ if (lastedUrl?.contains("youtube.com") == true) {
// val script = "alert(JSON.stringify({Cookies : document.cookie}))"
// val encodedJs = Uri.encode(script)
// val jsUri = "javascript:$encodedJs"
// session?.loadUri(jsUri)
// session.loadUri()
} else {
binding.menuWeb.postDelayed({
Blog.LOGE("onPageStop $success from WebExtension ${mPort!!.name}") Blog.LOGE("onPageStop $success from WebExtension ${mPort!!.name}")
val message: JSONObject = JSONObject() val message: JSONObject = JSONObject()
try { try {
message.put("type", "getList") message.put("type", "getList")
message.put("event", "sadsadds") message.put("event", "sadsadds")
message.put("tab", session.settings.screenId) message.put("tab", session.settings.screenId)
} catch (ex: JSONException) { } catch (ex: JSONException) {
throw RuntimeException(ex) throw RuntimeException(ex)
}
mPort!!.postMessage(message)
when(this@BaseToki) {
is Comics , is Webtoons -> {
lastInfo
} }
else -> {
mPort!!.postMessage(message)
when (this@BaseToki) {
is Comics, is Webtoons -> {
lastInfo
}
else -> {
}
} }
} binding.progress.visibility = GONE
binding.progress.visibility = GONE }, 10L)
}, 10L) }
} }
} }
} }
@ -602,8 +614,29 @@ abstract class BaseToki : Fragment(), PagedTextViewInterface {
goToHome() goToHome()
} }
getRuntime()?.apply { getRuntime()?.apply {
val session: GeckoSession = GeckoSession() val sessionSettings = GeckoSessionSettings.Builder()
.usePrivateMode(true)
.allowJavascript(true)
.screenId(Random(Int.MAX_VALUE).nextInt())
.build()
val session: GeckoSession = GeckoSession(sessionSettings)
session.open(this) session.open(this)
session.settings
session.promptDelegate = object : GeckoSession.PromptDelegate {
override fun onAlertPrompt(
session: GeckoSession,
prompt: GeckoSession.PromptDelegate.AlertPrompt
): GeckoResult<GeckoSession.PromptDelegate.PromptResponse?>? {
// Blog.LOGE("prompt.message >>> ${prompt.message}")
if (prompt.message?.contains("COOKIES") == true) {
binding.menuWeb.mGKCookie = Gson().fromJson<BWebview.GKCookie>(prompt.message,BWebview.GKCookie::class.java)
}
prompt.dismiss()
return super.onAlertPrompt(session, prompt)
}
}
binding.menuWeb.setSession(session) binding.menuWeb.setSession(session)
binding.menuWeb.jxInteface = { jxEvent -> binding.menuWeb.jxInteface = { jxEvent ->
Blog.LOGE("jxEvent $jxEvent") Blog.LOGE("jxEvent $jxEvent")

View File

@ -3,6 +3,7 @@ package bums.lunatic.launcher.tokiz.view
import android.annotation.SuppressLint import android.annotation.SuppressLint
import android.content.Context import android.content.Context
import android.content.Intent import android.content.Intent
import android.net.Uri
import android.os.Build import android.os.Build
import android.util.AttributeSet import android.util.AttributeSet
import android.view.MotionEvent import android.view.MotionEvent
@ -17,11 +18,13 @@ import bums.lunatic.launcher.tokiz.common.TouchArea
import bums.lunatic.launcher.utils.Blog import bums.lunatic.launcher.utils.Blog
import bums.lunatic.launcher.utils.SimpleFingerGestures import bums.lunatic.launcher.utils.SimpleFingerGestures
import com.yausername.youtubedl_android.YoutubeDL import com.yausername.youtubedl_android.YoutubeDL
import com.yausername.youtubedl_android.YoutubeDLRequest
import kotlinx.coroutines.CoroutineScope import kotlinx.coroutines.CoroutineScope
import kotlinx.coroutines.Dispatchers import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.launch import kotlinx.coroutines.launch
import org.mozilla.gecko.util.ThreadUtils.runOnUiThread import org.mozilla.gecko.util.ThreadUtils.runOnUiThread
import org.mozilla.geckoview.GeckoView import org.mozilla.geckoview.GeckoView
import java.io.File
import java.util.Base64 import java.util.Base64
enum class JxEvent { enum class JxEvent {
@ -79,6 +82,13 @@ open class BWebview : GeckoView {
context.startService(actionIntent) context.startService(actionIntent)
} }
} }
class GKCookie {
var COOKIES : String? = null
}
var mGKCookie : GKCookie? = null
fun checkIfDownloadable(url: String) { fun checkIfDownloadable(url: String) {
CoroutineScope(Dispatchers.Main).launch { CoroutineScope(Dispatchers.Main).launch {
runOnUiThread { runOnUiThread {
@ -89,7 +99,13 @@ open class BWebview : GeckoView {
Blog.LOGE("checkIfDownloadable ${url}") Blog.LOGE("checkIfDownloadable ${url}")
CoroutineScope(Dispatchers.IO).launch { CoroutineScope(Dispatchers.IO).launch {
try { try {
val videoInfo = YoutubeDL.getInstance().getInfo(url) var request = YoutubeDLRequest(url)
(mGKCookie?.COOKIES)?.let{
Blog.LOGE(it)
// request.addOption("--cookies-from-browser", "$it")
}
val videoInfo = YoutubeDL.getInstance().getInfo(request)
// videoInfo 가 null 아니고, 필요한 키(예: title, url 등)가 있으면 다운로드 가능 // videoInfo 가 null 아니고, 필요한 키(예: title, url 등)가 있으면 다운로드 가능
Blog.LOGE("checkIfDownloadable ${url}\n videoInfo : ${videoInfo}") Blog.LOGE("checkIfDownloadable ${url}\n videoInfo : ${videoInfo}")
var canVideoDown = videoInfo != null && !videoInfo.title.isNullOrEmpty() var canVideoDown = videoInfo != null && !videoInfo.title.isNullOrEmpty()