Ahmad Kholid 2 سال پیش
والد
کامیت
4ad11da17b

+ 1 - 1
package.json

@@ -1,6 +1,6 @@
 {
   "name": "automa",
-  "version": "1.12.0",
+  "version": "1.12.1",
   "description": "An extension for automating your browser by connecting blocks",
   "license": "MIT",
   "repository": {

+ 0 - 3
src/background/index.js

@@ -108,9 +108,6 @@ const workflow = {
                 status === 'success' ? 'Successfully' : 'Failed'
               } to run the "${name}" workflow`,
             });
-          })
-          .catch((error) => {
-            console.error(error);
           });
       });
 

+ 3 - 3
src/background/workflowEngine/blocksHandler/handlerGoogleSheets.js

@@ -12,7 +12,7 @@ async function getSpreadsheetValues({ spreadsheetId, range, firstRowAsKey }) {
   const result = await response.json();
 
   if (!response.ok) {
-    throw new Error(result.statusMessage);
+    throw new Error(result.message);
   }
 
   const sheetsData = firstRowAsKey
@@ -26,7 +26,7 @@ async function getSpreadsheetRange({ spreadsheetId, range }) {
   const result = await response.json();
 
   if (!response.ok) {
-    throw new Error(result.statusMessage);
+    throw new Error(result.message);
   }
 
   const data = {
@@ -89,7 +89,7 @@ async function updateSpreadsheetValues(
   if (!response.ok) {
     const error = await response.json();
 
-    throw new Error(error.statusMessage);
+    throw new Error(error.message);
   }
 }
 

+ 50 - 34
src/components/newtab/workflow/edit/EditNotification.vue

@@ -6,44 +6,59 @@
       class="w-full mb-2"
       @change="updateData({ description: $event })"
     />
-    <edit-autocomplete class="mb-2">
-      <ui-input
-        :model-value="data.title"
-        :label="t('workflow.blocks.notification.title')"
-        placeholder="Hello world!"
-        class="w-full"
-        @change="updateData({ title: $event })"
-      />
-    </edit-autocomplete>
-    <label class="input-label" for="notification-message">
-      {{ t('workflow.blocks.notification.message') }}
-    </label>
-    <edit-autocomplete>
-      <ui-textarea
-        id="notification-message"
-        :model-value="data.message"
-        placeholder="Notification message"
-        class="w-full"
-        @change="updateData({ message: $event })"
-      />
-    </edit-autocomplete>
-    <edit-autocomplete
-      v-for="type in ['iconUrl', 'imageUrl']"
-      :key="type"
-      class="mt-2"
-    >
-      <ui-input
-        :model-value="data[type]"
-        :label="t(`workflow.blocks.notification.${type}`)"
-        class="w-full"
-        placeholder="https://example.com/image.png"
-        @change="updateData({ [type]: $event })"
-      />
-    </edit-autocomplete>
+    <template v-if="permission.has.notifications">
+      <edit-autocomplete class="mb-2">
+        <ui-input
+          :model-value="data.title"
+          :label="t('workflow.blocks.notification.title')"
+          placeholder="Hello world!"
+          class="w-full"
+          @change="updateData({ title: $event })"
+        />
+      </edit-autocomplete>
+      <label class="input-label" for="notification-message">
+        {{ t('workflow.blocks.notification.message') }}
+      </label>
+      <edit-autocomplete>
+        <ui-textarea
+          id="notification-message"
+          :model-value="data.message"
+          placeholder="Notification message"
+          class="w-full"
+          @change="updateData({ message: $event })"
+        />
+      </edit-autocomplete>
+      <edit-autocomplete
+        v-for="type in ['iconUrl', 'imageUrl']"
+        :key="type"
+        class="mt-2"
+      >
+        <ui-input
+          :model-value="data[type]"
+          :label="t(`workflow.blocks.notification.${type}`)"
+          class="w-full"
+          placeholder="https://example.com/image.png"
+          @change="updateData({ [type]: $event })"
+        />
+      </edit-autocomplete>
+    </template>
+    <template v-else>
+      <p class="mt-4">
+        {{ t('workflow.blocks.base.noPermission') }}
+      </p>
+      <ui-button
+        variant="accent"
+        class="mt-2"
+        @click="permission.request(true)"
+      >
+        {{ t('workflow.blocks.base.grantPermission') }}
+      </ui-button>
+    </template>
   </div>
 </template>
 <script setup>
 import { useI18n } from 'vue-i18n';
+import { useHasPermissions } from '@/composable/hasPermissions';
 import EditAutocomplete from './EditAutocomplete.vue';
 
 const props = defineProps({
@@ -55,6 +70,7 @@ const props = defineProps({
 const emit = defineEmits(['update:data']);
 
 const { t } = useI18n();
+const permission = useHasPermissions(['notifications']);
 
 function updateData(value) {
   emit('update:data', { ...props.data, ...value });

+ 2 - 0
src/locales/en/blocks.json

@@ -15,6 +15,8 @@
         "selector": "Element selector",
         "selectorOptions": "Selector options",
         "timeout": "Timeout (milliseconds)",
+        "noPermission": "Automa don't have enough permission to do this action",
+        "grantPermission": "Grant permission",
         "toggle": {
           "enable": "Enable block",
           "disable": "Disable block",

+ 2 - 2
src/newtab/App.vue

@@ -23,7 +23,7 @@
       </template>
     </ui-dialog>
     <div
-      v-if="false"
+      v-if="isUpdated"
       class="p-4 shadow-2xl z-50 fixed bottom-8 left-1/2 -translate-x-1/2 rounded-lg bg-accent text-white dark:text-gray-900 flex items-center"
     >
       <v-remixicon name="riInformationLine" class="mr-3" />
@@ -31,7 +31,7 @@
         {{ t('updateMessage.text1', { version: currentVersion }) }}
       </p>
       <a
-        :href="`https://github.com/Kholid060/automa/releases/tag/v${currentVersion}`"
+        :href="`https://github.com/AutomaApp/automa/releases/latest`"
         target="_blank"
         rel="noopener"
         class="underline ml-1"

+ 1 - 0
src/newtab/pages/settings/SettingsAbout.vue

@@ -44,6 +44,7 @@
         />
       </a>
     </div>
+    <h3>Translators</h3>
   </div>
 </template>
 <script setup>