mirror of
https://github.com/appwrite/appwrite.git
synced 2026-05-26 13:51:13 +00:00
Fix getTemplate endpoint
This commit is contained in:
@@ -9,18 +9,16 @@ const TEMPLATE_FRAMEWORKS = [
|
||||
],
|
||||
];
|
||||
|
||||
function getFrameworks($framework, $installCommand, $buildCommand, $outputDirectory, $fallbackRedirect, $providerRootDirectory)
|
||||
function getFramework($framework, $installCommand, $buildCommand, $outputDirectory, $fallbackRedirect, $providerRootDirectory)
|
||||
{
|
||||
return array_map(function ($version) use ($framework, $installCommand, $buildCommand, $outputDirectory, $fallbackRedirect, $providerRootDirectory) {
|
||||
return [
|
||||
'name' => $framework['name'],
|
||||
'installCommand' => $installCommand,
|
||||
'buildCommand' => $buildCommand,
|
||||
'outputDirectory' => $outputDirectory,
|
||||
'fallbackRedirect' => $fallbackRedirect,
|
||||
'providerRootDirectory' => $providerRootDirectory
|
||||
];
|
||||
}, $framework);
|
||||
return [
|
||||
'name' => $framework['name'],
|
||||
'installCommand' => $installCommand,
|
||||
'buildCommand' => $buildCommand,
|
||||
'outputDirectory' => $outputDirectory,
|
||||
'fallbackRedirect' => $fallbackRedirect,
|
||||
'providerRootDirectory' => $providerRootDirectory
|
||||
];
|
||||
}
|
||||
|
||||
return [
|
||||
@@ -32,7 +30,25 @@ return [
|
||||
'A simple site to get started. Edit this site to explore endless possibilities with Appwrite Sites.',
|
||||
'useCases' => ['starter'],
|
||||
'frameworks' => [
|
||||
...getFrameworks(TEMPLATE_FRAMEWORKS['SVELTEKIT'], 'npm install', 'npm run build', 'build', 'index.html', 'node/starter')
|
||||
...getFramework(TEMPLATE_FRAMEWORKS['SVELTEKIT'], 'npm install', 'npm run build', 'build', 'index.html', 'node/starter')
|
||||
],
|
||||
'instructions' => 'For documentation and instructions check out <a target="_blank" rel="noopener noreferrer" class="link" href="https://github.com/appwrite/templates/tree/main/node/starter">file</a>.',
|
||||
'vcsProvider' => 'github',
|
||||
'providerRepositoryId' => 'templates',
|
||||
'providerOwner' => 'appwrite',
|
||||
'providerVersion' => '0.2.*',
|
||||
'variables' => [],
|
||||
'scopes' => ['users.read']
|
||||
],
|
||||
[
|
||||
'icon' => 'icon-lightning-bolt',
|
||||
'id' => 'starter1',
|
||||
'name' => 'Starter1 site',
|
||||
'tagline' =>
|
||||
'A simple site to get started. Edit this site to explore endless possibilities with Appwrite Sites.',
|
||||
'useCases' => ['messaging'],
|
||||
'frameworks' => [
|
||||
...getFramework(TEMPLATE_FRAMEWORKS['SVELTEKIT'], 'npm install', 'npm run build', 'build', 'index.html', 'node/starter1')
|
||||
],
|
||||
'instructions' => 'For documentation and instructions check out <a target="_blank" rel="noopener noreferrer" class="link" href="https://github.com/appwrite/templates/tree/main/node/starter">file</a>.',
|
||||
'vcsProvider' => 'github',
|
||||
|
||||
@@ -2615,8 +2615,8 @@ App::get('/v1/functions/templates/:templateId')
|
||||
->action(function (string $templateId, Response $response) {
|
||||
$templates = Config::getParam('function-templates', []);
|
||||
|
||||
$template = array_shift(\array_filter($templates, function ($template) use ($templateId) {
|
||||
return $template['id'] === $templateId;
|
||||
$template = array_shift(array_filter($templates, function ($item) use ($templateId) {
|
||||
return $item['id'] === $templateId;
|
||||
}));
|
||||
|
||||
if (empty($template)) {
|
||||
|
||||
@@ -44,8 +44,8 @@ class GetTemplate extends Base
|
||||
{
|
||||
$templates = Config::getParam('site-templates', []);
|
||||
|
||||
$template = array_shift(\array_filter($templates, function ($template) use ($templateId) {
|
||||
return $template['id'] === $templateId;
|
||||
$template = array_shift(\array_filter($templates, function ($item) use ($templateId) {
|
||||
return $item['id'] === $templateId;
|
||||
}));
|
||||
|
||||
if (empty($template)) {
|
||||
|
||||
Reference in New Issue
Block a user