Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 12 additions & 1 deletion src/views/Commands.vue
Original file line number Diff line number Diff line change
Expand Up @@ -249,12 +249,23 @@
this.$refs['terminal-input'].focus();
},
methods: {
// Converts Steam URLs into the game's numeric ID
processSteamUrls(command) {
if (typeof command !== 'string' || !command) return command;

// Only game URLs (/app/). Includes steamdb.info.
const steamUrlRegex = /https?:\/\/(?:www\.)?(?:store\.steampowered\.com|steamcommunity\.com|steamdb\.info)\/app\/(\d+)(?:[\/?#][^\s]*)?/gi;

return command.replace(steamUrlRegex, '$1');
},
async sendCommand() {
const commandToExecute = this.command.trim();
let commandToExecute = this.command.trim();
this.command = '';

if (!commandToExecute) return;

commandToExecute = this.processSteamUrls(commandToExecute);

this.commandHistoryIndex = -1;
this.commandHistory.add(commandToExecute);

Expand Down