diff --git a/.gitignore b/.gitignore
index eb55b08..b7344cb 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,4 +1,15 @@
node_modules/
_*.png
+_*.mjs
_verify.mjs
.DS_Store
+dist/
+live_*.png
+android/build/
+android/.gradle/
+android/app/build/
+android/local.properties
+android/*.apk
+android/*.aab
+android/*.idsig
+android/*.keystore
diff --git a/.well-known/assetlinks.json b/.well-known/assetlinks.json
new file mode 100644
index 0000000..8f6ab20
--- /dev/null
+++ b/.well-known/assetlinks.json
@@ -0,0 +1,14 @@
+[
+ {
+ "relation": [
+ "delegate_permission/common.handle_all_urls"
+ ],
+ "target": {
+ "namespace": "android_app",
+ "package_name": "kr.tkrmagid.tetrig",
+ "sha256_cert_fingerprints": [
+ "A9:F1:B0:CB:B6:67:8A:BB:30:93:1D:01:C0:2A:B2:B6:A2:42:22:E0:90:38:C2:A9:1F:60:30:68:02:8F:DB:46"
+ ]
+ }
+ }
+]
diff --git a/README.md b/README.md
index 455345b..1782385 100644
--- a/README.md
+++ b/README.md
@@ -95,6 +95,31 @@ wrangler deploy # 배포
- Google OAuth 클라이언트 ID (Phase 4)
- 애드센스 계정 ID (Phase 7)
+## 배포
+
+웹(Cloudflare Pages) — `dist/` 에 `index.html`, `manifest.webmanifest`, `sw.js`,
+아이콘 3종, `.well-known/assetlinks.json` 을 담아 올린다.
+
+```bash
+node build.js
+wrangler pages deploy dist --project-name tetrig --branch main
+```
+
+안드로이드(Play Store) — `android/` 는 위 사이트를 감싸는 TWA(Trusted Web Activity)
+프로젝트다. 패키지는 `kr.tkrmagid.tetrig`. Bubblewrap 으로 빌드한다.
+
+```bash
+export JAVA_HOME=/usr/lib/jvm/java-17-openjdk-amd64 # Bubblewrap 은 JDK 17 고정
+export BUBBLEWRAP_KEYSTORE_PASSWORD=... BUBBLEWRAP_KEY_PASSWORD=...
+cd android && bubblewrap build --skipPwaValidation
+# → app-release-signed.apk (테스트 설치용), app-release-bundle.aab (Play 업로드용)
+```
+
+서명 키는 저장소에 넣지 않는다. 키를 바꾸면 `.well-known/assetlinks.json` 의
+SHA-256 지문도 같이 갱신해야 TWA 가 주소창 없이 전체화면으로 뜬다.
+Play App Signing 을 쓰면 Play Console 이 발급한 앱 서명 키 지문도
+assetlinks 에 함께 넣어야 한다.
+
## 구현 가드레일 (반드시 지킬 것)
- **IP 금지**: 사용자 노출 텍스트에 "Tetris/테트리스" 금지, 테트리스 음악(Korobeiniki 등) 금지, 표준 가이드라인 색상 1:1 복제 금지, TETR.IO 에셋·명칭 복제 금지.
diff --git a/android/app/build.gradle b/android/app/build.gradle
new file mode 100644
index 0000000..dc3ea5f
--- /dev/null
+++ b/android/app/build.gradle
@@ -0,0 +1,213 @@
+/*
+ * Copyright 2019 Google Inc.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+import groovy.xml.MarkupBuilder
+
+plugins {
+ id 'com.android.application'
+}
+
+def twaManifest = [
+ applicationId: 'kr.tkrmagid.tetrig',
+ hostName: 'tetrig.pages.dev', // The domain being opened in the TWA.
+ launchUrl: '/', // The start path for the TWA. Must be relative to the domain.
+ name: 'TETRIG', // The application name.
+ launcherName: 'TETRIG', // The name shown on the Android Launcher.
+ themeColor: '#17161B', // The color used for the status bar.
+ themeColorDark: '#000000', // The color used for the dark status bar.
+ navigationColor: '#000000', // The color used for the navigation bar.
+ navigationColorDark: '#000000', // The color used for the dark navbar.
+ navigationDividerColor: '#000000', // The navbar divider color.
+ navigationDividerColorDark: '#000000', // The dark navbar divider color.
+ backgroundColor: '#17161B', // The color used for the splash screen background.
+ enableNotifications: true, // Set to true to enable notification delegation.
+ // Every shortcut must include the following fields:
+ // - name: String that will show up in the shortcut.
+ // - short_name: Shorter string used if |name| is too long.
+ // - url: Absolute path of the URL to launch the app with (e.g '/create').
+ // - icon: Name of the resource in the drawable folder to use as an icon.
+ shortcuts: [],
+ // The duration of fade out animation in milliseconds to be played when removing splash screen.
+ splashScreenFadeOutDuration: 300,
+ generatorApp: 'bubblewrap-cli', // Application that generated the Android Project
+ // The fallback strategy for when Trusted Web Activity is not available. Possible values are
+ // 'customtabs' and 'webview'.
+ fallbackType: 'customtabs',
+ enableSiteSettingsShortcut: 'true',
+ orientation: 'portrait',
+]
+
+android {
+ compileSdkVersion 36
+ namespace "kr.tkrmagid.tetrig"
+ defaultConfig {
+ applicationId "kr.tkrmagid.tetrig"
+ minSdkVersion 21
+ targetSdkVersion 36
+ versionCode 1
+ versionName "1.0.0"
+
+ // The name for the application
+ resValue "string", "appName", twaManifest.name
+
+ // The name for the application on the Android Launcher
+ resValue "string", "launcherName", twaManifest.launcherName
+
+ // The URL that will be used when launching the TWA from the Android Launcher
+ def launchUrl = "https://" + twaManifest.hostName + twaManifest.launchUrl
+ resValue "string", "launchUrl", launchUrl
+
+
+
+
+ // The URL the Web Manifest for the Progressive Web App that the TWA points to. This
+ // is used by Chrome OS and Meta Quest to open the Web version of the PWA instead of
+ // the TWA, as it will probably give a better user experience for non-mobile devices.
+ resValue "string", "webManifestUrl", 'https://tetrig.pages.dev/manifest.webmanifest'
+
+
+
+ // This is used by Meta Quest.
+ resValue "string", "fullScopeUrl", 'https://tetrig.pages.dev/'
+
+
+
+
+ // The hostname is used when building the intent-filter, so the TWA is able to
+ // handle Intents to open host url of the application.
+ resValue "string", "hostName", twaManifest.hostName
+
+ // This attribute sets the status bar color for the TWA. It can be either set here or in
+ // `res/values/colors.xml`. Setting in both places is an error and the app will not
+ // compile. If not set, the status bar color defaults to #FFFFFF - white.
+ resValue "color", "colorPrimary", twaManifest.themeColor
+
+ // This attribute sets the dark status bar color for the TWA. It can be either set here or in
+ // `res/values/colors.xml`. Setting in both places is an error and the app will not
+ // compile. If not set, the status bar color defaults to #000000 - white.
+ resValue "color", "colorPrimaryDark", twaManifest.themeColorDark
+
+ // This attribute sets the navigation bar color for the TWA. It can be either set here or
+ // in `res/values/colors.xml`. Setting in both places is an error and the app will not
+ // compile. If not set, the navigation bar color defaults to #FFFFFF - white.
+ resValue "color", "navigationColor", twaManifest.navigationColor
+
+ // This attribute sets the dark navigation bar color for the TWA. It can be either set here
+ // or in `res/values/colors.xml`. Setting in both places is an error and the app will not
+ // compile. If not set, the navigation bar color defaults to #000000 - black.
+ resValue "color", "navigationColorDark", twaManifest.navigationColorDark
+
+ // This attribute sets the navbar divider color for the TWA. It can be either
+ // set here or in `res/values/colors.xml`. Setting in both places is an error and the app
+ // will not compile. If not set, the divider color defaults to #00000000 - transparent.
+ resValue "color", "navigationDividerColor", twaManifest.navigationDividerColor
+
+ // This attribute sets the dark navbar divider color for the TWA. It can be either
+ // set here or in `res/values/colors.xml`. Setting in both places is an error and the
+ //app will not compile. If not set, the divider color defaults to #000000 - black.
+ resValue "color", "navigationDividerColorDark", twaManifest.navigationDividerColorDark
+
+ // Sets the color for the background used for the splash screen when launching the
+ // Trusted Web Activity.
+ resValue "color", "backgroundColor", twaManifest.backgroundColor
+
+ // Defines a provider authority for the Splash Screen
+ resValue "string", "providerAuthority", twaManifest.applicationId + '.fileprovider'
+
+ // The enableNotification resource is used to enable or disable the
+ // TrustedWebActivityService, by changing the android:enabled and android:exported
+ // attributes
+ resValue "bool", "enableNotification", twaManifest.enableNotifications.toString()
+
+ twaManifest.shortcuts.eachWithIndex { shortcut, index ->
+ resValue "string", "shortcut_name_$index", "$shortcut.name"
+ resValue "string", "shortcut_short_name_$index", "$shortcut.short_name"
+ }
+
+ // The splashScreenFadeOutDuration resource is used to set the duration of fade out animation in milliseconds
+ // to be played when removing splash screen. The default is 0 (no animation).
+ resValue "integer", "splashScreenFadeOutDuration", twaManifest.splashScreenFadeOutDuration.toString()
+
+ resValue "string", "generatorApp", twaManifest.generatorApp
+
+ resValue "string", "fallbackType", twaManifest.fallbackType
+
+ resValue "bool", "enableSiteSettingsShortcut", twaManifest.enableSiteSettingsShortcut
+ resValue "string", "orientation", twaManifest.orientation
+
+
+ }
+ buildTypes {
+ release {
+ minifyEnabled true
+ }
+ }
+ compileOptions {
+ sourceCompatibility JavaVersion.VERSION_1_8
+ targetCompatibility JavaVersion.VERSION_1_8
+ }
+ lintOptions {
+ checkReleaseBuilds false
+ }
+}
+
+task generateShorcutsFile {
+ assert twaManifest.shortcuts.size() < 5, "You can have at most 4 shortcuts."
+ twaManifest.shortcuts.eachWithIndex { s, i ->
+ assert s.name != null, 'Missing `name` in shortcut #' + i
+ assert s.short_name != null, 'Missing `short_name` in shortcut #' + i
+ assert s.url != null, 'Missing `icon` in shortcut #' + i
+ assert s.icon != null, 'Missing `url` in shortcut #' + i
+ }
+
+ def shortcutsFile = new File("$projectDir/src/main/res/xml", "shortcuts.xml")
+
+ def xmlWriter = new StringWriter()
+ def xmlMarkup = new MarkupBuilder(new IndentPrinter(xmlWriter, " ", true))
+
+ xmlMarkup
+ .'shortcuts'('xmlns:android': 'http://schemas.android.com/apk/res/android') {
+ twaManifest.shortcuts.eachWithIndex { s, i ->
+ 'shortcut'(
+ 'android:shortcutId': 'shortcut' + i,
+ 'android:enabled': 'true',
+ 'android:icon': '@drawable/' + s.icon,
+ 'android:shortcutShortLabel': '@string/shortcut_short_name_' + i,
+ 'android:shortcutLongLabel': '@string/shortcut_name_' + i) {
+ 'intent'(
+ 'android:action': 'android.intent.action.MAIN',
+ 'android:targetPackage': twaManifest.applicationId,
+ 'android:targetClass': twaManifest.applicationId + '.LauncherActivity',
+ 'android:data': s.url)
+ 'categories'('android:name': 'android.intent.category.LAUNCHER')
+ }
+ }
+ }
+ shortcutsFile.text = xmlWriter.toString() + '\n'
+}
+
+preBuild.dependsOn(generateShorcutsFile)
+
+repositories {
+
+}
+
+dependencies {
+ implementation fileTree(include: ['*.jar'], dir: 'libs')
+
+ implementation 'com.google.androidbrowserhelper:androidbrowserhelper:2.6.2'
+
+}
diff --git a/android/app/src/main/AndroidManifest.xml b/android/app/src/main/AndroidManifest.xml
new file mode 100644
index 0000000..04a7711
--- /dev/null
+++ b/android/app/src/main/AndroidManifest.xml
@@ -0,0 +1,200 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/android/app/src/main/java/kr/tkrmagid/tetrig/Application.java b/android/app/src/main/java/kr/tkrmagid/tetrig/Application.java
new file mode 100644
index 0000000..b060915
--- /dev/null
+++ b/android/app/src/main/java/kr/tkrmagid/tetrig/Application.java
@@ -0,0 +1,29 @@
+/*
+ * Copyright 2020 Google Inc.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package kr.tkrmagid.tetrig;
+
+
+
+public class Application extends android.app.Application {
+
+
+
+ @Override
+ public void onCreate() {
+ super.onCreate();
+
+ }
+}
diff --git a/android/app/src/main/java/kr/tkrmagid/tetrig/DelegationService.java b/android/app/src/main/java/kr/tkrmagid/tetrig/DelegationService.java
new file mode 100644
index 0000000..72303f8
--- /dev/null
+++ b/android/app/src/main/java/kr/tkrmagid/tetrig/DelegationService.java
@@ -0,0 +1,14 @@
+package kr.tkrmagid.tetrig;
+
+
+
+public class DelegationService extends
+ com.google.androidbrowserhelper.trusted.DelegationService {
+ @Override
+ public void onCreate() {
+ super.onCreate();
+
+
+ }
+}
+
diff --git a/android/app/src/main/java/kr/tkrmagid/tetrig/LauncherActivity.java b/android/app/src/main/java/kr/tkrmagid/tetrig/LauncherActivity.java
new file mode 100644
index 0000000..2d7ceed
--- /dev/null
+++ b/android/app/src/main/java/kr/tkrmagid/tetrig/LauncherActivity.java
@@ -0,0 +1,54 @@
+/*
+ * Copyright 2020 Google Inc.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package kr.tkrmagid.tetrig;
+
+import android.content.pm.ActivityInfo;
+import android.net.Uri;
+import android.os.Build;
+import android.os.Bundle;
+
+
+
+public class LauncherActivity
+ extends com.google.androidbrowserhelper.trusted.LauncherActivity {
+
+
+
+
+ @Override
+ protected void onCreate(Bundle savedInstanceState) {
+ super.onCreate(savedInstanceState);
+ // Setting an orientation crashes the app due to the transparent background on Android 8.0
+ // Oreo and below. We only set the orientation on Oreo and above. This only affects the
+ // splash screen and Chrome will still respect the orientation.
+ // See https://github.com/GoogleChromeLabs/bubblewrap/issues/496 for details.
+ if (Build.VERSION.SDK_INT > Build.VERSION_CODES.O) {
+ setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_USER_PORTRAIT);
+ } else {
+ setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_UNSPECIFIED);
+ }
+ }
+
+ @Override
+ protected Uri getLaunchingUrl() {
+ // Get the original launch Url.
+ Uri uri = super.getLaunchingUrl();
+
+
+
+ return uri;
+ }
+}
diff --git a/android/app/src/main/res/drawable-anydpi/shortcut_legacy_background.xml b/android/app/src/main/res/drawable-anydpi/shortcut_legacy_background.xml
new file mode 100644
index 0000000..d53c148
--- /dev/null
+++ b/android/app/src/main/res/drawable-anydpi/shortcut_legacy_background.xml
@@ -0,0 +1,25 @@
+
+
+
+
+
+
+
+
+
diff --git a/android/app/src/main/res/drawable-hdpi/ic_notification_icon.png b/android/app/src/main/res/drawable-hdpi/ic_notification_icon.png
new file mode 100644
index 0000000..6c24d0c
Binary files /dev/null and b/android/app/src/main/res/drawable-hdpi/ic_notification_icon.png differ
diff --git a/android/app/src/main/res/drawable-hdpi/splash.png b/android/app/src/main/res/drawable-hdpi/splash.png
new file mode 100644
index 0000000..afc8fc4
Binary files /dev/null and b/android/app/src/main/res/drawable-hdpi/splash.png differ
diff --git a/android/app/src/main/res/drawable-mdpi/ic_notification_icon.png b/android/app/src/main/res/drawable-mdpi/ic_notification_icon.png
new file mode 100644
index 0000000..b724614
Binary files /dev/null and b/android/app/src/main/res/drawable-mdpi/ic_notification_icon.png differ
diff --git a/android/app/src/main/res/drawable-mdpi/splash.png b/android/app/src/main/res/drawable-mdpi/splash.png
new file mode 100644
index 0000000..1dfadc3
Binary files /dev/null and b/android/app/src/main/res/drawable-mdpi/splash.png differ
diff --git a/android/app/src/main/res/drawable-xhdpi/ic_notification_icon.png b/android/app/src/main/res/drawable-xhdpi/ic_notification_icon.png
new file mode 100644
index 0000000..6b74f2c
Binary files /dev/null and b/android/app/src/main/res/drawable-xhdpi/ic_notification_icon.png differ
diff --git a/android/app/src/main/res/drawable-xhdpi/splash.png b/android/app/src/main/res/drawable-xhdpi/splash.png
new file mode 100644
index 0000000..7608f28
Binary files /dev/null and b/android/app/src/main/res/drawable-xhdpi/splash.png differ
diff --git a/android/app/src/main/res/drawable-xxhdpi/ic_notification_icon.png b/android/app/src/main/res/drawable-xxhdpi/ic_notification_icon.png
new file mode 100644
index 0000000..013a7d1
Binary files /dev/null and b/android/app/src/main/res/drawable-xxhdpi/ic_notification_icon.png differ
diff --git a/android/app/src/main/res/drawable-xxhdpi/splash.png b/android/app/src/main/res/drawable-xxhdpi/splash.png
new file mode 100644
index 0000000..0b0dce4
Binary files /dev/null and b/android/app/src/main/res/drawable-xxhdpi/splash.png differ
diff --git a/android/app/src/main/res/drawable-xxxhdpi/ic_notification_icon.png b/android/app/src/main/res/drawable-xxxhdpi/ic_notification_icon.png
new file mode 100644
index 0000000..8d71436
Binary files /dev/null and b/android/app/src/main/res/drawable-xxxhdpi/ic_notification_icon.png differ
diff --git a/android/app/src/main/res/drawable-xxxhdpi/splash.png b/android/app/src/main/res/drawable-xxxhdpi/splash.png
new file mode 100644
index 0000000..1c3482c
Binary files /dev/null and b/android/app/src/main/res/drawable-xxxhdpi/splash.png differ
diff --git a/android/app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml b/android/app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml
new file mode 100644
index 0000000..0480797
--- /dev/null
+++ b/android/app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml
@@ -0,0 +1,33 @@
+
+
+
+
+
+
+
+
+
+
+
diff --git a/android/app/src/main/res/mipmap-hdpi/ic_launcher.png b/android/app/src/main/res/mipmap-hdpi/ic_launcher.png
new file mode 100644
index 0000000..013a7d1
Binary files /dev/null and b/android/app/src/main/res/mipmap-hdpi/ic_launcher.png differ
diff --git a/android/app/src/main/res/mipmap-hdpi/ic_maskable.png b/android/app/src/main/res/mipmap-hdpi/ic_maskable.png
new file mode 100644
index 0000000..3b7301f
Binary files /dev/null and b/android/app/src/main/res/mipmap-hdpi/ic_maskable.png differ
diff --git a/android/app/src/main/res/mipmap-mdpi/ic_launcher.png b/android/app/src/main/res/mipmap-mdpi/ic_launcher.png
new file mode 100644
index 0000000..6b74f2c
Binary files /dev/null and b/android/app/src/main/res/mipmap-mdpi/ic_launcher.png differ
diff --git a/android/app/src/main/res/mipmap-mdpi/ic_maskable.png b/android/app/src/main/res/mipmap-mdpi/ic_maskable.png
new file mode 100644
index 0000000..7adb207
Binary files /dev/null and b/android/app/src/main/res/mipmap-mdpi/ic_maskable.png differ
diff --git a/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png b/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png
new file mode 100644
index 0000000..8d71436
Binary files /dev/null and b/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png differ
diff --git a/android/app/src/main/res/mipmap-xhdpi/ic_maskable.png b/android/app/src/main/res/mipmap-xhdpi/ic_maskable.png
new file mode 100644
index 0000000..c130d97
Binary files /dev/null and b/android/app/src/main/res/mipmap-xhdpi/ic_maskable.png differ
diff --git a/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png b/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png
new file mode 100644
index 0000000..ca5fcaf
Binary files /dev/null and b/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png differ
diff --git a/android/app/src/main/res/mipmap-xxhdpi/ic_maskable.png b/android/app/src/main/res/mipmap-xxhdpi/ic_maskable.png
new file mode 100644
index 0000000..1ae8ad2
Binary files /dev/null and b/android/app/src/main/res/mipmap-xxhdpi/ic_maskable.png differ
diff --git a/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png b/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png
new file mode 100644
index 0000000..ea26270
Binary files /dev/null and b/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png differ
diff --git a/android/app/src/main/res/mipmap-xxxhdpi/ic_maskable.png b/android/app/src/main/res/mipmap-xxxhdpi/ic_maskable.png
new file mode 100644
index 0000000..fd9be59
Binary files /dev/null and b/android/app/src/main/res/mipmap-xxxhdpi/ic_maskable.png differ
diff --git a/android/app/src/main/res/raw/web_app_manifest.json b/android/app/src/main/res/raw/web_app_manifest.json
new file mode 100644
index 0000000..8c73d35
--- /dev/null
+++ b/android/app/src/main/res/raw/web_app_manifest.json
@@ -0,0 +1 @@
+{"name":"TETRIG","short_name":"TETRIG","description":"실시간 대전 블록 스태커 — 솔로·커스텀·랭크 리그전","lang":"ko","start_url":"/index.html","scope":"./","display":"standalone","orientation":"portrait","background_color":"#17161B","theme_color":"#17161B","icons":[{"src":"icon-192.png","sizes":"192x192","type":"image/png"},{"src":"icon-512.png","sizes":"512x512","type":"image/png"},{"src":"icon-512.png","sizes":"512x512","type":"image/png","purpose":"maskable"}]}
\ No newline at end of file
diff --git a/android/app/src/main/res/values/colors.xml b/android/app/src/main/res/values/colors.xml
new file mode 100644
index 0000000..e66222d
--- /dev/null
+++ b/android/app/src/main/res/values/colors.xml
@@ -0,0 +1,18 @@
+
+
+ #F5F5F5
+
diff --git a/android/app/src/main/res/values/strings.xml b/android/app/src/main/res/values/strings.xml
new file mode 100644
index 0000000..642eb69
--- /dev/null
+++ b/android/app/src/main/res/values/strings.xml
@@ -0,0 +1,42 @@
+
+
+
+
+
+
+
+
+
+
+ [{
+ \"relation\": [\"delegate_permission/common.handle_all_urls\"],
+ \"target\": {
+ \"namespace\": \"web\",
+ \"site\": \"https://tetrig.pages.dev\"
+ }
+ }]
+
+
+
diff --git a/android/app/src/main/res/xml/filepaths.xml b/android/app/src/main/res/xml/filepaths.xml
new file mode 100644
index 0000000..a543485
--- /dev/null
+++ b/android/app/src/main/res/xml/filepaths.xml
@@ -0,0 +1,18 @@
+
+
+
+
diff --git a/android/app/src/main/res/xml/shortcuts.xml b/android/app/src/main/res/xml/shortcuts.xml
new file mode 100644
index 0000000..5effdb1
--- /dev/null
+++ b/android/app/src/main/res/xml/shortcuts.xml
@@ -0,0 +1 @@
+
diff --git a/android/build.gradle b/android/build.gradle
new file mode 100644
index 0000000..dc22923
--- /dev/null
+++ b/android/build.gradle
@@ -0,0 +1,42 @@
+/*
+ * Copyright 2019 Google Inc.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+// Top-level build file where you can add configuration options common to all sub-projects/modules.
+
+buildscript {
+
+ repositories {
+ google()
+ mavenCentral()
+ }
+ dependencies {
+ classpath 'com.android.tools.build:gradle:8.9.1'
+
+ // NOTE: Do not place your application dependencies here; they belong
+ // in the individual module build.gradle files
+ }
+}
+
+allprojects {
+ repositories {
+ google()
+ mavenCentral()
+ }
+}
+
+task clean(type: Delete) {
+ delete rootProject.buildDir
+}
diff --git a/android/gradle.properties b/android/gradle.properties
new file mode 100644
index 0000000..784a1d4
--- /dev/null
+++ b/android/gradle.properties
@@ -0,0 +1,14 @@
+# Project-wide Gradle settings.
+# IDE (e.g. Android Studio) users:
+# Gradle settings configured through the IDE *will override*
+# any settings specified in this file.
+# For more details on how to configure your build environment visit
+# http://www.gradle.org/docs/current/userguide/build_environment.html
+# Specifies the JVM arguments used for the daemon process.
+# The setting is particularly useful for tweaking memory settings.
+org.gradle.jvmargs=-Xmx1536m
+# When configured, Gradle will run in incubating parallel mode.
+# This option should only be used with decoupled projects. More details, visit
+# http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects
+# org.gradle.parallel=true
+android.useAndroidX=true
diff --git a/android/gradle/wrapper/gradle-wrapper.jar b/android/gradle/wrapper/gradle-wrapper.jar
new file mode 100644
index 0000000..5c2d1cf
Binary files /dev/null and b/android/gradle/wrapper/gradle-wrapper.jar differ
diff --git a/android/gradle/wrapper/gradle-wrapper.properties b/android/gradle/wrapper/gradle-wrapper.properties
new file mode 100644
index 0000000..719e736
--- /dev/null
+++ b/android/gradle/wrapper/gradle-wrapper.properties
@@ -0,0 +1,7 @@
+distributionBase=GRADLE_USER_HOME
+distributionPath=wrapper/dists
+zipStoreBase=GRADLE_USER_HOME
+zipStorePath=wrapper/dists
+distributionUrl=https\://services.gradle.org/distributions/gradle-8.11.1-bin.zip
+networkTimeout=10000
+validateDistributionUrl=true
diff --git a/android/gradlew b/android/gradlew
new file mode 100755
index 0000000..b740cf1
--- /dev/null
+++ b/android/gradlew
@@ -0,0 +1,249 @@
+#!/bin/sh
+
+#
+# Copyright © 2015-2021 the original authors.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# https://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+##############################################################################
+#
+# Gradle start up script for POSIX generated by Gradle.
+#
+# Important for running:
+#
+# (1) You need a POSIX-compliant shell to run this script. If your /bin/sh is
+# noncompliant, but you have some other compliant shell such as ksh or
+# bash, then to run this script, type that shell name before the whole
+# command line, like:
+#
+# ksh Gradle
+#
+# Busybox and similar reduced shells will NOT work, because this script
+# requires all of these POSIX shell features:
+# * functions;
+# * expansions «$var», «${var}», «${var:-default}», «${var+SET}»,
+# «${var#prefix}», «${var%suffix}», and «$( cmd )»;
+# * compound commands having a testable exit status, especially «case»;
+# * various built-in commands including «command», «set», and «ulimit».
+#
+# Important for patching:
+#
+# (2) This script targets any POSIX shell, so it avoids extensions provided
+# by Bash, Ksh, etc; in particular arrays are avoided.
+#
+# The "traditional" practice of packing multiple parameters into a
+# space-separated string is a well documented source of bugs and security
+# problems, so this is (mostly) avoided, by progressively accumulating
+# options in "$@", and eventually passing that to Java.
+#
+# Where the inherited environment variables (DEFAULT_JVM_OPTS, JAVA_OPTS,
+# and GRADLE_OPTS) rely on word-splitting, this is performed explicitly;
+# see the in-line comments for details.
+#
+# There are tweaks for specific operating systems such as AIX, CygWin,
+# Darwin, MinGW, and NonStop.
+#
+# (3) This script is generated from the Groovy template
+# https://github.com/gradle/gradle/blob/HEAD/platforms/jvm/plugins-application/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt
+# within the Gradle project.
+#
+# You can find Gradle at https://github.com/gradle/gradle/.
+#
+##############################################################################
+
+# Attempt to set APP_HOME
+
+# Resolve links: $0 may be a link
+app_path=$0
+
+# Need this for daisy-chained symlinks.
+while
+ APP_HOME=${app_path%"${app_path##*/}"} # leaves a trailing /; empty if no leading path
+ [ -h "$app_path" ]
+do
+ ls=$( ls -ld "$app_path" )
+ link=${ls#*' -> '}
+ case $link in #(
+ /*) app_path=$link ;; #(
+ *) app_path=$APP_HOME$link ;;
+ esac
+done
+
+# This is normally unused
+# shellcheck disable=SC2034
+APP_BASE_NAME=${0##*/}
+# Discard cd standard output in case $CDPATH is set (https://github.com/gradle/gradle/issues/25036)
+APP_HOME=$( cd "${APP_HOME:-./}" > /dev/null && pwd -P ) || exit
+
+# Use the maximum available, or set MAX_FD != -1 to use that value.
+MAX_FD=maximum
+
+warn () {
+ echo "$*"
+} >&2
+
+die () {
+ echo
+ echo "$*"
+ echo
+ exit 1
+} >&2
+
+# OS specific support (must be 'true' or 'false').
+cygwin=false
+msys=false
+darwin=false
+nonstop=false
+case "$( uname )" in #(
+ CYGWIN* ) cygwin=true ;; #(
+ Darwin* ) darwin=true ;; #(
+ MSYS* | MINGW* ) msys=true ;; #(
+ NONSTOP* ) nonstop=true ;;
+esac
+
+CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
+
+
+# Determine the Java command to use to start the JVM.
+if [ -n "$JAVA_HOME" ] ; then
+ if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
+ # IBM's JDK on AIX uses strange locations for the executables
+ JAVACMD=$JAVA_HOME/jre/sh/java
+ else
+ JAVACMD=$JAVA_HOME/bin/java
+ fi
+ if [ ! -x "$JAVACMD" ] ; then
+ die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
+
+Please set the JAVA_HOME variable in your environment to match the
+location of your Java installation."
+ fi
+else
+ JAVACMD=java
+ if ! command -v java >/dev/null 2>&1
+ then
+ die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
+
+Please set the JAVA_HOME variable in your environment to match the
+location of your Java installation."
+ fi
+fi
+
+# Increase the maximum file descriptors if we can.
+if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then
+ case $MAX_FD in #(
+ max*)
+ # In POSIX sh, ulimit -H is undefined. That's why the result is checked to see if it worked.
+ # shellcheck disable=SC2039,SC3045
+ MAX_FD=$( ulimit -H -n ) ||
+ warn "Could not query maximum file descriptor limit"
+ esac
+ case $MAX_FD in #(
+ '' | soft) :;; #(
+ *)
+ # In POSIX sh, ulimit -n is undefined. That's why the result is checked to see if it worked.
+ # shellcheck disable=SC2039,SC3045
+ ulimit -n "$MAX_FD" ||
+ warn "Could not set maximum file descriptor limit to $MAX_FD"
+ esac
+fi
+
+# Collect all arguments for the java command, stacking in reverse order:
+# * args from the command line
+# * the main class name
+# * -classpath
+# * -D...appname settings
+# * --module-path (only if needed)
+# * DEFAULT_JVM_OPTS, JAVA_OPTS, and GRADLE_OPTS environment variables.
+
+# For Cygwin or MSYS, switch paths to Windows format before running java
+if "$cygwin" || "$msys" ; then
+ APP_HOME=$( cygpath --path --mixed "$APP_HOME" )
+ CLASSPATH=$( cygpath --path --mixed "$CLASSPATH" )
+
+ JAVACMD=$( cygpath --unix "$JAVACMD" )
+
+ # Now convert the arguments - kludge to limit ourselves to /bin/sh
+ for arg do
+ if
+ case $arg in #(
+ -*) false ;; # don't mess with options #(
+ /?*) t=${arg#/} t=/${t%%/*} # looks like a POSIX filepath
+ [ -e "$t" ] ;; #(
+ *) false ;;
+ esac
+ then
+ arg=$( cygpath --path --ignore --mixed "$arg" )
+ fi
+ # Roll the args list around exactly as many times as the number of
+ # args, so each arg winds up back in the position where it started, but
+ # possibly modified.
+ #
+ # NB: a `for` loop captures its iteration list before it begins, so
+ # changing the positional parameters here affects neither the number of
+ # iterations, nor the values presented in `arg`.
+ shift # remove old arg
+ set -- "$@" "$arg" # push replacement arg
+ done
+fi
+
+
+# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
+DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
+
+# Collect all arguments for the java command:
+# * DEFAULT_JVM_OPTS, JAVA_OPTS, JAVA_OPTS, and optsEnvironmentVar are not allowed to contain shell fragments,
+# and any embedded shellness will be escaped.
+# * For example: A user cannot expect ${Hostname} to be expanded, as it is an environment variable and will be
+# treated as '${Hostname}' itself on the command line.
+
+set -- \
+ "-Dorg.gradle.appname=$APP_BASE_NAME" \
+ -classpath "$CLASSPATH" \
+ org.gradle.wrapper.GradleWrapperMain \
+ "$@"
+
+# Stop when "xargs" is not available.
+if ! command -v xargs >/dev/null 2>&1
+then
+ die "xargs is not available"
+fi
+
+# Use "xargs" to parse quoted args.
+#
+# With -n1 it outputs one arg per line, with the quotes and backslashes removed.
+#
+# In Bash we could simply go:
+#
+# readarray ARGS < <( xargs -n1 <<<"$var" ) &&
+# set -- "${ARGS[@]}" "$@"
+#
+# but POSIX shell has neither arrays nor command substitution, so instead we
+# post-process each arg (as a line of input to sed) to backslash-escape any
+# character that might be a shell metacharacter, then use eval to reverse
+# that process (while maintaining the separation between arguments), and wrap
+# the whole thing up as a single "set" statement.
+#
+# This will of course break if any of these variables contains a newline or
+# an unmatched quote.
+#
+
+eval "set -- $(
+ printf '%s\n' "$DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS" |
+ xargs -n1 |
+ sed ' s~[^-[:alnum:]+,./:=@_]~\\&~g; ' |
+ tr '\n' ' '
+ )" '"$@"'
+
+exec "$JAVACMD" "$@"
diff --git a/android/gradlew.bat b/android/gradlew.bat
new file mode 100644
index 0000000..7101f8e
--- /dev/null
+++ b/android/gradlew.bat
@@ -0,0 +1,92 @@
+@rem
+@rem Copyright 2015 the original author or authors.
+@rem
+@rem Licensed under the Apache License, Version 2.0 (the "License");
+@rem you may not use this file except in compliance with the License.
+@rem You may obtain a copy of the License at
+@rem
+@rem https://www.apache.org/licenses/LICENSE-2.0
+@rem
+@rem Unless required by applicable law or agreed to in writing, software
+@rem distributed under the License is distributed on an "AS IS" BASIS,
+@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+@rem See the License for the specific language governing permissions and
+@rem limitations under the License.
+@rem
+
+@if "%DEBUG%"=="" @echo off
+@rem ##########################################################################
+@rem
+@rem Gradle startup script for Windows
+@rem
+@rem ##########################################################################
+
+@rem Set local scope for the variables with windows NT shell
+if "%OS%"=="Windows_NT" setlocal
+
+set DIRNAME=%~dp0
+if "%DIRNAME%"=="" set DIRNAME=.
+@rem This is normally unused
+set APP_BASE_NAME=%~n0
+set APP_HOME=%DIRNAME%
+
+@rem Resolve any "." and ".." in APP_HOME to make it shorter.
+for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi
+
+@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
+set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m"
+
+@rem Find java.exe
+if defined JAVA_HOME goto findJavaFromJavaHome
+
+set JAVA_EXE=java.exe
+%JAVA_EXE% -version >NUL 2>&1
+if %ERRORLEVEL% equ 0 goto execute
+
+echo. 1>&2
+echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 1>&2
+echo. 1>&2
+echo Please set the JAVA_HOME variable in your environment to match the 1>&2
+echo location of your Java installation. 1>&2
+
+goto fail
+
+:findJavaFromJavaHome
+set JAVA_HOME=%JAVA_HOME:"=%
+set JAVA_EXE=%JAVA_HOME%/bin/java.exe
+
+if exist "%JAVA_EXE%" goto execute
+
+echo. 1>&2
+echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% 1>&2
+echo. 1>&2
+echo Please set the JAVA_HOME variable in your environment to match the 1>&2
+echo location of your Java installation. 1>&2
+
+goto fail
+
+:execute
+@rem Setup the command line
+
+set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
+
+
+@rem Execute Gradle
+"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %*
+
+:end
+@rem End local scope for the variables with windows NT shell
+if %ERRORLEVEL% equ 0 goto mainEnd
+
+:fail
+rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
+rem the _cmd.exe /c_ return code!
+set EXIT_CODE=%ERRORLEVEL%
+if %EXIT_CODE% equ 0 set EXIT_CODE=1
+if not ""=="%GRADLE_EXIT_CONSOLE%" exit %EXIT_CODE%
+exit /b %EXIT_CODE%
+
+:mainEnd
+if "%OS%"=="Windows_NT" endlocal
+
+:omega
diff --git a/android/manifest-checksum.txt b/android/manifest-checksum.txt
new file mode 100644
index 0000000..7c0a74e
--- /dev/null
+++ b/android/manifest-checksum.txt
@@ -0,0 +1 @@
+ea4a002f690d4240040c3d431c1203eca46cc9a5
\ No newline at end of file
diff --git a/android/settings.gradle b/android/settings.gradle
new file mode 100644
index 0000000..e7b4def
--- /dev/null
+++ b/android/settings.gradle
@@ -0,0 +1 @@
+include ':app'
diff --git a/android/twa-manifest.json b/android/twa-manifest.json
new file mode 100644
index 0000000..13acbec
--- /dev/null
+++ b/android/twa-manifest.json
@@ -0,0 +1,47 @@
+{
+ "packageId": "kr.tkrmagid.tetrig",
+ "host": "tetrig.pages.dev",
+ "name": "TETRIG",
+ "launcherName": "TETRIG",
+ "display": "standalone",
+ "themeColor": "#17161B",
+ "themeColorDark": "#000000",
+ "navigationColor": "#000000",
+ "navigationColorDark": "#000000",
+ "navigationDividerColor": "#000000",
+ "navigationDividerColorDark": "#000000",
+ "backgroundColor": "#17161B",
+ "enableNotifications": true,
+ "startUrl": "/",
+ "iconUrl": "https://tetrig.pages.dev/icon-512.png",
+ "maskableIconUrl": "https://tetrig.pages.dev/icon-512.png",
+ "splashScreenFadeOutDuration": 300,
+ "signingKey": {
+ "path": "/home/claude/.config/ejclaw/tetrig.keystore",
+ "alias": "tetrig"
+ },
+ "appVersionName": "1.0.0",
+ "appVersionCode": 1,
+ "shortcuts": [],
+ "generatorApp": "bubblewrap-cli",
+ "webManifestUrl": "https://tetrig.pages.dev/manifest.webmanifest",
+ "fallbackType": "customtabs",
+ "features": {},
+ "alphaDependencies": {
+ "enabled": false
+ },
+ "enableSiteSettingsShortcut": true,
+ "isChromeOSOnly": false,
+ "isMetaQuest": false,
+ "fullScopeUrl": "https://tetrig.pages.dev/",
+ "minSdkVersion": 21,
+ "orientation": "portrait",
+ "fingerprints": [],
+ "additionalTrustedOrigins": [],
+ "retainedBundles": [],
+ "protocolHandlers": [],
+ "fileHandlers": [],
+ "launchHandlerClientMode": "",
+ "displayOverride": [],
+ "appVersion": "1.0.0"
+}
\ No newline at end of file
diff --git a/manifest.webmanifest b/manifest.webmanifest
index 95d9960..7ba2353 100644
--- a/manifest.webmanifest
+++ b/manifest.webmanifest
@@ -3,7 +3,7 @@
"short_name": "TETRIG",
"description": "실시간 대전 블록 스태커 — 솔로·커스텀·랭크 리그전",
"lang": "ko",
- "start_url": "./index.html",
+ "start_url": "./",
"scope": "./",
"display": "standalone",
"orientation": "portrait",
diff --git a/sw.js b/sw.js
index 55f5b00..c6fa5bc 100644
--- a/sw.js
+++ b/sw.js
@@ -1,16 +1,27 @@
// TETRIG 서비스 워커 — 오프라인 캐시 (앱처럼 설치/실행)
-const CACHE = 'tetrig-v1';
+const CACHE = 'tetrig-v2';
const ASSETS = [
'./',
- './index.html',
'./manifest.webmanifest',
'./icon-192.png',
'./icon-512.png',
'./apple-touch-icon.png',
];
+// Cloudflare Pages 는 /index.html 을 / 로 308 리다이렉트한다.
+// 리다이렉트된 Response 를 그대로 캐시하면 navigation 요청에 응답할 수 없어
+// (spec 상 금지) 두 번째 실행부터 ERR_FAILED 가 난다. 새 Response 로 복사해 저장한다.
+async function cacheClean(cache, url) {
+ const res = await fetch(url, { cache: 'reload' });
+ if (!res.ok) return;
+ const body = await res.blob();
+ await cache.put(url, new Response(body, { status: 200, statusText: 'OK', headers: res.headers }));
+}
+
self.addEventListener('install', (e) => {
- e.waitUntil(caches.open(CACHE).then((c) => c.addAll(ASSETS)));
+ e.waitUntil(
+ caches.open(CACHE).then((c) => Promise.all(ASSETS.map((u) => cacheClean(c, u))))
+ );
self.skipWaiting();
});
@@ -23,10 +34,17 @@ self.addEventListener('activate', (e) => {
self.clients.claim();
});
-// 캐시 우선, 없으면 네트워크 (게임은 정적이라 오프라인 완전 동작)
self.addEventListener('fetch', (e) => {
if (e.request.method !== 'GET') return;
- e.respondWith(
- caches.match(e.request).then((r) => r || fetch(e.request))
- );
+
+ // 페이지 진입: 네트워크 우선, 실패하면 캐시된 시작 문서로 오프라인 동작
+ if (e.request.mode === 'navigate') {
+ e.respondWith(
+ fetch(e.request).catch(async () => (await caches.match('./')) || Response.error())
+ );
+ return;
+ }
+
+ // 나머지 정적 에셋: 캐시 우선
+ e.respondWith(caches.match(e.request).then((r) => r || fetch(e.request)));
});