Add basic cli stuff.

This commit is contained in:
吳元皓 2025-05-15 14:04:16 +08:00
parent f740f671d1
commit a94b6fbb79
9 changed files with 107 additions and 13 deletions

View File

@ -68,13 +68,17 @@ const stopDrag = () => {
height: props.height || '300px', height: props.height || '300px',
}" }"
class="fixed rounded-xl shadow-lg overflow-hidden flex flex-col shadow-lg shadow-xl/30" class="fixed rounded-xl shadow-lg overflow-hidden flex flex-col shadow-lg shadow-xl/30"
:class="props.black ? 'bg-black text-white' : 'bg-white text-black'" :class="
props.black
? 'bg-black text-white border border-white border-t-0'
: 'bg-white text-black'
"
> >
<div <div
@mousedown="startDrag" @mousedown="startDrag"
class="bg-gray-700 p-2 cursor-move flex justify-between items-center flex-shrink-0" class="bg-gray-700 p-2 cursor-move flex justify-between items-center flex-shrink-0 text-white"
> >
<h3 class="font-semibold">{{ title }}</h3> <h3 class="font-semibold text-white">{{ title }}</h3>
<div class="flex flex-row gap-1"> <div class="flex flex-row gap-1">
<button <button
@click="emit('min')" @click="emit('min')"

View File

@ -1,5 +1,10 @@
<script setup lang="ts"> <script setup lang="ts">
import copyrightInfo from "~/components/app/info/copyright.vue"; import copyrightInfo from "~/components/app/info/copyright.vue";
// Great, there are now no errors ig
const emit = defineEmits(["windowopener", "error", "loadValue"]);
const props = defineProps<{
values?: string;
}>();
</script> </script>
<template> <template>
<div class="justify-center align-center text-center flex flex-col"> <div class="justify-center align-center text-center flex flex-col">

View File

@ -6,6 +6,8 @@ import { ScrambleTextPlugin } from "gsap/dist/ScrambleTextPlugin";
gsap.registerPlugin(ScrambleTextPlugin); gsap.registerPlugin(ScrambleTextPlugin);
const loading = ref(true); const loading = ref(true);
const { t, locale } = useI18n(); const { t, locale } = useI18n();
// Great, there are now no errors ig
const emit = defineEmits(["windowopener", "error", "loadValue"]);
const props = defineProps({ const props = defineProps({
values: { values: {

View File

@ -7,6 +7,11 @@ const cookieChatId = cookie.value;
const chatId = ref(); const chatId = ref();
const inputMessage = ref(); const inputMessage = ref();
const messages = ref([]); const messages = ref([]);
// Great, there are now no errors ig
const emit = defineEmits(["windowopener", "error", "loadValue"]);
const props = defineProps<{
values?: string;
}>();
onMounted(async () => { onMounted(async () => {
console.log(cookieChatId); console.log(cookieChatId);
if (cookieChatId) { if (cookieChatId) {

View File

@ -1,3 +1,10 @@
<script setup lang="ts">
// Great, there are now no errors ig
const emit = defineEmits(["windowopener", "error", "loadValue"]);
const props = defineProps<{
values?: string;
}>();
</script>
<template> <template>
<div class="justify-center align-center text-center flex flex-col"> <div class="justify-center align-center text-center flex flex-col">
<span class="text-7xl m-4 m-1 mb-0 text-center align-center justify-center" <span class="text-7xl m-4 m-1 mb-0 text-center align-center justify-center"

View File

@ -1,4 +1,9 @@
<script setup lang="ts"> <script setup lang="ts">
// Great, there are now no errors ig
const emit = defineEmits(["windowopener", "error", "loadValue"]);
const props = defineProps<{
values?: string;
}>();
import DraggableWindow from "~/components/DraggableWindow.vue"; import DraggableWindow from "~/components/DraggableWindow.vue";
const ffeed = ref(); const ffeed = ref();
const ass = ["健康2.0", "中天", "TVBS", "香港01", "ETtoday"]; const ass = ["健康2.0", "中天", "TVBS", "香港01", "ETtoday"];

View File

@ -1,4 +1,6 @@
<script setup lamng="ts"> <script setup lamng="ts">
// Great, there are now no errors ig
const emit = defineEmits(["windowopener", "error", "loadValue"]);
import sha512 from "crypto-js/sha512"; import sha512 from "crypto-js/sha512";
const userAccount = ref(""); const userAccount = ref("");
const userPassword = ref(""); const userPassword = ref("");

View File

@ -2,7 +2,11 @@
import noImageLogo from "~/public/geterrorassets/noImageLogo.svg"; import noImageLogo from "~/public/geterrorassets/noImageLogo.svg";
const { t, locale } = useI18n(); const { t, locale } = useI18n();
const emit = defineEmits(["windowopener", "loadValue"]); // Great, there are now no errors ig
const emit = defineEmits(["windowopener", "error", "loadValue"]);
const props = defineProps<{
values?: string;
}>();
const openNewWindow = (itemId: string) => { const openNewWindow = (itemId: string) => {
emit("windowopener", "aboutNewsOrg"); emit("windowopener", "aboutNewsOrg");

View File

@ -1,16 +1,76 @@
<script setup lang="ts"> <script setup lang="ts">
const commandInputBox = ref(); const commandInputBox = ref();
const inputRef = ref<HTMLInputElement | null>(null);
const prevCommands = ref([]);
// Great, there are now no errors ig
const emit = defineEmits(["windowopener", "error", "loadValue"]);
const props = defineProps<{
values?: string;
}>();
const openNewWindow = (windowId: string) => {
emit("windowopener", windowId);
};
const printAbout = () => {};
const focusInput = () => {
inputRef.value?.focus();
};
onMounted(() => {
focusInput();
});
const startScript = () => {
console.log(commandInputBox.value);
const firstWord = commandInputBox.value.replace(/\s+.*$/, "").trim();
const app = commands.find((item) => item.command === firstWord);
if (app) {
app.run(commandInputBox.value);
} else {
console.error("Cannot find match");
}
commandInputBox.value = "";
};
const findExecutable = (inputContent: string) => {
console.log(inputContent);
};
// scripts
const commands = [
{
command: "execute",
run: findExecutable,
},
{
command: "about",
run: printAbout,
},
];
</script> </script>
<template> <template>
<div class="text-white"> <div class="w-full h-full">
<div class="flex flex-row"> <div class="text-white">
<span class="mx-1">></span <div v-for="i in prevCommands" :key="i.id"></div>
><input </div>
v-model="commandInputBox" <div class="text-white" @click="focusInput">
type="text" <div class="flex flex-row">
class="border-none bg-black outline-0 w-full text-wrap" <span class="mx-1">></span>
@keyup.enter="console.log(commandInputBox)" <input
/> ref="inputRef"
v-model="commandInputBox"
id="ttyinputbox"
type="text"
autocomplete="false"
autocorrect="false"
autocapitalize="false"
class="border-none bg-black outline-none text-wrap select-none"
@keyup.enter="startScript()"
/>
</div>
</div> </div>
</div> </div>
</template> </template>