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) {
console.log('터치 시작');
});
document.addEventListener('touchend', function(e) {
autoScrollAndSave()
});
if(location.href.search("youtube") < 0) {
document.addEventListener('touchstart', function(e) {
console.log('터치 시작');
});
document.addEventListener('touchend', function(e) {
autoScrollAndSave()
});
}
function scrollToLazyImg(fastMode) {
(function(autoScrollAndSave){
// 한 번에 이동할 픽셀
@ -463,20 +464,17 @@ function ytDown() {
function handleCommon() {
// 공통 광고 제거
alert(JSON.stringify({COOKIES : document.cookie}))
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());
if (document.querySelector('#xpromo-bottom-sheet')) document.querySelector('#xpromo-bottom-sheet').remove();
document.querySelectorAll('iframe').forEach(e => {
const src = e.getAttribute("src");
if (src != null && (src.includes("ads") || src.includes("coupang"))) e.remove();
});
if (document.querySelectorAll('[data-banner^="coupang-"]')) {
document.querySelectorAll('[data-banner^="coupang-"]').forEach(e => e.remove())
}
if (document.querySelectorAll('[id^="mobonDivBanner"]')) {
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 = []
document.querySelectorAll('[class^="col-md-4 mb-4 video-item"]').forEach(function (e) {
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.YoutubeDLException
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 org.json.JSONObject
import org.jsoup.helper.DataUtil
@ -467,6 +470,9 @@ open class LauncherActivity : CommonActivity() {
try {
YoutubeDL.getInstance().init(this)
FFmpeg.getInstance().init(this);
CoroutineScope(Dispatchers.IO).launch {
YoutubeDL.getInstance().updateYoutubeDL(this@LauncherActivity)
}
} catch (e: YoutubeDLException) {
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)
.setContentTitle("BLE 서비스")
.setContentTitle("BUM'S 서비스")
.setContentText(str)
.setPriority(NotificationCompat.PRIORITY_MAX)
.setSmallIcon(R.drawable.ic_b)
@ -206,7 +206,7 @@ class ForeGroundService : Service() {
return null
}
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)
override fun onNotificationPosted(sbn: StatusBarNotification) {
Blog.LOGE("onNotificationPosted ${sbn}")
val notification = sbn.notification
val extras = notification.extras
val title = extras.getString(Notification.EXTRA_TITLE) ?: ""
val text = extras.getCharSequence(Notification.EXTRA_TEXT)?.toString() ?: ""
val bigText = extras.getCharSequence(Notification.EXTRA_BIG_TEXT)?.toString() ?: ""
val extraInfo = extras.getCharSequence(Notification.EXTRA_INFO_TEXT)?.toString() ?: ""
val subText = extras.getCharSequence(Notification.EXTRA_SUB_TEXT)?.toString() ?: ""
val conversationTitle = extras.getCharSequence(Notification.EXTRA_CONVERSATION_TITLE)?.toString() ?: ""
val summaryText = extras.getCharSequence(Notification.EXTRA_SUMMARY_TEXT)?.toString() ?: ""
val verificationText = extras.getCharSequence(Notification.EXTRA_VERIFICATION_TEXT)?.toString() ?: ""
val stringBuffer = StringBuffer()
stringBuffer.append(title).append("\n")
stringBuffer.append(text).append("\n")
stringBuffer.append(bigText).append("\n")
stringBuffer.append(extraInfo).append("\n")
stringBuffer.append(subText).append("\n")
stringBuffer.append(conversationTitle).append("\n")
stringBuffer.append(summaryText).append("\n")
stringBuffer.append(verificationText).append("\n")
Blog.LOGE("title >> ${title} text >> ${text} bigText >> ${bigText} extraInfo >> ${extraInfo} subText >> ${subText} conversationTitle >> ${conversationTitle} summaryText >> ${summaryText} verificationText >> ${verificationText}")
mHourlyLogWriter?.writeLog("${sbn.packageName}\n${stringBuffer.toString()}")
when (sbn.packageName){
"com.kakao.taxi" -> {
var defaultMsg : StringBuffer? = StringBuffer("돼지 택시 ")
if (stringBuffer.contains("택시") && stringBuffer.contains("탑승") && stringBuffer.contains("완료")) {
defaultMsg?.append("탔다요~!")
}else if(stringBuffer.contains("택시") && stringBuffer.contains("자동결제") && stringBuffer.contains("물건")) {
defaultMsg?.append("거의 다 왔다요~!")
}else if(stringBuffer.contains("택시") && stringBuffer.contains("도착") && stringBuffer.contains("선택")) {
defaultMsg?.append("내린다요~!")
} else {
defaultMsg = null
}
defaultMsg?.let {
makeMsgByTransferInfomation(it)
}
}
"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}")
if (sbn.packageName.contains("bums.lunatic.launcher") == false) {
val notification = sbn.notification
val extras = notification.extras
val title = extras.getString(Notification.EXTRA_TITLE) ?: ""
val text = extras.getCharSequence(Notification.EXTRA_TEXT)?.toString() ?: ""
val bigText = extras.getCharSequence(Notification.EXTRA_BIG_TEXT)?.toString() ?: ""
val extraInfo = extras.getCharSequence(Notification.EXTRA_INFO_TEXT)?.toString() ?: ""
val subText = extras.getCharSequence(Notification.EXTRA_SUB_TEXT)?.toString() ?: ""
val conversationTitle =
extras.getCharSequence(Notification.EXTRA_CONVERSATION_TITLE)?.toString() ?: ""
val summaryText =
extras.getCharSequence(Notification.EXTRA_SUMMARY_TEXT)?.toString() ?: ""
val verificationText =
extras.getCharSequence(Notification.EXTRA_VERIFICATION_TEXT)?.toString() ?: ""
val stringBuffer = StringBuffer()
stringBuffer.append(title).append("\n")
stringBuffer.append(text).append("\n")
stringBuffer.append(bigText).append("\n")
stringBuffer.append(extraInfo).append("\n")
stringBuffer.append(subText).append("\n")
stringBuffer.append(conversationTitle).append("\n")
stringBuffer.append(summaryText).append("\n")
stringBuffer.append(verificationText).append("\n")
Blog.LOGE("title >> ${title} text >> ${text} bigText >> ${bigText} extraInfo >> ${extraInfo} subText >> ${subText} conversationTitle >> ${conversationTitle} summaryText >> ${summaryText} verificationText >> ${verificationText}")
mHourlyLogWriter?.writeLog("${sbn.packageName}\n${stringBuffer.toString()}")
when (sbn.packageName) {
"com.kakao.taxi" -> {
var defaultMsg: StringBuffer? = StringBuffer("돼지 택시 ")
if (stringBuffer.contains("택시") && stringBuffer.contains("탑승") && stringBuffer.contains(
"완료"
)
) {
defaultMsg?.append("탔다요~!")
} else if (stringBuffer.contains("택시") && stringBuffer.contains("자동결제") && stringBuffer.contains(
"물건"
)
) {
defaultMsg?.append("거의 다 왔다요~!")
} else if (stringBuffer.contains("택시") && stringBuffer.contains("도착") && stringBuffer.contains(
"선택"
)
) {
defaultMsg?.append("내린다요~!")
} else {
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.tokiz.data.model.FakeSession
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.workers.WorkersDb
import com.google.gson.Gson
@ -71,6 +72,7 @@ import org.json.JSONObject
import org.mozilla.gecko.util.ThreadUtils
import org.mozilla.geckoview.GeckoResult
import org.mozilla.geckoview.GeckoSession
import org.mozilla.geckoview.GeckoSessionSettings
import org.mozilla.geckoview.MediaSession
import org.mozilla.geckoview.WebExtension
import org.mozilla.geckoview.WebExtension.MessageDelegate
@ -81,6 +83,7 @@ import java.lang.System.currentTimeMillis
import java.net.URL
import java.text.SimpleDateFormat
import java.util.Date
import java.util.UUID
import kotlin.collections.ArrayList
import kotlin.collections.List
import kotlin.collections.MutableList
@ -333,31 +336,40 @@ abstract class BaseToki : Fragment(), PagedTextViewInterface {
// No extension registered yet, let's ignore this message
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}")
val message: JSONObject = JSONObject()
try {
message.put("type", "getList")
message.put("event", "sadsadds")
message.put("tab", session.settings.screenId)
} catch (ex: JSONException) {
throw RuntimeException(ex)
}
mPort!!.postMessage(message)
when(this@BaseToki) {
is Comics , is Webtoons -> {
lastInfo
Blog.LOGE("onPageStop $success from WebExtension ${mPort!!.name}")
val message: JSONObject = JSONObject()
try {
message.put("type", "getList")
message.put("event", "sadsadds")
message.put("tab", session.settings.screenId)
} catch (ex: JSONException) {
throw RuntimeException(ex)
}
else -> {
mPort!!.postMessage(message)
when (this@BaseToki) {
is Comics, is Webtoons -> {
lastInfo
}
else -> {
}
}
}
binding.progress.visibility = GONE
}, 10L)
binding.progress.visibility = GONE
}, 10L)
}
}
}
}
@ -602,8 +614,29 @@ abstract class BaseToki : Fragment(), PagedTextViewInterface {
goToHome()
}
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.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.jxInteface = { jxEvent ->
Blog.LOGE("jxEvent $jxEvent")

View File

@ -3,6 +3,7 @@ package bums.lunatic.launcher.tokiz.view
import android.annotation.SuppressLint
import android.content.Context
import android.content.Intent
import android.net.Uri
import android.os.Build
import android.util.AttributeSet
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.SimpleFingerGestures
import com.yausername.youtubedl_android.YoutubeDL
import com.yausername.youtubedl_android.YoutubeDLRequest
import kotlinx.coroutines.CoroutineScope
import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.launch
import org.mozilla.gecko.util.ThreadUtils.runOnUiThread
import org.mozilla.geckoview.GeckoView
import java.io.File
import java.util.Base64
enum class JxEvent {
@ -79,6 +82,13 @@ open class BWebview : GeckoView {
context.startService(actionIntent)
}
}
class GKCookie {
var COOKIES : String? = null
}
var mGKCookie : GKCookie? = null
fun checkIfDownloadable(url: String) {
CoroutineScope(Dispatchers.Main).launch {
runOnUiThread {
@ -89,7 +99,13 @@ open class BWebview : GeckoView {
Blog.LOGE("checkIfDownloadable ${url}")
CoroutineScope(Dispatchers.IO).launch {
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 등)가 있으면 다운로드 가능
Blog.LOGE("checkIfDownloadable ${url}\n videoInfo : ${videoInfo}")
var canVideoDown = videoInfo != null && !videoInfo.title.isNullOrEmpty()