Browse Source

mv work with cookies to n2o (n4u)

221V 1 year ago
parent
commit
c5c8559725
1 changed files with 0 additions and 20 deletions
  1. 0 20
      src/nitro.erl

+ 0 - 20
src/nitro.erl

@@ -9,7 +9,6 @@
 -export([atom/1, q/1, q/2, qc/1, qc/2,
   pickle/1, depickle/1, unique_integer/0, temp_id/0,
   script/0, script/1, state/1, state/2,
-  cookie_expire/1, cookie/2, cookie/3, cookies/0, cookie/1,
   f/1, f/2, coalesce/1,
   to_list/1, to_atom/1, to_binary/1, to_integer/1,
   join/2, replace/3, indexof/2, indexof/3, append/3, os_env/1, os_env/2,
@@ -455,22 +454,3 @@ num(S) -> case lists:reverse(S) of
     [$T|T] -> erlang:list_to_integer(lists:reverse(T)) * 1000 * 1000 * 1000 * 1000
   end.
 
-
-cookie_expire(SecondsToLive) ->
-  Seconds = calendar:datetime_to_gregorian_seconds(calendar:local_time()),
-  DateTime = calendar:gregorian_seconds_to_datetime(Seconds + SecondsToLive),
-  cow_date:rfc2109(DateTime).
-
-cookie(Id, Value) -> cookie(Id, Value, 2147483647). %% expire never
-cookie(Id, Value, Expire) ->
-  Format = "document.cookie='~s=~s; path=/; expires=~s';",
-  nitro:wire(?MODULE:f(Format, [?MODULE:to_list(Id), ?MODULE:to_list(Value), cookie_expire(Expire)])).
-
-cookies() -> cowboy_req:parse_cookies((erlang:get(context))#cx.req).
-
-cookie(Key) ->
-  case lists:keyfind(Key, 1, cowboy_req:parse_cookies((erlang:get(context))#cx.req)) of
-    false -> undefined;
-    {_, Value} -> Value
-  end.
-