
Research
/Security News
60 Malicious Ruby Gems Used in Targeted Credential Theft Campaign
A RubyGems malware campaign used 60 malicious packages posing as automation tools to steal credentials from social media and marketing tool users.
vue-transcribe
Advanced tools
A Vue.js directive and service for speech-to-text transcription using AWS Transcribe
A lightweight Vue 2 & Vue 3 compatible directive + service bundle for real-time Speech-to-Text via WebSocket — ideal for integrating AWS Transcribe WebSocket service.
npm install vue-transcribe
Export | Description |
---|---|
TranscribeDirective | Vue directive for attaching transcription behavior to inputs or textareas |
TranscribeService | Singleton service managing WebSocket connection and configuration state |
CommandProcessor | Global processor for handling custom voice commands mapped to tasks |
import { TranscribeDirective } from 'vue-transcribe';
app.directive('transcribe', TranscribeDirective);
import Vue from 'vue';
import { TranscribeDirective } from 'vue-transcribe';
Vue.directive('transcribe', TranscribeDirective);
import 'vue-transcribe/css';
The directive will only activate if TranscribeService.getInstance().configured
is true
.
You must set a presigned WebSocket URL before using the directive.
Presigned URLs (like from AWS Transcribe) usually expire every 5 minutes, so you'll need to refresh it periodically. It is up to you to set up the endpoint that will return the presigned URLS using proper AWS credentials.
import axios from 'axios';
import { TranscribeService } from 'vue-transcribe';
function fetchAndSetWebSocketURL() {
axios.get('/api/transcribe-url')
.then(response => {
const url = response.data.url;
TranscribeService.getInstance().setURL(url);
})
.catch(err => console.error('Failed to fetch WebSocket URL:', err));
}
// Set initial URL
fetchAndSetWebSocketURL();
// Refresh URL every 5 minutes
setInterval(fetchAndSetWebSocketURL, 5 * 60 * 1000);
For command
mode, configure the global command map:
import { CommandProcessor } from 'vue-transcribe';
CommandProcessor.commandMap = [
{
command: 'say Hello',
task: () => alert('Hello!')
},
{
command: 'clear Input',
task: () => document.querySelector('#myInput').value = ''
}
];
Note: Command map must be an array of objects with exactly:
command
(string)task
(function)// Example options
const directiveOptions = {
style: {
mic: { backgroundColor: 'red' },
spinner: { color: 'blue' },
vector: { margin: '0 auto' },
container: { padding: '8px' }
},
languageCode: 'en-US',
type: 'generate',
maxRecordingTime: 60,
append: true,
micIconClass: ['fa', 'fa-microphone'],
listeningSVG: 'https://cdn.com/listening.svg'
};
Apply v-transcribe
to the parent element of your target input or textarea.
<div v-transcribe="directiveOptions">
<input type="text" id="myInput" />
</div>
Option | Type | Description |
---|---|---|
style | Object | Styling options for mic, spinner, vector, and container elements |
languageCode | String | BCP-47 language code (e.g. en-US ) |
type | String (generate | command ) | generate transcribes to text, command runs a mapped command |
maxRecordingTime | Number (milliseconds) | Max allowed recording time per session. Auto-stops. |
append | Boolean | Whether to append to or replace existing text in inputs |
micIconClass | Array of Strings | CSS class names for the mic button |
listeningSVG | String (absolute URL) | URL to an SVG animation shown while listening |
The style
binding expects an object with the following structure:
{
mic: { backgroundColor: 'red', borderRadius: '50%' },
spinner: { color: 'blue' },
vector: { width: '20px', height: '20px' },
container: { padding: '10px', display: 'flex' }
}
Each sub-property is a style object applied to its respective control element.
Type | Behavior |
---|---|
generate | Converts spoken input to text and injects it into the input/textarea |
command | Matches spoken phrases against CommandProcessor.commandMap and runs associated tasks |
TranscribeService.getInstance().configured
must be true
for the directive to be visible and functional.{ command: string, task: function }
objects.TranscribeService
follows a singleton pattern, accessible via TranscribeService.getInstance()
.import { TranscribeDirective, TranscribeService, CommandProcessor } from 'vue-transcribe';
import axios from 'axios';
import Vue from 'vue';
Vue.directive('transcribe', TranscribeDirective);
// Configure CommandProcessor
CommandProcessor.commandMap = [
{ command: 'hello', task: () => console.log('Hi!') },
...
];
// Set and refresh WebSocket URL
function setTranscribeURL() {
axios.get('/api/transcribe-url').then(res => {
TranscribeService.getInstance().setURL(res.data.url);
});
}
setTranscribeURL();
setInterval(setTranscribeURL, 5 * 60 * 1000);
TranscribeService.getInstance().configured = process.env.NODE_ENV !== 'development';
ISC
MRs welcome — please follow existing code conventions and document any new features.
Charles Ugbana
FAQs
An encapsulated Vue.js component + service for speech-to-text functionality using AWS Transcribe
The npm package vue-transcribe receives a total of 2 weekly downloads. As such, vue-transcribe popularity was classified as not popular.
We found that vue-transcribe demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Research
/Security News
A RubyGems malware campaign used 60 malicious packages posing as automation tools to steal credentials from social media and marketing tool users.
Security News
The CNA Scorecard ranks CVE issuers by data completeness, revealing major gaps in patch info and software identifiers across thousands of vulnerabilities.
Research
/Security News
Two npm packages masquerading as WhatsApp developer libraries include a kill switch that deletes all files if the phone number isn’t whitelisted.