Skip to content

Commit

Permalink
review feedback
Browse files Browse the repository at this point in the history
  • Loading branch information
devoncarew committed Jun 4, 2024
1 parent 275b708 commit 95057b1
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 13 deletions.
14 changes: 7 additions & 7 deletions pkgs/dart_services/lib/src/common_server.dart
Original file line number Diff line number Diff line change
Expand Up @@ -209,13 +209,6 @@ class CommonServerApi {
Future<Response> gemini(Request request, String apiVersion) async {
if (apiVersion != api3) return unhandledVersion(apiVersion);

// Read the api key from env variables (populated on the server).
final apiKey = googleApiKey;
if (apiKey == null) {
return Response.internalServerError(
body: 'gemini key not configured on server');
}

// Only allow the call from known clients / endpoints.
const firebaseHostAddress = '199.36.158.100';
const localHostAddress = '127.0.0.1';
Expand All @@ -227,6 +220,13 @@ class CommonServerApi {
body: 'gemini calls only allowed from the DartPad frontend');
}

// Read the api key from env variables (populated on the server).
final apiKey = googleApiKey;
if (apiKey == null) {
return Response.internalServerError(
body: 'gemini key not configured on server');
}

final sourceRequest =
api.SourceRequest.fromJson(await request.readAsJson());

Expand Down
7 changes: 1 addition & 6 deletions pkgs/dartpad_shared/lib/services.dart
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
import 'dart:convert';

import 'package:http/http.dart';
import 'package:meta/meta.dart';

import 'model.dart';

Expand Down Expand Up @@ -97,9 +98,3 @@ class ApiRequestError implements Exception {
@override
String toString() => '$message: $body';
}

class _Experimental {
const _Experimental();
}

const Object experimental = _Experimental();
1 change: 1 addition & 0 deletions pkgs/dartpad_shared/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ environment:
dependencies:
http: ^1.1.0
json_annotation: ^4.9.0
meta: ^1.14.0

dev_dependencies:
build_runner: ^2.4.5
Expand Down

0 comments on commit 95057b1

Please sign in to comment.