Skip to content
Merged
Show file tree
Hide file tree
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
4 changes: 2 additions & 2 deletions .github/workflows/deploy.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -31,13 +31,13 @@ jobs:
cd ~/workspace/executeme

# make sure we are in executeme directory
ls -a
# ls -a

# Pull the latest code from the 'main' branch of the GitHub repository.
git pull origin main

# Check git status to make sure everything is up to date
git status
# git status

# Execute your bash script.
bash ./scripts.sh
Expand Down
2 changes: 1 addition & 1 deletion app.js
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ app.post("/run", async (req, res) => {
// 3. Prepare and execute the Docker command
// The -v flag uses the hostVolumePath (absolute path on host) as the source,
// and mounts it to '/app' inside the executor container.
const runCommand = `docker run --rm --memory=256m --cpus=0.5 -v "${hostVolumePath}:/app" ${langConfig.image} ${langConfig.cmd}`;
const runCommand = `docker run --rm --memory=512m --cpus=0.5 -v "${hostVolumePath}:/app" ${langConfig.image} ${langConfig.cmd}`;

console.log(`[Executor] Attempting to run command: ${runCommand}`);

Expand Down
2 changes: 2 additions & 0 deletions changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,3 +22,5 @@
- [feat] shows a floating button for displaying online coders
- [fix] Fixed mobile responsive issues
- [feat] Nginx setup for getting free ssl on our server
- [feat] deployment github action to automate the vps deploy
- [chore] Incress the memory uses for only **Kotlin** language support
10 changes: 8 additions & 2 deletions websites/src/app/_actions/execute.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,18 @@ import { Input, Output } from "@/@types";
import { baseUri } from "@/constants/base";
import axios from "axios";
import { performance } from "perf_hooks";
import https from "https"; // Import the built-in Node.js https module

const agent = new https.Agent({
rejectUnauthorized: false, // THIS IS THE KEY LINE
});
const axiosInstance = axios.create({
httpsAgent: agent,
});
export async function executeCodeAction(input: Input): Promise<Output> {
const start = performance.now();
console.log("baseurl: ", baseUri);
try {
const response = await axios.post(`${baseUri}/run`, input);
const response = await axiosInstance.post(`${baseUri}/run`, input);
const end = performance.now();

return {
Expand Down
5 changes: 2 additions & 3 deletions websites/src/app/_components/editor-view/code-editor.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import { Editor } from "@monaco-editor/react";
import { Card, CardContent } from "@/components/ui/card";
import { Badge } from "@/components/ui/badge";
import { Loader2 } from "lucide-react";
import { LANGUAGE_MAP } from "@/constants";
import { Language } from "@/@types";
import { codeEditorOptions } from "@/constants";

Expand Down Expand Up @@ -58,9 +57,9 @@ export function CodeEditor({
width={"100%"}
// Ensure the language is correctly mapped for Monaco to provide suggestions
className="w-full"
language={LANGUAGE_MAP[language]}
language={language}
value={value ?? "// Start coding here..."}
defaultLanguage={LANGUAGE_MAP[language]}
defaultLanguage={language}
saveViewState={true}
onChange={handleEditorChange}
// Force vs-dark theme for the editor
Expand Down
33 changes: 3 additions & 30 deletions websites/src/components/shared/online-coders/online-coders.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,33 +11,9 @@ type Props = {
};
export default function OnlineCoders({ className }: Props) {
const [count, setCount] = useState(0);
const [displayCount, setDisplayCount] = useState(0);
const [isVisible, setIsVisible] = useState(false);

// Animated counter effect
useEffect(() => {
setIsVisible(true);
const duration = 2000; // 2 seconds
const steps = 60;
const increment = count / steps;
let current = 0;

const timer = setInterval(() => {
current += increment;
if (current >= count) {
setDisplayCount(count);
clearInterval(timer);
} else {
setDisplayCount(Math.floor(current));
}
}, duration / steps);

return () => clearInterval(timer);
}, [count]);

useEffect(() => {
const handleActiveCoders = (data: string[]) => {
console.log("data: ", data);
setCount(data.length || 0);
};
socket.on("active_coders", handleActiveCoders);
Expand All @@ -52,12 +28,9 @@ export default function OnlineCoders({ className }: Props) {

{/* Main container with glassmorphism */}
<div
className={`
relative backdrop-blur-xl bg-white/10 border border-white/20
className="relative backdrop-blur-xl bg-white/10 border border-white/20
rounded-2xl p-6 shadow-2xl overflow-hidden
transform transition-all duration-1000 ease-out
${isVisible ? "translate-y-0 opacity-100" : "translate-y-4 opacity-0"}
`}
transform transition-all duration-1000 ease-out translate-y-0 opacity-100"
>
{/* Animated background gradient */}
<div className="animated-background-gradient animate-gradient-xy"></div>
Expand All @@ -66,7 +39,7 @@ export default function OnlineCoders({ className }: Props) {
<FloatingParticles />

{/* Content */}
<Content displayCount={displayCount} />
<Content displayCount={count} />

{/* Bottom accent line */}
<div className="bottom-accent-line animate-gradient-x"></div>
Expand Down
12 changes: 5 additions & 7 deletions websites/src/constants/base.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
export const BASE_URI = "http://localhost:9091";
// export const baseUri = "https://145.223.97.55:9292"

export const baseUri = "https://145.223.97.55:9292"

// export const baseUri =
// process.env.NODE_ENV !== "development"
// ? process.env.SERVER_BASE_URL
// : process.env.SERVER_BASE_URL_LOCAL || BASE_URI;
export const baseUri =
process.env.NODE_ENV !== "development"
? process.env.NEXT_PUBLIC_SERVER_BASE_URL
: process.env.NEXT_PUBLIC_SERVER_BASE_URL_LOCAL;
105 changes: 2 additions & 103 deletions websites/src/constants/index.ts
Original file line number Diff line number Diff line change
@@ -1,109 +1,8 @@
export * from "./editor";
export const LANGUAGE_MAP = {
python: "python",
javascript: "nodejs",
javascript: "javascript",
typescript: "typescript",
java: "java",
// cpp: 'cpp',
// c: 'c',
// go: 'go',
// rust: 'rust',
// php: 'php',
// ruby: 'ruby',
// html: 'html',
// css: 'css',
// json: 'json',
// xml: 'xml',
// sql: 'sql',
kotlin: "kotlin",
} as const;

export const SAMPLE_CODE: Record<string, string> = {
python: `# Welcome to Execute Me - Python
def hello_world():
print("Hello, World!")
return 42

# Your code here
result = hello_world()
print(f"Result: {result}")`,

javascript: `// Welcome to Execute Me - JavaScript
function helloWorld() {
console.log("Hello, World!");
return 42;
}

// Your code here
const result = helloWorld();
console.log(\`Result: \${result}\`);`,

typescript: `// Welcome to Execute Me - TypeScript
function helloWorld(): number {
console.log("Hello, World!");
return 42;
}

// Your code here
const result: number = helloWorld();
console.log(\`Result: \${result}\`);`,

java: `// Welcome to Execute Me - Java
public class Main {
public static void main(String[] args) {
System.out.println("Hello, World!");
int result = 42;
System.out.println("Result: " + result);
}
}`,

cpp: `// Welcome to Execute Me - C++
#include <iostream>
using namespace std;

int main() {
cout << "Hello, World!" << endl;
int result = 42;
cout << "Result: " << result << endl;
return 0;
}`,

c: `// Welcome to Execute Me - C
#include <stdio.h>

int main() {
printf("Hello, World!\\n");
int result = 42;
printf("Result: %d\\n", result);
return 0;
}`,

go: `// Welcome to Execute Me - Go
package main

import "fmt"

func main() {
fmt.Println("Hello, World!")
result := 42
fmt.Printf("Result: %d\\n", result)
}`,

rust: `// Welcome to Execute Me - Rust
fn main() {
println!("Hello, World!");
let result = 42;
println!("Result: {}", result);
}`,

php: `<?php
// Welcome to Execute Me - PHP
echo "Hello, World!\\n";
$result = 42;
echo "Result: " . $result . "\\n";
?>`,

ruby: `# Welcome to Execute Me - Ruby
puts "Hello, World!"
result = 42
puts "Result: #{result}"`,
};