George S. Baugh před 5 roky
rodič
revize
8db6f4f8ea

+ 1 - 0
.gitignore

@@ -2,3 +2,4 @@
 *.swo
 favicon.ico
 dist/
+www/assets/*.*

+ 1 - 0
lib/Trog/Data/DUMMY.pm

@@ -144,6 +144,7 @@ sub _add_post_type (@posts) {
 sub _add_media_type (@posts) {
     return map {
         my $post = $_;
+        $post->{content_type} //= '';
         $post->{is_video} = 1 if $post->{content_type} =~ m/^video\//;
         $post->{is_audio} = 1 if $post->{content_type} =~ m/^audio\//;
         $post->{is_image} = 1 if $post->{content_type} =~ m/^image\//;

+ 3 - 0
lib/Trog/Routes/HTML.pm

@@ -465,9 +465,12 @@ sub post ($query, $render_cb) {
 }
 
 sub post_save ($query, $render_cb) {
+    my $to = delete $query->{to};
     state $data = Trog::Data->new($conf);
+    $query->{tags}  = _coerce_array($query->{tags});
     $data->add($query);
     $query->{failure} = 0;
+    $query->{to} = $to;
     return post($query, $render_cb);
 }
 

+ 3 - 3
www/server.psgi

@@ -92,7 +92,7 @@ my $app = sub {
 
     #Disallow any paths that are naughty ( starman auto-removes .. up-traversal)
     if (index($path,'/templates') == 0 || $path =~ m/.*\.psgi$/i ) {
-        return Trog::Routes::HTML::forbidden($query,$env->{'psgi.input'}, \&_render);
+        return Trog::Routes::HTML::forbidden($query, \&_render);
     }
 
     # If it's just a file, serve it up
@@ -115,8 +115,8 @@ my $app = sub {
     }
 
     #TODO reject inappropriate content-lengths
-    return Trog::Routes::HTML::notfound($query,$env->{'psgi.input'}, \&_render) unless exists $routes{$path};
-    return Trog::Routes::HTML::badrequest($query,$env->{'psgi.input'}, \&_render) unless $routes{$path}{method} eq $env->{REQUEST_METHOD};
+    return Trog::Routes::HTML::notfound($query, \&_render) unless exists $routes{$path};
+    return Trog::Routes::HTML::badrequest($query, \&_render) unless $routes{$path}{method} eq $env->{REQUEST_METHOD};
 
     @{$query}{keys(%{$routes{$path}{'data'}})} = values(%{$routes{$path}{'data'}}) if ref $routes{$path}{'data'} eq 'HASH' && %{$routes{$path}{'data'}};
 

+ 1 - 0
www/templates/blog.tx

@@ -5,5 +5,6 @@
     : include "tags.tx";
     Content<br /><textarea required class="cooltext" name="comment" placeholder="Potzrebie"><: $post.data :></textarea>
     <input type="hidden" name="app" value="blog" />
+    <input type="hidden" name="to" value="<: $route :>" />
     <input class="coolbutton" type="submit" value="Publish" text="Publish" />
 </form>

+ 1 - 0
www/templates/file.tx

@@ -11,5 +11,6 @@
     : include "tags.tx";
     Comments<br /><textarea class="cooltext" name="comment" placeholder="Potzrebie"><: $post.data :></textarea>
     <input type="hidden" name="app" value="file" />
+    <input type="hidden" name="to" value="<: $route :>" />
     <input class="coolbutton" type="submit" value="Publish" text="Publish" />
 </form>

+ 1 - 0
www/templates/microblog.tx

@@ -8,5 +8,6 @@
     : include "tags.tx";
     Comments<br /><textarea class="cooltext" name="comment" placeholder="Potzrebie"><: $post.data :></textarea>
     <input type="hidden" name="app" value="microblog" />
+    <input type="hidden" name="to" value="<: $route :>" />
     <input class="coolbutton" type="submit" value="Publish" text="Publish" />
 </form>

+ 1 - 0
www/templates/profile.tx

@@ -11,5 +11,6 @@
     : include "tags.tx";
     Content<br /><textarea class="cooltext" name="comment" placeholder="Potzrebie"><: $post.data :></textarea>
     <input type="hidden" name="app" value="file" />
+    <input type="hidden" name="to" value="<: $route :>" />
     <input class="coolbutton" type="submit" value="Publish" text="Publish" />
 </form>

+ 2 - 1
www/templates/series.tx

@@ -9,6 +9,7 @@
         : }
     </select>
     Comments<br /><textarea class="cooltext" name="comment" placeholder="Potzrebie"><: $post.data :></textarea>
-    <input type="hidden" name="app" value="file" />
+    <input type="hidden" name="app" value="series" />
+    <input type="hidden" name="to" value="<: $route :>" />
     <input class="coolbutton" type="submit" value="Publish" text="Publish" />
 </form>