pelulu-cli 1.0.1 → 1.0.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/src/index.js +11 -4
- package/src/mcp/activation.js +2 -5
- package/DailyNotesApp/app/build.gradle.kts +0 -57
- package/DailyNotesApp/app/src/main/java/com/dailynotes/app/MainActivity.kt +0 -48
- package/DailyNotesApp/app/src/main/java/com/dailynotes/app/Note.kt +0 -13
- package/DailyNotesApp/app/src/main/java/com/dailynotes/app/NoteDatabase.kt +0 -9
- package/DailyNotesApp/build.gradle.kts +0 -5
- package/DailyNotesApp/settings.gradle.kts +0 -17
package/package.json
CHANGED
package/src/index.js
CHANGED
|
@@ -101,10 +101,17 @@ async function main() {
|
|
|
101
101
|
const mqtt = new MqttClient(config);
|
|
102
102
|
|
|
103
103
|
bus.on('activation:required', ({ code }) => {
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
104
|
+
// Display DIRECTLY to console (not buffered) — user must see this!
|
|
105
|
+
origLog('');
|
|
106
|
+
origLog(chalk.red(' ╔══════════════════════════════════════════╗'));
|
|
107
|
+
origLog(chalk.red(' ║') + chalk.bold.white(' ACTIVATION REQUIRED ') + chalk.red('║'));
|
|
108
|
+
origLog(chalk.red(' ╠══════════════════════════════════════════╣'));
|
|
109
|
+
origLog(chalk.red(' ║') + chalk.yellow(` Code: ${code}`) + ' '.repeat(33 - code.length) + chalk.red('║'));
|
|
110
|
+
origLog(chalk.red(' ║') + chalk.cyan(' https://xiaozhi.me') + ' '.repeat(23) + chalk.red('║'));
|
|
111
|
+
origLog(chalk.red(' ╚══════════════════════════════════════════╝'));
|
|
112
|
+
origLog('');
|
|
113
|
+
origLog(chalk.gray(' Waiting for activation... (checking every 5s)'));
|
|
114
|
+
origLog('');
|
|
108
115
|
});
|
|
109
116
|
|
|
110
117
|
try {
|
package/src/mcp/activation.js
CHANGED
|
@@ -33,9 +33,6 @@ export async function handleActivation(data, otaUrl, deviceId, clientId) {
|
|
|
33
33
|
const a = data.activation;
|
|
34
34
|
if (!a?.code) return data.mqtt;
|
|
35
35
|
|
|
36
|
-
log('warn', `🔐 Activation required`);
|
|
37
|
-
log('info', `📋 Code: ${a.code}`);
|
|
38
|
-
log('info', `[WEB] https://xiaozhi.me`);
|
|
39
36
|
bus.emit('activation:required', { code: a.code });
|
|
40
37
|
|
|
41
38
|
const timeout = a.timeout_ms || 120000;
|
|
@@ -43,10 +40,10 @@ export async function handleActivation(data, otaUrl, deviceId, clientId) {
|
|
|
43
40
|
|
|
44
41
|
while (Date.now() - start < timeout) {
|
|
45
42
|
await new Promise(r => setTimeout(r, 5000));
|
|
46
|
-
log('info', '
|
|
43
|
+
log('info', 'Checking activation...');
|
|
47
44
|
const poll = await fetchOtaConfig(otaUrl, deviceId, clientId);
|
|
48
45
|
if (!poll.activation?.code && poll.mqtt) {
|
|
49
|
-
log('ok', '
|
|
46
|
+
log('ok', 'Activated!');
|
|
50
47
|
return poll.mqtt;
|
|
51
48
|
}
|
|
52
49
|
}
|
|
@@ -1,57 +0,0 @@
|
|
|
1
|
-
plugins {
|
|
2
|
-
id("com.android.application")
|
|
3
|
-
id("org.jetbrains.kotlin.android")
|
|
4
|
-
}
|
|
5
|
-
|
|
6
|
-
android {
|
|
7
|
-
namespace = "com.dailynotes.app"
|
|
8
|
-
compileSdk = 34
|
|
9
|
-
|
|
10
|
-
defaultConfig {
|
|
11
|
-
applicationId = "com.dailynotes.app"
|
|
12
|
-
minSdk = 24
|
|
13
|
-
targetSdk = 34
|
|
14
|
-
versionCode = 1
|
|
15
|
-
versionName = "1.0"
|
|
16
|
-
|
|
17
|
-
testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
buildTypes {
|
|
21
|
-
release {
|
|
22
|
-
isMinifyEnabled = false
|
|
23
|
-
proguardFiles(
|
|
24
|
-
getDefaultProguardFile("proguard-android-optimize.txt"),
|
|
25
|
-
"proguard-rules.pro"
|
|
26
|
-
)
|
|
27
|
-
}
|
|
28
|
-
}
|
|
29
|
-
compileOptions {
|
|
30
|
-
sourceCompatibility = JavaVersion.VERSION_1_8
|
|
31
|
-
targetCompatibility = JavaVersion.VERSION_1_8
|
|
32
|
-
}
|
|
33
|
-
kotlinOptions {
|
|
34
|
-
jvmTarget = "1.8"
|
|
35
|
-
}
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
dependencies {
|
|
39
|
-
implementation("androidx.core:core-ktx:1.12.0")
|
|
40
|
-
implementation("androidx.appcompat:appcompat:1.6.1")
|
|
41
|
-
implementation("com.google.android.material:material:1.11.0")
|
|
42
|
-
implementation("androidx.constraintlayout:constraintlayout:2.1.4")
|
|
43
|
-
|
|
44
|
-
// Room Database
|
|
45
|
-
val roomVersion = "2.6.1"
|
|
46
|
-
implementation("androidx.room:room-runtime:$roomVersion")
|
|
47
|
-
implementation("androidx.room:room-ktx:$roomVersion")
|
|
48
|
-
ksp("androidx.room:room-compiler:$roomVersion")
|
|
49
|
-
|
|
50
|
-
// Lifecycle
|
|
51
|
-
implementation("androidx.lifecycle:lifecycle-viewmodel-ktx:2.7.0")
|
|
52
|
-
implementation("androidx.lifecycle:lifecycle-livedata-ktx:2.7.0")
|
|
53
|
-
|
|
54
|
-
testImplementation("junit:junit:4.13.2")
|
|
55
|
-
androidTestImplementation("androidx.test.ext:junit:1.1.5")
|
|
56
|
-
androidTestImplementation("androidx.test.espresso:espresso-core:3.5.1")
|
|
57
|
-
}
|
|
@@ -1,48 +0,0 @@
|
|
|
1
|
-
package com.dailynotes.app
|
|
2
|
-
|
|
3
|
-
import android.os.Bundle
|
|
4
|
-
import androidx.appcompat.app.AppCompatActivity
|
|
5
|
-
import androidx.lifecycle.ViewModelProvider
|
|
6
|
-
import androidx.recyclerview.widget.LinearLayoutManager
|
|
7
|
-
import androidx.recyclerview.widget.RecyclerView
|
|
8
|
-
import com.google.android.material.floatingactionbutton.FloatingActionButton
|
|
9
|
-
|
|
10
|
-
class MainActivity : AppCompatActivity() {
|
|
11
|
-
|
|
12
|
-
private lateinit var viewModel: NoteViewModel
|
|
13
|
-
private lateinit var adapter: NoteAdapter
|
|
14
|
-
private lateinit var recyclerView: RecyclerView
|
|
15
|
-
|
|
16
|
-
override fun onCreate(savedInstanceState: Bundle?) {
|
|
17
|
-
super.onCreate(savedInstanceState)
|
|
18
|
-
setContentView(R.layout.activity_main)
|
|
19
|
-
|
|
20
|
-
viewModel = ViewModelProvider(this)[NoteViewModel::class.java]
|
|
21
|
-
|
|
22
|
-
recyclerView = findViewById(R.id.recyclerView)
|
|
23
|
-
adapter = NoteAdapter { note ->
|
|
24
|
-
// Handle note click - could open edit dialog
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
recyclerView.adapter = adapter
|
|
28
|
-
recyclerView.layoutManager = LinearLayoutManager(this)
|
|
29
|
-
|
|
30
|
-
val fabAdd: FloatingActionButton = findViewById(R.id.fabAdd)
|
|
31
|
-
fabAdd.setOnClickListener {
|
|
32
|
-
// Open add note dialog
|
|
33
|
-
showAddNoteDialog()
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
viewModel.allNotes.observe(this) { notes ->
|
|
37
|
-
adapter.submitList(notes)
|
|
38
|
-
}
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
private fun showAddNoteDialog() {
|
|
42
|
-
val dialog = AddNoteDialog { title, content ->
|
|
43
|
-
val note = Note(title = title, content = content)
|
|
44
|
-
viewModel.insert(note)
|
|
45
|
-
}
|
|
46
|
-
dialog.show(supportFragmentManager, "AddNoteDialog")
|
|
47
|
-
}
|
|
48
|
-
}
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
package com.dailynotes.app
|
|
2
|
-
|
|
3
|
-
import androidx.room.Entity
|
|
4
|
-
import androidx.room.PrimaryKey
|
|
5
|
-
|
|
6
|
-
@Entity(tableName = "notes")
|
|
7
|
-
data class Note(
|
|
8
|
-
@PrimaryKey(autoGenerate = true)
|
|
9
|
-
val id: Int = 0,
|
|
10
|
-
val title: String,
|
|
11
|
-
val content: String,
|
|
12
|
-
val createdAt: Long = System.currentTimeMillis()
|
|
13
|
-
)
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
pluginManagement {
|
|
2
|
-
repositories {
|
|
3
|
-
google()
|
|
4
|
-
mavenCentral()
|
|
5
|
-
gradlePluginPortal()
|
|
6
|
-
}
|
|
7
|
-
}
|
|
8
|
-
dependencyResolutionManagement {
|
|
9
|
-
repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS)
|
|
10
|
-
repositories {
|
|
11
|
-
google()
|
|
12
|
-
mavenCentral()
|
|
13
|
-
}
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
rootProject.name = "DailyNotesApp"
|
|
17
|
-
include(":app")
|